From b5ff7c5d60cd5cba905720b4b8f6cb8c73859ca6 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 23 Jul 2022 16:14:00 +0200 Subject: rename PwmPin::new_chX, update examples. --- examples/stm32f4/src/bin/pwm.rs | 5 +++-- examples/stm32g4/src/bin/pwm.rs | 5 +++-- examples/stm32h7/src/bin/pwm.rs | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/stm32f4/src/bin/pwm.rs b/examples/stm32f4/src/bin/pwm.rs index c99f3cc26..b39bbbe28 100644 --- a/examples/stm32f4/src/bin/pwm.rs +++ b/examples/stm32f4/src/bin/pwm.rs @@ -5,7 +5,7 @@ use defmt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; -use embassy_stm32::pwm::simple_pwm::SimplePwm; +use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; use embassy_stm32::pwm::Channel; use embassy_stm32::time::khz; use embassy_stm32::Peripherals; @@ -15,7 +15,8 @@ use {defmt_rtt as _, panic_probe as _}; async fn main(_spawner: Spawner, p: Peripherals) { info!("Hello World!"); - let mut pwm = SimplePwm::new_1ch(p.TIM1, p.PE9, khz(10)); + let ch1 = PwmPin::new_ch1(p.PE9); + let mut pwm = SimplePwm::new(p.TIM1, Some(ch1), None, None, None, khz(10)); let max = pwm.get_max_duty(); pwm.enable(Channel::Ch1); diff --git a/examples/stm32g4/src/bin/pwm.rs b/examples/stm32g4/src/bin/pwm.rs index 579e289b0..dc4e164ab 100644 --- a/examples/stm32g4/src/bin/pwm.rs +++ b/examples/stm32g4/src/bin/pwm.rs @@ -5,7 +5,7 @@ use defmt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; -use embassy_stm32::pwm::simple_pwm::SimplePwm; +use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; use embassy_stm32::pwm::Channel; use embassy_stm32::time::khz; use embassy_stm32::Peripherals; @@ -15,7 +15,8 @@ use {defmt_rtt as _, panic_probe as _}; async fn main(_spawner: Spawner, p: Peripherals) { info!("Hello World!"); - let mut pwm = SimplePwm::new_1ch(p.TIM2, p.PA5, khz(10)); + let ch1 = PwmPin::new_ch1(p.PA5); + let mut pwm = SimplePwm::new(p.TIM2, Some(ch1), None, None, None, khz(10)); let max = pwm.get_max_duty(); pwm.enable(Channel::Ch1); diff --git a/examples/stm32h7/src/bin/pwm.rs b/examples/stm32h7/src/bin/pwm.rs index f072c5375..730f637e9 100644 --- a/examples/stm32h7/src/bin/pwm.rs +++ b/examples/stm32h7/src/bin/pwm.rs @@ -5,7 +5,7 @@ use defmt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; -use embassy_stm32::pwm::simple_pwm::SimplePwm; +use embassy_stm32::pwm::simple_pwm::{PwmPin, SimplePwm}; use embassy_stm32::pwm::Channel; use embassy_stm32::time::{khz, mhz}; use embassy_stm32::{Config, Peripherals}; @@ -27,7 +27,8 @@ pub fn config() -> Config { async fn main(_spawner: Spawner, p: Peripherals) { info!("Hello World!"); - let mut pwm = SimplePwm::new_1ch(p.TIM3, p.PA6, khz(10)); + let ch1 = PwmPin::new_ch1(p.PA6); + let mut pwm = SimplePwm::new(p.TIM3, Some(ch1), None, None, None, khz(10)); let max = pwm.get_max_duty(); pwm.enable(Channel::Ch1); -- cgit