From e811d778ea51ac1e25588a9cc957fca4f532ea5a Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Fri, 27 Oct 2023 07:10:26 -0500 Subject: init --- analog_read.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 analog_read.h (limited to 'analog_read.h') 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 -- cgit v1.2.3