File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ fn main() -> ! {
26
26
let mut adc = dp. ADC . constrain ( & mut rcc) ;
27
27
adc. set_sample_time ( SampleTime :: T_80 ) ;
28
28
adc. set_precision ( Precision :: B_12 ) ;
29
- adc. set_oversamling_ratio ( OversamplingRatio :: X_16 ) ;
30
- adc. set_oversamling_shift ( 16 ) ;
31
- adc. oversamling_enable ( true ) ;
29
+ adc. set_oversampling_ratio ( OversamplingRatio :: X_16 ) ;
30
+ adc. set_oversampling_shift ( 16 ) ;
31
+ adc. oversampling_enable ( true ) ;
32
32
33
33
delay. delay ( 20 . us ( ) ) ; // Wait for ADC voltage regulator to stabilize
34
34
adc. calibrate ( ) ;
Original file line number Diff line number Diff line change @@ -166,9 +166,9 @@ fn main() -> ! {
166
166
let u = u_raw. saturating_sub ( 32 ) as f32 / 4_096_f32 * 3.3 ;
167
167
hprintln ! ( "u: {:.4} V " , u) . unwrap ( ) ;
168
168
169
- adc. set_oversamling_ratio ( adc:: OversamplingRatio :: X_16 ) ;
170
- adc. set_oversamling_shift ( 4 ) ;
171
- adc. oversamling_enable ( true ) ;
169
+ adc. set_oversampling_ratio ( adc:: OversamplingRatio :: X_16 ) ;
170
+ adc. set_oversampling_shift ( 4 ) ;
171
+ adc. oversampling_enable ( true ) ;
172
172
adc. prepare_injected ( & mut pa3, InjTrigSource :: TRG_2 ) ;
173
173
adc. start_injected ( ) ;
174
174
Original file line number Diff line number Diff line change @@ -196,20 +196,20 @@ impl Adc {
196
196
}
197
197
198
198
/// The nuber of bits, the oversampling result is shifted in bits at the end of oversampling
199
- pub fn set_oversamling_shift ( & mut self , nrbits : u8 ) {
199
+ pub fn set_oversampling_shift ( & mut self , nrbits : u8 ) {
200
200
self . rb
201
201
. cfgr2
202
202
. modify ( |_, w| unsafe { w. ovss ( ) . bits ( nrbits) } ) ;
203
203
}
204
204
205
205
/// Oversampling of adc according to datasheet of stm32g0, when oversampling is enabled
206
- pub fn set_oversamling_ratio ( & mut self , ratio : OversamplingRatio ) {
206
+ pub fn set_oversampling_ratio ( & mut self , ratio : OversamplingRatio ) {
207
207
self . rb
208
208
. cfgr2
209
209
. modify ( |_, w| unsafe { w. ovsr ( ) . bits ( ratio as u8 ) } ) ;
210
210
}
211
211
212
- pub fn oversamling_enable ( & mut self , enable : bool ) {
212
+ pub fn oversampling_enable ( & mut self , enable : bool ) {
213
213
self . rb . cfgr2 . modify ( |_, w| w. ovse ( ) . bit ( enable) ) ;
214
214
}
215
215
You can’t perform that action at this time.
0 commit comments