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 0705dd1..72b719b 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 512268c..27c8d0d 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()
 {