aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32g0
diff options
context:
space:
mode:
authorGrant Miller <[email protected]>2024-09-06 13:53:49 -0500
committerGrant Miller <[email protected]>2024-09-06 13:53:49 -0500
commit1a8977db7837a5635d3c5e0ae8213d1b3181ffb7 (patch)
tree5bceb855c421f6572aa1909d997bd6d9dda3b895 /examples/stm32g0
parentcfc76cec711447300e2d957439a32d6ad418a58c (diff)
Update examples
Diffstat (limited to 'examples/stm32g0')
-rw-r--r--examples/stm32g0/src/bin/input_capture.rs8
-rw-r--r--examples/stm32g0/src/bin/pwm_input.rs9
2 files changed, 8 insertions, 9 deletions
diff --git a/examples/stm32g0/src/bin/input_capture.rs b/examples/stm32g0/src/bin/input_capture.rs
index 69fdae96d..bc814cb13 100644
--- a/examples/stm32g0/src/bin/input_capture.rs
+++ b/examples/stm32g0/src/bin/input_capture.rs
@@ -47,10 +47,10 @@ async fn main(spawner: Spawner) {
47 unwrap!(spawner.spawn(blinky(p.PB1))); 47 unwrap!(spawner.spawn(blinky(p.PB1)));
48 48
49 // Connect PB1 and PA8 with a 1k Ohm resistor 49 // Connect PB1 and PA8 with a 1k Ohm resistor
50 let ch1 = PwmPin::new_ch1(p.PA8, OutputType::PushPull); 50 let ch1_pin = PwmPin::new_ch1(p.PA8, OutputType::PushPull);
51 let mut pwm = SimplePwm::new(p.TIM1, Some(ch1), None, None, None, khz(1), Default::default()); 51 let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(1), Default::default());
52 pwm.enable(Channel::Ch1); 52 pwm.ch1().enable();
53 pwm.set_duty(Channel::Ch1, 50); 53 pwm.ch1().set_duty_cycle(50);
54 54
55 let ch1 = CapturePin::new_ch1(p.PA0, Pull::None); 55 let ch1 = CapturePin::new_ch1(p.PA0, Pull::None);
56 let mut ic = InputCapture::new(p.TIM2, Some(ch1), None, None, None, Irqs, khz(1000), Default::default()); 56 let mut ic = InputCapture::new(p.TIM2, Some(ch1), None, None, None, Irqs, khz(1000), Default::default());
diff --git a/examples/stm32g0/src/bin/pwm_input.rs b/examples/stm32g0/src/bin/pwm_input.rs
index 152ecda86..983705e2f 100644
--- a/examples/stm32g0/src/bin/pwm_input.rs
+++ b/examples/stm32g0/src/bin/pwm_input.rs
@@ -43,11 +43,10 @@ async fn main(spawner: Spawner) {
43 43
44 unwrap!(spawner.spawn(blinky(p.PB1))); 44 unwrap!(spawner.spawn(blinky(p.PB1)));
45 // Connect PA8 and PA6 with a 1k Ohm resistor 45 // Connect PA8 and PA6 with a 1k Ohm resistor
46 let ch1 = PwmPin::new_ch1(p.PA8, OutputType::PushPull); 46 let ch1_pin = PwmPin::new_ch1(p.PA8, OutputType::PushPull);
47 let mut pwm = SimplePwm::new(p.TIM1, Some(ch1), None, None, None, khz(1), Default::default()); 47 let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(1), Default::default());
48 let max = pwm.get_max_duty(); 48 pwm.ch1().set_duty_cycle_fraction(1, 4);
49 pwm.set_duty(Channel::Ch1, max / 4); 49 pwm.ch1().enable();
50 pwm.enable(Channel::Ch1);
51 50
52 let mut pwm_input = PwmInput::new(p.TIM2, p.PA0, Pull::None, khz(1000)); 51 let mut pwm_input = PwmInput::new(p.TIM2, p.PA0, Pull::None, khz(1000));
53 pwm_input.enable(); 52 pwm_input.enable();