summaryrefslogtreecommitdiff
path: root/analog_read.h
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@bpcspace.com>2023-10-27 07:10:26 -0500
committerBrett Weiland <brett_weiland@bpcspace.com>2023-10-27 07:10:26 -0500
commite811d778ea51ac1e25588a9cc957fca4f532ea5a (patch)
treed28999567bad4613143d016bfb6d376c22f9e3a2 /analog_read.h
init
Diffstat (limited to 'analog_read.h')
-rw-r--r--analog_read.h19
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