Add wait for charging capacitance of ADC S/H
authortmk <hasu@tmk-kbd.com>
Wed, 3 Dec 2014 05:22:10 +0000 (14:22 +0900)
committertmk <hasu@tmk-kbd.com>
Thu, 15 Jan 2015 08:08:48 +0000 (17:08 +0900)
keyboard/hhkb_rn42/rn42/battery.c

index 34aa18446c48c04f7e83dde948474ce28203e096..7e868c9646fd4f9cab1747e58db1c20f19b4f1dd 100644 (file)
@@ -92,6 +92,7 @@ uint16_t battery_voltage(void)
 
     volatile uint16_t bat;
     ADCSRA |= (1<<ADEN);
+    _delay_ms(1);   // wait for charging S/H capacitance
 
     ADCSRA |= (1<<ADSC);
     while (ADCSRA & (1<<ADSC)) ;
Imprint / Impressum