Controlling PWM of LED through direct access of TIM2 timer's registers.

Dependencies:   mbed

Revision:
1:8d34cf217c0a
Parent:
0:12efa8652054
Child:
2:7c45a714b991
--- a/main.cpp	Wed Jul 24 15:08:28 2019 +0000
+++ b/main.cpp	Fri Jul 26 12:32:55 2019 +0000
@@ -188,6 +188,9 @@
 {
     limit_timer6_counter_to(36000);
     downscale_timer6_by(1999 + (T - 1) * 2e3);
+    // ^This allows : 500us <= T <= 32.768
+    //      The ^former was found by solving : 0 <= 1999 + (T - 1) * 2e3 <= 0xFFFF, for the prescaler register.
+    // -
 }
 
 void inline set_interrupt_period_to_1sec ()