1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-01 11:28:26 +02:00

fw/accel.c (adcsra): let ADC run at 125 kHz (instead of 67.5 kHz)

This commit is contained in:
Werner Almesberger 2012-06-21 21:12:20 -03:00
parent b262e2f142
commit e2f228907b

View File

@ -38,11 +38,15 @@ static inline void admux(bool x)
static inline void adcsra(bool start) static inline void adcsra(bool start)
{ {
/*
* The ADC needs to run at clkADC <= 200 kHz for full resolution.
* At clkADC = 125 kHz, a conversion takes about 110 us.
*/
ADCSRA = ADCSRA =
1 << ADEN | /* enable ADC */ 1 << ADEN | /* enable ADC */
(start ? 1 << ADSC : 0) | (start ? 1 << ADSC : 0) |
1 << ADIE | /* enable ADC interrupts */ 1 << ADIE | /* enable ADC interrupts */
7; /* clkADC = clk/128 -> 62.5 kHz */ 6; /* clkADC = clk/64 -> 126 kHz */
} }