]> www.fi.muni.cz Git - bike-lights.git/commitdiff
pwm.c: channels running - visible from the outside
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 3 Jun 2013 15:11:26 +0000 (17:11 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 3 Jun 2013 15:34:35 +0000 (17:34 +0200)
Make the status of T/C1 visible from the outside, in order to
make the on-demand ADC channel selection possible, and also
to allow selecting the sleep modes in the main loop.

firmware/lights.h
firmware/pwm.c

index 0705dd12457965bef08b097268999bfe7bc90e50..72b719b321eaff5907a604ef2c0f2b7d528cf013 100644 (file)
@@ -37,6 +37,9 @@ void timer_start_slow_adcs();
  * value of T/C 1, it is shifted by PWM_STEP_SHIFT as described in pwm.c
  */
 #define PWM_MAX 0x780
+extern volatile unsigned char channels_running;
+#define PWM_IS_ON(n)   (channels_running & (1 << (n)))
+#define TIMER1_IS_ON() (channels_running)
 void init_pwm();
 void susp_pwm();
 void pwm_off(unsigned char n);
index 512268ccf03ee3b468ac87c56a05b193b6526382..27c8d0d0187d6e9a3f3e2a78448aefa7f0438843 100644 (file)
 #error PWM_TOP too high
 #endif
 
+volatile unsigned char channels_running;
+
 static uint16_t pwm[N_PWMLEDS];
 static volatile unsigned char step;
-static unsigned char channels_running, pll_enabled;
+static unsigned char pll_enabled;
 
 static void enable_pll()
 {