From 22f204ec3a908acbf879f36e2826eed281c5f2a6 Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Tue, 2 Jul 2013 12:06:26 +0200 Subject: [PATCH] adc.c: sub-LSB resolution of PWM Simulate a sub-LSB resolution inside the ADC IRQ handler. We do multiple measurements of PWMLED resistor anyway, so it makes sense to modify the PWM value after each reading. And indeed, experiments show less flicker of PWM LEDs with this patch. It is probably an overkill, and can be called only when measuring the PWMLED output (and not ambient light sensor, for example). But it works and it is simple enough. --- firmware/adc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/firmware/adc.c b/firmware/adc.c index 5ebc0a6..2bca0cf 100644 --- a/firmware/adc.c +++ b/firmware/adc.c @@ -238,6 +238,7 @@ ISR(ADC_vect) { // IRQ handler ADCSRA |= _BV(ADSC); adc_sum += adcval; read_count--; + pwm_timer(); return; } -- 2.39.3