Port the PWM example to H7, add low-level API example implementing 32-bit PWM.

This commit is contained in:
Matous Hybl
2021-12-08 17:39:59 +01:00
parent e07df92651
commit e056bedd55
4 changed files with 199 additions and 3 deletions

View File

@ -7,7 +7,7 @@ mod example_common;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::gpio::NoPin;
use embassy_stm32::pwm::{Channel, Pwm};
use embassy_stm32::pwm::{simple_pwm::SimplePwm, Channel};
use embassy_stm32::time::U32Ext;
use embassy_stm32::Peripherals;
use example_common::*;
@ -16,7 +16,7 @@ use example_common::*;
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
let mut pwm = Pwm::new(p.TIM2, p.PA5, NoPin, NoPin, NoPin, 10000.hz());
let mut pwm = SimplePwm::new(p.TIM2, p.PA5, NoPin, NoPin, NoPin, 10000.hz());
let max = pwm.get_max_duty();
pwm.enable(Channel::Ch1);