volatile static unsigned char current_adc, current_slow_adc;
static uint16_t adc_sum, read_zero, drop_count, read_count, n_reads_log;
+volatile uint16_t jiffies;
static void setup_mux(unsigned char n)
{
static void inline adc_based_timer()
{
- static uint16_t pattern_counter;
+ static unsigned char count;
- if (++pattern_counter > 250) {
- pattern_counter = 0;
+ if (++count < 40) // about 100 Hz jiffies
+ return;
+
+ count = 0;
+ ++jiffies;
+
+ if ((jiffies & 0x0007) == 0) {
patterns_next_tick();
}
}
/* adc.c */
#define PWMLED_ADC_SHIFT 1 /* 1<<1 measurements per single callback */
+extern volatile uint16_t jiffies;
void init_adc();
void susp_adc();
void timer_start_slow_adcs();
void pwm_off();
void pwm_set(uint8_t stride);
-/* tmr.c */
-extern volatile uint16_t jiffies;
-void init_tmr();
-void susp_tmr();
-
/* pwmled.c */
void init_pwmled();
void pwmled_adc(uint16_t adcval);