Commit Graph

6 Commits

Author SHA1 Message Date
Markus Hitter 29cb2e801a analog-avr.c: no need to re-initialise adc_counter.
After firmware startup it's always in a valid range, even in the
unlikely case analog_init() is called twice.

This saves 4 bytes binary size without drawback.
2016-06-23 22:34:31 +02:00
Robert Konklewski b5cbba7ed8 Temp: read ADC on-demand, instead of constantly running.
On AVRs analog conversions were running in essentially
free-running mode, i.e.  next conversion was being started
immediately after the previous one ended. This caused many
unnecessary interrupts.

Now, conversions are initiated manually by start_adc(). This
causes a single read on each of the registered channels. Once
all channels are read, conversions stop until the next call of
start_adc().
2016-06-23 22:32:51 +02:00
Markus Hitter 1a2973a2de analog-avr.c: take the opportunity to rewrite analog_read() here.
The former implementation easily led to memory corruption, because
no range check happened.

Costs 22 bytes binary size, unfortunately.
2015-08-12 14:26:37 +02:00
Markus Hitter 7805e741cd analog-arm.c: read not by ADC channel number, but by Teacup number.
Analog reading should be complete by now :-)
2015-08-12 14:26:37 +02:00
Markus Hitter 708289714f analog-arm.c: use configured analog pins, not two fixed ones.
An obvious neccessity, just not done before to show better how
stuff works.
2015-08-12 14:26:37 +02:00
Markus Hitter 56f6b381fd ARM: split out analog-avr.c from analog.c. 2015-08-12 14:26:37 +02:00