File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
- //! Connect an oscilloscope to an IO pin and see the modulation sine wave.
1
+ //! Connect an oscilloscope to an IO pin and see the modulation sawtooth wave.
2
2
//!
3
3
//! Also you may connect low-pass filter to SDM output.
4
4
//!
@@ -33,15 +33,17 @@ fn main() -> ! {
33
33
}
34
34
}
35
35
36
- let mut sdm = Sdm :: new ( peripherals. GPIO_SD ) ;
37
- let mut sdm_ch = sdm. enable_pin ( modulation_pin, 100 . kHz ( ) ) . unwrap ( ) ;
36
+ let sdm = Sdm :: new ( peripherals. GPIO_SD ) ;
37
+ let sdm_ch = sdm. channel0 . connect ( modulation_pin, 100 . kHz ( ) ) . unwrap ( ) ;
38
38
39
39
let delay = Delay :: new ( ) ;
40
40
41
41
println ! ( "Sigma-delta modulation is on" ) ;
42
42
43
43
loop {
44
- sdm_ch. set_pulse_density ( 0 ) ;
45
- delay. delay_millis ( 1500 ) ;
44
+ for density in -90 ..90 {
45
+ sdm_ch. set_pulse_density ( density) ;
46
+ delay. delay_millis ( 1 ) ;
47
+ }
46
48
}
47
49
}
You can’t perform that action at this time.
0 commit comments