summaryrefslogtreecommitdiff
path: root/analog_read.h
blob: ee6ba27630653c2859459214aad72310be7df3f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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