5#if defined(ESP32) && defined(USE_ANALOG) && !USE_LEGACY_I2S
8 #ifndef perimanClearPinBus
9 #define perimanClearPinBus(p) perimanSetPinBus(p, ESP32_BUS_TYPE_INIT, NULL)
100 return io.readBytes(
dest, size_bytes);
131#if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
133#elif !defined(CONFIG_IDF_TARGET_ESP32H2)
149 LOGE(
"perimanClearPinBus failed!");
172 int samples = size_bytes / 2;
175 for (
int j = 0;
j < samples;
j++) {
190 LOGD(
"readBytes: %d", (
int) size_bytes);
195 for(
int ch=0;
ch < channels;
ch++){
223 if (channel >=0 && channel < channels){
224 int idx = channel + (
sampleIndex[channel] * channels);
225 LOGI(
"idx for %d: %d", channel, idx);
239 LOGE(
"Invalid channel: %d", channel);
251 LOGE(
"adc_continuous_read error");
286 LOGE(
"adc_cali_raw_to_voltage error: %d", err);
293 for (
int ch = 0;
ch < channels;
ch++){
320 LOGE(
"new_channels");
331 LOGE(
"DAC not supported");
350 LOGE(
"adc unit %u continuous is already initialized. Please call end() first!",
cfg.
adc_unit);
363 LOGE(
"perimanClearPinBus failed!");
370 #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
378 "buffer_size is too big for one ADC DMA frame: %u samples = %u "
379 "bytes, max %u samples / %u bytes",
386 "RX DMA frame: %u conversion results, %u bytes (max %u results / "
398#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
399 adc_config.flags.flush_pool =
true;
402 (
unsigned)adc_config.max_store_buf_size);
405 LOGE(
"adc_continuous_new_handle failed with error: %d", err);
408 LOGI(
"adc_continuous_new_handle successful");
431 LOGI(
"dig_cfg.sample_freq_hz: %u", (
unsigned)
dig_cfg.sample_freq_hz);
432 LOGI(
"dig_cfg.conv_mode: %u (1: unit 1, 2: unit 2, 3: both)",
dig_cfg.conv_mode);
433 LOGI(
"dig_cfg.format: %u (0 is type1: [12bit data, 4bit channel])",
dig_cfg.format);
435 LOGI(
"dig_cfg.adc_pattern[%d].atten: %u", i,
dig_cfg.adc_pattern[i].atten);
436 LOGI(
"dig_cfg.adc_pattern[%d].channel: %u", i,
dig_cfg.adc_pattern[i].channel);
437 LOGI(
"dig_cfg.adc_pattern[%d].unit: %u", i,
dig_cfg.adc_pattern[i].unit);
438 LOGI(
"dig_cfg.adc_pattern[%d].bit_width: %u", i,
dig_cfg.adc_pattern[i].bit_width);
444 LOGE(
"adc_continuous_config unsuccessful with error: %d", err);
448 LOGI(
"adc_continuous_config successful");
463 LOGE(
"perimanSetPinBus to Continuous an ADC Unit %u failed!",
cfg.
adc_unit);
474 LOGE(
"adc_continuous_start unsuccessful with error: %d", err);
483 LOGI(
"Setup ADC successful");
495 LOGE(
"dac_continuous_disable failed");
499 LOGE(
"dac_continuous_del_channels failed");
509 LOGD(
"===> adcDetachBus: %d", (
int)
bus);
519 LOGE(
"adc_continuous_stop failed");
526 LOGE(
"adc_continuous_deinit failed");
570 LOGE(
"ADC channel %u is not available on ADC unit %u", adc_channel,
cfg.
adc_unit);
573 LOGI(
"ADC channel %u is on pin %u", adc_channel,
io_pin);
585 LOGE(
"sample rate eff: %u can not be set, range: %u to %u", sample_rate,
589 LOGI(
"sample rate eff: %u, range: %u to %u", sample_rate,
607 LOGE(
"bits per sample: error. It should be: %d but is %d",
629 #if ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED
636 #elif !defined(CONFIG_IDF_TARGET_ESP32H2)
647 LOGE(
"creating calibration handle failed for ADC%d with atten %d and bitwidth %d",
652 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:26
@ RX_MODE
Definition AudioTypes.h:26