diff --git a/examples/rtt-pwm.rs b/examples/rtt-pwm.rs index 87b380ac5c30bb6bce7dd5916445a0a54b6a37bd..5bcfc803be12a4e06ece0e41ab45aadee4091309 100644 --- a/examples/rtt-pwm.rs +++ b/examples/rtt-pwm.rs @@ -1,28 +1,22 @@ -//! examples/rtt_timing.rs //! cargo run --examples rtt-pwm #![deny(unsafe_code)] -// #![deny(warnings)] +#![deny(warnings)] #![no_main] #![no_std] -use cortex_m::{asm, peripheral::DWT}; use panic_halt as _; use rtt_target::{rprintln, rtt_init_print}; -use stm32f4xx_hal::{dma, gpio::Speed, prelude::*, pwm, stm32}; +use stm32f4xx_hal::{gpio::Speed, prelude::*, pwm}; #[rtic::app(device = stm32f4xx_hal::stm32, peripherals = true)] const APP: () = { #[init] - fn init(mut cx: init::Context) { + fn init(cx: init::Context) { rtt_init_print!(); rprintln!("init"); let dp = cx.device; - // Initialize (enable) the monotonic timer (CYCCNT) - cx.core.DCB.enable_trace(); - cx.core.DWT.enable_cycle_counter(); - // Set up the system clock. 16 MHz? let rcc = dp.RCC.constrain(); let clocks = rcc.cfgr.freeze(); @@ -39,10 +33,8 @@ const APP: () = { rprintln!("max_duty {}", max_duty); ch1.set_duty(max_duty / 2); ch1.enable(); - ch2.set_duty((max_duty * 1) / 2); + ch2.set_duty((max_duty * 1) / 3); ch2.enable(); - - } #[idle]