Commit 56004232 authored by Per Lindgren's avatar Per Lindgren
Browse files

cleanup of rtt-pwm

parent 34d1698f
//! 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]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment