diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32f1/src/bin/input_capture.rs | 2 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/input_capture.rs | 2 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/pwm.rs | 2 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/pwm_complementary.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/ws2812_pwm.rs | 2 | ||||
| -rw-r--r-- | examples/stm32g0/src/bin/hf_timer.rs | 4 | ||||
| -rw-r--r-- | examples/stm32g0/src/bin/input_capture.rs | 4 | ||||
| -rw-r--r-- | examples/stm32g0/src/bin/pwm_complementary.rs | 8 | ||||
| -rw-r--r-- | examples/stm32g0/src/bin/pwm_input.rs | 2 | ||||
| -rw-r--r-- | examples/stm32g4/src/bin/pwm.rs | 2 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/low_level_timer_api.rs | 10 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/pwm.rs | 2 | ||||
| -rw-r--r-- | examples/stm32l0/src/bin/dds.rs | 4 |
13 files changed, 24 insertions, 24 deletions
diff --git a/examples/stm32f1/src/bin/input_capture.rs b/examples/stm32f1/src/bin/input_capture.rs index 6fe8e0b50..84811fb95 100644 --- a/examples/stm32f1/src/bin/input_capture.rs +++ b/examples/stm32f1/src/bin/input_capture.rs | |||
| @@ -39,7 +39,7 @@ async fn main(spawner: Spawner) { | |||
| 39 | 39 | ||
| 40 | unwrap!(spawner.spawn(blinky(p.PC13))); | 40 | unwrap!(spawner.spawn(blinky(p.PC13))); |
| 41 | 41 | ||
| 42 | let ch3 = CapturePin::new_ch3(p.PA2, Pull::None); | 42 | let ch3 = CapturePin::new(p.PA2, Pull::None); |
| 43 | let mut ic = InputCapture::new(p.TIM2, None, None, Some(ch3), None, Irqs, khz(1000), Default::default()); | 43 | let mut ic = InputCapture::new(p.TIM2, None, None, Some(ch3), None, Irqs, khz(1000), Default::default()); |
| 44 | 44 | ||
| 45 | loop { | 45 | loop { |
diff --git a/examples/stm32f4/src/bin/input_capture.rs b/examples/stm32f4/src/bin/input_capture.rs index fe5e2bdfc..e15b4d26e 100644 --- a/examples/stm32f4/src/bin/input_capture.rs +++ b/examples/stm32f4/src/bin/input_capture.rs | |||
| @@ -39,7 +39,7 @@ async fn main(spawner: Spawner) { | |||
| 39 | 39 | ||
| 40 | unwrap!(spawner.spawn(blinky(p.PB2))); | 40 | unwrap!(spawner.spawn(blinky(p.PB2))); |
| 41 | 41 | ||
| 42 | let ch3 = CapturePin::new_ch3(p.PB10, Pull::None); | 42 | let ch3 = CapturePin::new(p.PB10, Pull::None); |
| 43 | let mut ic = InputCapture::new(p.TIM2, None, None, Some(ch3), None, Irqs, khz(1000), Default::default()); | 43 | let mut ic = InputCapture::new(p.TIM2, None, None, Some(ch3), None, Irqs, khz(1000), Default::default()); |
| 44 | 44 | ||
| 45 | loop { | 45 | loop { |
diff --git a/examples/stm32f4/src/bin/pwm.rs b/examples/stm32f4/src/bin/pwm.rs index 04811162b..e385842f0 100644 --- a/examples/stm32f4/src/bin/pwm.rs +++ b/examples/stm32f4/src/bin/pwm.rs | |||
| @@ -14,7 +14,7 @@ async fn main(_spawner: Spawner) { | |||
| 14 | let p = embassy_stm32::init(Default::default()); | 14 | let p = embassy_stm32::init(Default::default()); |
| 15 | info!("Hello World!"); | 15 | info!("Hello World!"); |
| 16 | 16 | ||
| 17 | let ch1_pin = PwmPin::new_ch1(p.PE9, OutputType::PushPull); | 17 | let ch1_pin = PwmPin::new(p.PE9, OutputType::PushPull); |
| 18 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(10), Default::default()); | 18 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(10), Default::default()); |
| 19 | let mut ch1 = pwm.ch1(); | 19 | let mut ch1 = pwm.ch1(); |
| 20 | ch1.enable(); | 20 | ch1.enable(); |
diff --git a/examples/stm32f4/src/bin/pwm_complementary.rs b/examples/stm32f4/src/bin/pwm_complementary.rs index 161f43c48..c981f1a76 100644 --- a/examples/stm32f4/src/bin/pwm_complementary.rs +++ b/examples/stm32f4/src/bin/pwm_complementary.rs | |||
| @@ -16,8 +16,8 @@ async fn main(_spawner: Spawner) { | |||
| 16 | let p = embassy_stm32::init(Default::default()); | 16 | let p = embassy_stm32::init(Default::default()); |
| 17 | info!("Hello World!"); | 17 | info!("Hello World!"); |
| 18 | 18 | ||
| 19 | let ch1 = PwmPin::new_ch1(p.PE9, OutputType::PushPull); | 19 | let ch1 = PwmPin::new(p.PE9, OutputType::PushPull); |
| 20 | let ch1n = ComplementaryPwmPin::new_ch1(p.PA7, OutputType::PushPull); | 20 | let ch1n = ComplementaryPwmPin::new(p.PA7, OutputType::PushPull); |
| 21 | let mut pwm = ComplementaryPwm::new( | 21 | let mut pwm = ComplementaryPwm::new( |
| 22 | p.TIM1, | 22 | p.TIM1, |
| 23 | Some(ch1), | 23 | Some(ch1), |
diff --git a/examples/stm32f4/src/bin/ws2812_pwm.rs b/examples/stm32f4/src/bin/ws2812_pwm.rs index ca924e181..5153e1cfd 100644 --- a/examples/stm32f4/src/bin/ws2812_pwm.rs +++ b/examples/stm32f4/src/bin/ws2812_pwm.rs | |||
| @@ -50,7 +50,7 @@ async fn main(_spawner: Spawner) { | |||
| 50 | 50 | ||
| 51 | let mut ws2812_pwm = SimplePwm::new( | 51 | let mut ws2812_pwm = SimplePwm::new( |
| 52 | dp.TIM3, | 52 | dp.TIM3, |
| 53 | Some(PwmPin::new_ch1(dp.PB4, OutputType::PushPull)), | 53 | Some(PwmPin::new(dp.PB4, OutputType::PushPull)), |
| 54 | None, | 54 | None, |
| 55 | None, | 55 | None, |
| 56 | None, | 56 | None, |
diff --git a/examples/stm32g0/src/bin/hf_timer.rs b/examples/stm32g0/src/bin/hf_timer.rs index dfb6e0edc..705905f01 100644 --- a/examples/stm32g0/src/bin/hf_timer.rs +++ b/examples/stm32g0/src/bin/hf_timer.rs | |||
| @@ -37,8 +37,8 @@ async fn main(_spawner: Spawner) { | |||
| 37 | } | 37 | } |
| 38 | let p = embassy_stm32::init(config); | 38 | let p = embassy_stm32::init(config); |
| 39 | 39 | ||
| 40 | let ch1 = PwmPin::new_ch1(p.PA8, OutputType::PushPull); | 40 | let ch1 = PwmPin::new(p.PA8, OutputType::PushPull); |
| 41 | let ch1n = ComplementaryPwmPin::new_ch1(p.PA7, OutputType::PushPull); | 41 | let ch1n = ComplementaryPwmPin::new(p.PA7, OutputType::PushPull); |
| 42 | 42 | ||
| 43 | let mut pwm = ComplementaryPwm::new( | 43 | let mut pwm = ComplementaryPwm::new( |
| 44 | p.TIM1, | 44 | p.TIM1, |
diff --git a/examples/stm32g0/src/bin/input_capture.rs b/examples/stm32g0/src/bin/input_capture.rs index 08df4e043..df339d541 100644 --- a/examples/stm32g0/src/bin/input_capture.rs +++ b/examples/stm32g0/src/bin/input_capture.rs | |||
| @@ -47,12 +47,12 @@ 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_pin = PwmPin::new_ch1(p.PA8, OutputType::PushPull); | 50 | let ch1_pin = PwmPin::new(p.PA8, OutputType::PushPull); |
| 51 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), 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.ch1().enable(); | 52 | pwm.ch1().enable(); |
| 53 | pwm.ch1().set_duty_cycle(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(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()); |
| 57 | 57 | ||
| 58 | let mut old_capture = 0; | 58 | let mut old_capture = 0; |
diff --git a/examples/stm32g0/src/bin/pwm_complementary.rs b/examples/stm32g0/src/bin/pwm_complementary.rs index 97b163c40..dbd9194c9 100644 --- a/examples/stm32g0/src/bin/pwm_complementary.rs +++ b/examples/stm32g0/src/bin/pwm_complementary.rs | |||
| @@ -26,10 +26,10 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 26 | async fn main(_spawner: Spawner) { | 26 | async fn main(_spawner: Spawner) { |
| 27 | let p = embassy_stm32::init(Default::default()); | 27 | let p = embassy_stm32::init(Default::default()); |
| 28 | 28 | ||
| 29 | let ch1 = PwmPin::new_ch1(p.PA8, OutputType::PushPull); | 29 | let ch1 = PwmPin::new(p.PA8, OutputType::PushPull); |
| 30 | let ch1n = ComplementaryPwmPin::new_ch1(p.PA7, OutputType::PushPull); | 30 | let ch1n = ComplementaryPwmPin::new(p.PA7, OutputType::PushPull); |
| 31 | let ch2 = PwmPin::new_ch2(p.PB3, OutputType::PushPull); | 31 | let ch2 = PwmPin::new(p.PB3, OutputType::PushPull); |
| 32 | let ch2n = ComplementaryPwmPin::new_ch2(p.PB0, OutputType::PushPull); | 32 | let ch2n = ComplementaryPwmPin::new(p.PB0, OutputType::PushPull); |
| 33 | 33 | ||
| 34 | let mut pwm = ComplementaryPwm::new( | 34 | let mut pwm = ComplementaryPwm::new( |
| 35 | p.TIM1, | 35 | p.TIM1, |
diff --git a/examples/stm32g0/src/bin/pwm_input.rs b/examples/stm32g0/src/bin/pwm_input.rs index 9d6b5fe97..dc2428607 100644 --- a/examples/stm32g0/src/bin/pwm_input.rs +++ b/examples/stm32g0/src/bin/pwm_input.rs | |||
| @@ -42,7 +42,7 @@ async fn main(spawner: Spawner) { | |||
| 42 | 42 | ||
| 43 | unwrap!(spawner.spawn(blinky(p.PB1))); | 43 | unwrap!(spawner.spawn(blinky(p.PB1))); |
| 44 | // Connect PA8 and PA6 with a 1k Ohm resistor | 44 | // Connect PA8 and PA6 with a 1k Ohm resistor |
| 45 | let ch1_pin = PwmPin::new_ch1(p.PA8, OutputType::PushPull); | 45 | let ch1_pin = PwmPin::new(p.PA8, OutputType::PushPull); |
| 46 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(1), Default::default()); | 46 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(1), Default::default()); |
| 47 | pwm.ch1().set_duty_cycle_fraction(1, 4); | 47 | pwm.ch1().set_duty_cycle_fraction(1, 4); |
| 48 | pwm.ch1().enable(); | 48 | pwm.ch1().enable(); |
diff --git a/examples/stm32g4/src/bin/pwm.rs b/examples/stm32g4/src/bin/pwm.rs index 6c965012c..5b4194927 100644 --- a/examples/stm32g4/src/bin/pwm.rs +++ b/examples/stm32g4/src/bin/pwm.rs | |||
| @@ -14,7 +14,7 @@ async fn main(_spawner: Spawner) { | |||
| 14 | let p = embassy_stm32::init(Default::default()); | 14 | let p = embassy_stm32::init(Default::default()); |
| 15 | info!("Hello World!"); | 15 | info!("Hello World!"); |
| 16 | 16 | ||
| 17 | let ch1_pin = PwmPin::new_ch1(p.PC0, OutputType::PushPull); | 17 | let ch1_pin = PwmPin::new(p.PC0, OutputType::PushPull); |
| 18 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(10), Default::default()); | 18 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(10), Default::default()); |
| 19 | let mut ch1 = pwm.ch1(); | 19 | let mut ch1 = pwm.ch1(); |
| 20 | ch1.enable(); | 20 | ch1.enable(); |
diff --git a/examples/stm32h7/src/bin/low_level_timer_api.rs b/examples/stm32h7/src/bin/low_level_timer_api.rs index 8de31ea5b..12abb8693 100644 --- a/examples/stm32h7/src/bin/low_level_timer_api.rs +++ b/examples/stm32h7/src/bin/low_level_timer_api.rs | |||
| @@ -6,7 +6,7 @@ use embassy_executor::Spawner; | |||
| 6 | use embassy_stm32::gpio::{AfType, Flex, OutputType, Speed}; | 6 | use embassy_stm32::gpio::{AfType, Flex, OutputType, Speed}; |
| 7 | use embassy_stm32::time::{khz, Hertz}; | 7 | use embassy_stm32::time::{khz, Hertz}; |
| 8 | use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer}; | 8 | use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer}; |
| 9 | use embassy_stm32::timer::{Channel, Channel1Pin, Channel2Pin, Channel3Pin, Channel4Pin, GeneralInstance32bit4Channel}; | 9 | use embassy_stm32::timer::{Ch1, Ch2, Ch3, Ch4, Channel, GeneralInstance32bit4Channel, TimerPin}; |
| 10 | use embassy_stm32::{Config, Peri}; | 10 | use embassy_stm32::{Config, Peri}; |
| 11 | use embassy_time::Timer; | 11 | use embassy_time::Timer; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -67,10 +67,10 @@ pub struct SimplePwm32<'d, T: GeneralInstance32bit4Channel> { | |||
| 67 | impl<'d, T: GeneralInstance32bit4Channel> SimplePwm32<'d, T> { | 67 | impl<'d, T: GeneralInstance32bit4Channel> SimplePwm32<'d, T> { |
| 68 | pub fn new( | 68 | pub fn new( |
| 69 | tim: Peri<'d, T>, | 69 | tim: Peri<'d, T>, |
| 70 | ch1: Peri<'d, impl Channel1Pin<T>>, | 70 | ch1: Peri<'d, impl TimerPin<T, Ch1>>, |
| 71 | ch2: Peri<'d, impl Channel2Pin<T>>, | 71 | ch2: Peri<'d, impl TimerPin<T, Ch2>>, |
| 72 | ch3: Peri<'d, impl Channel3Pin<T>>, | 72 | ch3: Peri<'d, impl TimerPin<T, Ch3>>, |
| 73 | ch4: Peri<'d, impl Channel4Pin<T>>, | 73 | ch4: Peri<'d, impl TimerPin<T, Ch4>>, |
| 74 | freq: Hertz, | 74 | freq: Hertz, |
| 75 | ) -> Self { | 75 | ) -> Self { |
| 76 | let af1 = ch1.af_num(); | 76 | let af1 = ch1.af_num(); |
diff --git a/examples/stm32h7/src/bin/pwm.rs b/examples/stm32h7/src/bin/pwm.rs index a1c53fc3f..73b43be69 100644 --- a/examples/stm32h7/src/bin/pwm.rs +++ b/examples/stm32h7/src/bin/pwm.rs | |||
| @@ -36,7 +36,7 @@ async fn main(_spawner: Spawner) { | |||
| 36 | let p = embassy_stm32::init(config); | 36 | let p = embassy_stm32::init(config); |
| 37 | info!("Hello World!"); | 37 | info!("Hello World!"); |
| 38 | 38 | ||
| 39 | let ch1_pin = PwmPin::new_ch1(p.PA6, OutputType::PushPull); | 39 | let ch1_pin = PwmPin::new(p.PA6, OutputType::PushPull); |
| 40 | let mut pwm = SimplePwm::new(p.TIM3, Some(ch1_pin), None, None, None, khz(10), Default::default()); | 40 | let mut pwm = SimplePwm::new(p.TIM3, Some(ch1_pin), None, None, None, khz(10), Default::default()); |
| 41 | let mut ch1 = pwm.ch1(); | 41 | let mut ch1 = pwm.ch1(); |
| 42 | ch1.enable(); | 42 | ch1.enable(); |
diff --git a/examples/stm32l0/src/bin/dds.rs b/examples/stm32l0/src/bin/dds.rs index a54b28a93..eaa7a61a8 100644 --- a/examples/stm32l0/src/bin/dds.rs +++ b/examples/stm32l0/src/bin/dds.rs | |||
| @@ -11,7 +11,7 @@ use embassy_stm32::rcc::*; | |||
| 11 | use embassy_stm32::time::hz; | 11 | use embassy_stm32::time::hz; |
| 12 | use embassy_stm32::timer::low_level::{Timer as LLTimer, *}; | 12 | use embassy_stm32::timer::low_level::{Timer as LLTimer, *}; |
| 13 | use embassy_stm32::timer::simple_pwm::PwmPin; | 13 | use embassy_stm32::timer::simple_pwm::PwmPin; |
| 14 | use embassy_stm32::timer::Channel; | 14 | use embassy_stm32::timer::{Ch3, Channel}; |
| 15 | use embassy_stm32::{interrupt, pac, Config}; | 15 | use embassy_stm32::{interrupt, pac, Config}; |
| 16 | use panic_probe as _; | 16 | use panic_probe as _; |
| 17 | 17 | ||
| @@ -70,7 +70,7 @@ async fn main(_spawner: Spawner) { | |||
| 70 | let p = embassy_stm32::init(config); | 70 | let p = embassy_stm32::init(config); |
| 71 | 71 | ||
| 72 | // setup PWM pin in AF mode | 72 | // setup PWM pin in AF mode |
| 73 | let _ch3 = PwmPin::new_ch3(p.PA2, OutputType::PushPull); | 73 | let _ch3 = PwmPin::<_, Ch3>::new(p.PA2, OutputType::PushPull); |
| 74 | 74 | ||
| 75 | // initialize timer | 75 | // initialize timer |
| 76 | // we cannot use SimplePWM here because the Time is privately encapsulated | 76 | // we cannot use SimplePWM here because the Time is privately encapsulated |
