0x04, 0x14, 0x24, 0x38,
};
+// TODO: maybe convert this to bitmask to simplify pwmled_needs_adc() ?
static unsigned char pwmled_state[N_PWMLEDS];
#define ST_DISABLED 0
#define ST_PROBING 1
return 0;
}
+unsigned char pwmled_enabled(unsigned char n)
+{
+ unsigned char st = pwmled_state[n];
+ if (st == ST_OFF || st == ST_ON)
+ return 1;
+ else
+ return 0;
+}
+
+void pwmled_set_mode(unsigned char n, unsigned char mode)
+{
+ if (!pwmled_enabled(n))
+ return;
+
+ if (mode == 0) {
+ pwm_off(n);
+ pwmled_state[n] = ST_OFF;
+ return;
+ }
+
+ if (mode <= N_PWMLED_MODES) {
+ mode--;
+ pwm_set(n, pwm_vals[n*N_PWMLED_MODES+mode]);
+ pwmled_state[n] = ST_ON;
+ pwmled_mode[n] = mode;
+ }
+}
+
static void inline probing_adc(unsigned char n, uint16_t adcval)
{
unsigned char need_bigger = 0, i;