stm32/pwm: add output type control
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::OutputType;
|
||||
use embassy_stm32::time::khz;
|
||||
use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
|
||||
use embassy_stm32::timer::Channel;
|
||||
@ -15,7 +16,7 @@ async fn main(_spawner: Spawner) {
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
info!("Hello World!");
|
||||
|
||||
let ch1 = PwmPin::new_ch1(p.PE9);
|
||||
let ch1 = PwmPin::new_ch1(p.PE9, OutputType::PushPull);
|
||||
let mut pwm = SimplePwm::new(p.TIM1, Some(ch1), None, None, None, khz(10));
|
||||
let max = pwm.get_max_duty();
|
||||
pwm.enable(Channel::Ch1);
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::OutputType;
|
||||
use embassy_stm32::time::khz;
|
||||
use embassy_stm32::timer::complementary_pwm::{ComplementaryPwm, ComplementaryPwmPin};
|
||||
use embassy_stm32::timer::simple_pwm::PwmPin;
|
||||
@ -16,8 +17,8 @@ async fn main(_spawner: Spawner) {
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
info!("Hello World!");
|
||||
|
||||
let ch1 = PwmPin::new_ch1(p.PE9);
|
||||
let ch1n = ComplementaryPwmPin::new_ch1(p.PA7);
|
||||
let ch1 = PwmPin::new_ch1(p.PE9, OutputType::PushPull);
|
||||
let ch1n = ComplementaryPwmPin::new_ch1(p.PA7, OutputType::PushPull);
|
||||
let mut pwm = ComplementaryPwm::new(
|
||||
p.TIM1,
|
||||
Some(ch1),
|
||||
|
Reference in New Issue
Block a user