From 83a764889c3b14f0a4c7b8485df75b06fa583017 Mon Sep 17 00:00:00 2001 From: linuswck Date: Thu, 13 Jun 2024 15:37:41 +0800 Subject: [PATCH] ld_pwr_exc_protector: set smpr to be slowest - reduce noise on the analog watchdog --- src/laser_diode/ld_pwr_exc_protector.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/laser_diode/ld_pwr_exc_protector.rs b/src/laser_diode/ld_pwr_exc_protector.rs index 7dfbddf..2b2aa8c 100644 --- a/src/laser_diode/ld_pwr_exc_protector.rs +++ b/src/laser_diode/ld_pwr_exc_protector.rs @@ -125,9 +125,10 @@ impl LdPwrExcProtector { }); // Set the Conversion Sequence to include Pd Mon Pin pac_adc.sqr3.write(|w| w.sq1().variant(PD_MON_ADC_CH_ID)); - // Set all sampling channels to have fastest sampling interval - pac_adc.smpr1.reset(); - pac_adc.smpr2.reset(); + + // Set all sampling channels to have slowest sampling interval + pac_adc.smpr1.write(|w| unsafe { w.bits(0xFFFF) }); + pac_adc.smpr2.write(|w| unsafe { w.bits(0xFFFF) }); // Set the higher threshold to be max value initially pac_adc.htr.write(|w| w.ht().variant(MAX_SAMPLE));