From 56004232482f06fe29357b6dc573b8582ec6a060 Mon Sep 17 00:00:00 2001
From: Per Lindgren <per.lindgren@ltu.se>
Date: Tue, 16 Feb 2021 09:50:48 +0100
Subject: [PATCH] cleanup of rtt-pwm

---
 examples/rtt-pwm.rs | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/examples/rtt-pwm.rs b/examples/rtt-pwm.rs
index 87b380a..5bcfc80 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]
-- 
GitLab