summaryrefslogtreecommitdiff
path: root/ports/esp32/adc.h
diff options
context:
space:
mode:
authorAndrea Milazzo <andrea@fonix.com>2024-03-12 09:45:19 +0100
committerDamien George <damien@micropython.org>2024-08-14 15:57:09 +1000
commita4f9c0cc2ac913030458a9fd11f1d49b288cce18 (patch)
tree5520916cb5a07beb5cbb57818e56ebf89892c0ff /ports/esp32/adc.h
parentfb4ae1eeec521d3d0caf09ba234df3a4e98902e2 (diff)
esp32/adc: Add support for v5.2.1 calibration api.
This new calibration routine exists for S3 in v5.1.1. It works for all platforms in 5.2.1. Signed-off-by: Andrew Leech <andrew@alelec.net>
Diffstat (limited to 'ports/esp32/adc.h')
-rw-r--r--ports/esp32/adc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/esp32/adc.h b/ports/esp32/adc.h
index ae5c0d3c3..61771255d 100644
--- a/ports/esp32/adc.h
+++ b/ports/esp32/adc.h
@@ -30,6 +30,7 @@
#include "py/runtime.h"
#include "esp_adc_cal.h"
+#include "esp_adc/adc_cali_scheme.h"
#define ADC_ATTEN_MAX SOC_ADC_ATTEN_NUM
@@ -38,7 +39,11 @@ typedef struct _machine_adc_block_obj_t {
adc_unit_t unit_id;
mp_int_t bits;
adc_bits_width_t width;
+ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 1)
+ adc_cali_handle_t *handle[ADC_ATTEN_MAX];
+ #else
esp_adc_cal_characteristics_t *characteristics[ADC_ATTEN_MAX];
+ #endif
} machine_adc_block_obj_t;
typedef struct _machine_adc_obj_t {