From 65c3ad96cf307c3b77b36e6f6a2af5201c213a3c Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Mon, 3 Jun 2013 17:11:26 +0200 Subject: [PATCH] pwm.c: channels running - visible from the outside 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 | 3 +++ firmware/pwm.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/firmware/lights.h b/firmware/lights.h index 0705dd1..72b719b 100644 --- a/firmware/lights.h +++ b/firmware/lights.h @@ -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); diff --git a/firmware/pwm.c b/firmware/pwm.c index 512268c..27c8d0d 100644 --- a/firmware/pwm.c +++ b/firmware/pwm.c @@ -12,9 +12,11 @@ #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() { -- 2.39.3