5#if defined(ESP32) && defined(USE_ANALOG) && \
6 !USE_LEGACY_I2S || defined(DOXYGEN)
9 #ifndef perimanClearPinBus
10 #define perimanClearPinBus(p) perimanSetPinBus(p, ESP32_BUS_TYPE_INIT, NULL)
101 return io.readBytes(
dest, size_bytes);
132#if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
134#elif !defined(CONFIG_IDF_TARGET_ESP32H2)
150 LOGE(
"perimanClearPinBus failed!");
173 int samples = size_bytes / 2;
176 for (
int j = 0;
j < samples;
j++) {
191 LOGD(
"readBytes: %d", (
int) size_bytes);
196 for(
int ch=0;
ch < channels;
ch++){
224 if (channel >=0 && channel < channels){
225 int idx = channel + (
sampleIndex[channel] * channels);
226 LOGI(
"idx for %d: %d", channel, idx);
240 LOGE(
"Invalid channel: %d", channel);
252 LOGE(
"adc_continuous_read error");
287 LOGE(
"adc_cali_raw_to_voltage error: %d", err);
294 for (
int ch = 0;
ch < channels;
ch++){
321 LOGE(
"new_channels");
332 LOGE(
"DAC not supported");
351 LOGE(
"adc unit %u continuous is already initialized. Please call end() first!",
cfg.
adc_unit);
364 LOGE(
"perimanClearPinBus failed!");
371 #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
379 "buffer_size is too big for one ADC DMA frame: %u samples = %u "
380 "bytes, max %u samples / %u bytes",
387 "RX DMA frame: %u conversion results, %u bytes (max %u results / "
399#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
400 adc_config.flags.flush_pool =
true;
403 (
unsigned)adc_config.max_store_buf_size);
406 LOGE(
"adc_continuous_new_handle failed with error: %d", err);
409 LOGI(
"adc_continuous_new_handle successful");
432 LOGI(
"dig_cfg.sample_freq_hz: %u", (
unsigned)
dig_cfg.sample_freq_hz);
433 LOGI(
"dig_cfg.conv_mode: %u (1: unit 1, 2: unit 2, 3: both)",
dig_cfg.conv_mode);
434 LOGI(
"dig_cfg.format: %u (0 is type1: [12bit data, 4bit channel])",
dig_cfg.format);
436 LOGI(
"dig_cfg.adc_pattern[%d].atten: %u", i,
dig_cfg.adc_pattern[i].atten);
437 LOGI(
"dig_cfg.adc_pattern[%d].channel: %u", i,
dig_cfg.adc_pattern[i].channel);
438 LOGI(
"dig_cfg.adc_pattern[%d].unit: %u", i,
dig_cfg.adc_pattern[i].unit);
439 LOGI(
"dig_cfg.adc_pattern[%d].bit_width: %u", i,
dig_cfg.adc_pattern[i].bit_width);
445 LOGE(
"adc_continuous_config unsuccessful with error: %d", err);
449 LOGI(
"adc_continuous_config successful");
464 LOGE(
"perimanSetPinBus to Continuous an ADC Unit %u failed!",
cfg.
adc_unit);
475 LOGE(
"adc_continuous_start unsuccessful with error: %d", err);
484 LOGI(
"Setup ADC successful");
496 LOGE(
"dac_continuous_disable failed");
500 LOGE(
"dac_continuous_del_channels failed");
510 LOGD(
"===> adcDetachBus: %d", (
int)
bus);
520 LOGE(
"adc_continuous_stop failed");
527 LOGE(
"adc_continuous_deinit failed");
571 LOGE(
"ADC channel %u is not available on ADC unit %u", adc_channel,
cfg.
adc_unit);
574 LOGI(
"ADC channel %u is on pin %u", adc_channel,
io_pin);
586 LOGE(
"sample rate eff: %u can not be set, range: %u to %u", sample_rate,
590 LOGI(
"sample rate eff: %u, range: %u to %u", sample_rate,
608 LOGE(
"bits per sample: error. It should be: %d but is %d",
630 #if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
637 #elif !defined(CONFIG_IDF_TARGET_ESP32H2)
648 LOGE(
"creating calibration handle failed for ADC%d with atten %d and bitwidth %d",
653 LOGI(
"enabled calibration for ADC%d with atten %d and bitwidth %d",
#define TRACEI()
Definition AudioLoggerIDF.h:32
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define assert(T)
Definition avr.h:10
@ TX_MODE
Definition AudioTypes.h:30
@ RX_MODE
Definition AudioTypes.h:30