File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -199,9 +199,19 @@ impl ADC {
199
199
}
200
200
201
201
/// Enable and get the `Temperature`
202
- pub fn enable_temperature ( & mut self ) -> Temperature {
202
+ pub fn enable_temperature ( & mut self , delay : & mut impl DelayUs < u32 > ) -> Temperature {
203
203
self . common . ccr . modify ( |_, w| w. ch17sel ( ) . set_bit ( ) ) ;
204
204
205
+ // rm0351 section 18.4.32 pg580 (L47/L48/L49/L4A models)
206
+ // Note:
207
+ // The sensor has a startup time after waking from power-down mode before it can output VTS
208
+ // at the correct level. The ADC also has a startup time after power-on, so to minimize the
209
+ // delay, the ADEN and CH17SEL bits should be set at the same time.
210
+ //
211
+ // https://github.com/STMicroelectronics/STM32CubeL4/blob/master/Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_ll_adc.h#L1363
212
+ // 120us is used in the ST HAL code
213
+ delay. delay_us ( 150 ) ;
214
+
205
215
Temperature { }
206
216
}
207
217
You can’t perform that action at this time.
0 commit comments