← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEdvin <[email protected]>2025-10-13 15:41:15 +0200
committerEdvin <[email protected]>2025-10-13 15:41:15 +0200
commit751419d47e2173c7d366e817a8321d9e49dd41c5 (patch)
tree979ef87b1ab2f3a513282038e496e2428178465a /include
First commit
Diffstat (limited to 'include')
-rw-r--r--include/EZADC.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/EZADC.h b/include/EZADC.h
new file mode 100644
index 0000000..08b66ef
--- /dev/null
+++ b/include/EZADC.h
@@ -0,0 +1,35 @@
+#include "esp_log.h"
+#include "esp_adc/adc_oneshot.h"
+#include "esp_adc/adc_cali.h"
+#include "esp_adc/adc_cali_scheme.h"
+
+static int adc_raw[2][10];
+static int voltage[2][10];
+
+typedef struct {
+ adc_oneshot_unit_handle_t adc_handle;
+ adc_oneshot_unit_init_cfg_t adc_init_config;
+ adc_oneshot_chan_cfg_t adc_config;
+ adc_cali_handle_t adc_cali_handle;
+ adc_cali_line_fitting_config_t cali_config;
+ adc_channel_t channel;
+} ADC;
+
+static const adc_channel_t ezadc_channel[] = {ADC_CHANNEL_0,
+ ADC_CHANNEL_1,
+ ADC_CHANNEL_2,
+ ADC_CHANNEL_3,
+ ADC_CHANNEL_4,
+ ADC_CHANNEL_5,
+ ADC_CHANNEL_6,
+ ADC_CHANNEL_7,
+ ADC_CHANNEL_8,
+ ADC_CHANNEL_9};
+
+void init_adc(ADC* adc);
+
+void config_adc(ADC* adc, int config_channel);
+
+void teardown_adc(ADC* adc);
+
+int ez_read(ADC* adc);//, int adc_raw[2][10], int voltage[2][10]);