Skip to content

Commit d057403

Browse files
committed
fix(adc): Rename data struct as its used in idf
1 parent d39181b commit d057403

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

cores/esp32/esp32-hal-adc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static uint8_t __adcContinuousAtten = ADC_11db;
360360
static uint8_t __adcContinuousWidth = SOC_ADC_DIGI_MAX_BITWIDTH;
361361

362362
static uint8_t used_adc_channels = 0;
363-
adc_continuous_data_t *adc_result = NULL;
363+
adc_continuous_result_t *adc_result = NULL;
364364

365365
static bool adcContinuousDetachBus(void *adc_unit_number) {
366366
adc_unit_t adc_unit = (adc_unit_t)adc_unit_number - 1;
@@ -536,7 +536,7 @@ bool analogContinuous(const uint8_t pins[], size_t pins_count, uint32_t conversi
536536
}
537537

538538
//Allocate and prepare result structure for adc readings
539-
adc_result = malloc(pins_count * sizeof(adc_continuous_data_t));
539+
adc_result = malloc(pins_count * sizeof(adc_continuous_result_t));
540540
for (int k = 0; k < pins_count; k++) {
541541
adc_result[k].pin = pins[k];
542542
adc_result[k].channel = channel[k];
@@ -577,7 +577,7 @@ bool analogContinuous(const uint8_t pins[], size_t pins_count, uint32_t conversi
577577
return true;
578578
}
579579

580-
bool analogContinuousRead(adc_continuous_data_t **buffer, uint32_t timeout_ms) {
580+
bool analogContinuousRead(adc_continuous_result_t **buffer, uint32_t timeout_ms) {
581581
if (adc_handle[ADC_UNIT_1].adc_continuous_handle != NULL) {
582582
uint32_t bytes_read = 0;
583583
uint32_t read_raw[used_adc_channels];

cores/esp32/esp32-hal-adc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ typedef struct {
8686
uint8_t channel; /*!<ADC channel */
8787
int avg_read_raw; /*!<ADC average raw data */
8888
int avg_read_mvolts; /*!<ADC average voltage in mV */
89-
} adc_continuous_data_t;
89+
} adc_continuous_result_t;
9090

9191
/*
9292
* Setup ADC continuous peripheral
@@ -96,7 +96,7 @@ bool analogContinuous(const uint8_t pins[], size_t pins_count, uint32_t conversi
9696
/*
9797
* Read ADC continuous conversion data
9898
* */
99-
bool analogContinuousRead(adc_continuous_data_t **buffer, uint32_t timeout_ms);
99+
bool analogContinuousRead(adc_continuous_result_t **buffer, uint32_t timeout_ms);
100100

101101
/*
102102
* Start ADC continuous conversions

docs/en/api/adc.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ ADC Continuous mode is an API designed for performing analog conversions on mult
162162
with the feature of receiving a callback upon completion of these conversions to access the results.
163163

164164
This API allows you to specify the desired number of conversions per pin within a single cycle, along with its corresponding sampling rate.
165-
The outcome of the ``analogContinuousRead`` function is an array of ``adc_continuous_data_t`` structures.
165+
The outcome of the ``analogContinuousRead`` function is an array of ``adc_continuous_result_t`` structures.
166166
These structures hold both the raw average value and the average value in millivolts for each pin.
167167

168168
analogContinuous
@@ -186,7 +186,7 @@ If ``false`` is returned, error occurs and ADC continuous was not configured.
186186
analogContinuousRead
187187
^^^^^^^^^^^^^^^^^^^^
188188

189-
This function is used to read ADC continuous data to the result buffer. The result buffer is an array of ``adc_continuous_data_t``.
189+
This function is used to read ADC continuous data to the result buffer. The result buffer is an array of ``adc_continuous_result_t``.
190190

191191
.. code-block:: arduino
192192
@@ -195,13 +195,13 @@ This function is used to read ADC continuous data to the result buffer. The resu
195195
uint8_t channel; /*!<ADC channel */
196196
int avg_read_raw; /*!<ADC average raw data */
197197
int avg_read_mvolts; /*!<ADC average voltage in mV */
198-
} adc_continuous_data_t;
198+
} adc_continuous_result_t;
199199
200200
.. code-block:: arduino
201201
202-
bool analogContinuousRead(adc_continuous_data_t ** buffer, uint32_t timeout_ms);
202+
bool analogContinuousRead(adc_continuous_result_t ** buffer, uint32_t timeout_ms);
203203
204-
* ``buffer`` conversion result buffer to read from ADC in adc_continuous_data_t format.
204+
* ``buffer`` conversion result buffer to read from ADC in adc_continuous_result_t format.
205205
* ``timeout_ms`` time to wait for data in milliseconds.
206206

207207
This function will return ``true`` if reading is successful and ``buffer`` is filled with data.

libraries/ESP32/examples/AnalogReadContinuous/AnalogReadContinuous.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ uint8_t adc_pins_count = sizeof(adc_pins) / sizeof(uint8_t);
1616
volatile bool adc_coversion_done = false;
1717

1818
// Result structure for ADC Continuous reading
19-
adc_continuous_data_t *result = NULL;
19+
adc_continuous_result_t *result = NULL;
2020

2121
// ISR Function that will be triggered when ADC conversion is done
2222
void ARDUINO_ISR_ATTR adcComplete() {

tests/validation/periman/periman.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void adc_continuous_test(void) {
158158
test_executed = true;
159159
uint8_t adc_pins[] = {ADC1_DEFAULT, ADC2_DEFAULT};
160160
uint8_t adc_pins_count = 2;
161-
adc_continuous_data_t *result = NULL;
161+
adc_continuous_result_t *result = NULL;
162162

163163
analogContinuousSetWidth(12);
164164
analogContinuousSetAtten(ADC_11db);

0 commit comments

Comments
 (0)