diff options
Diffstat (limited to 'analog_read.h')
-rw-r--r-- | analog_read.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/analog_read.h b/analog_read.h new file mode 100644 index 0000000..ee6ba27 --- /dev/null +++ b/analog_read.h @@ -0,0 +1,19 @@ +#ifndef ANALOG_READ_H +#define ANALOG_READ_H + +/** analog read: + * change ADMUX MUXn and REFS1:0 to select channel, + * ADC enbale bit: ADEN in ADCSRA + * ADC is data reg. Right ajusted, can be left by ADLAR in ADMUX + * If left ajusted & no more then 8 bits, read ADCH, otherwise first ADCL + * Conversion: + * Set ADSC (is cleared once conversion is done) + * Or: ADTS mux bits in ADCSRA for auto trigger (will trigger on high) + * interrupt flag will be enabled +**/ + +//PORTF pin 1 hardcoded as analog +uint8_t analog_read_8bit(); +void init_adc(); + +#endif |