11#include <freertos/FreeRTOS.h>
12#include <freertos/event_groups.h>
13#include <freertos/semphr.h>
14#include <freertos/task.h>
22 void setup()
override;
24 void start()
override;
35#if SOC_I2S_SUPPORTS_PDM_RX
39#ifdef USE_I2S_AUDIO_FULL_DUPLEX
57 bool start_capture_count_(i2s_chan_handle_t rx_handle,
uint32_t dma_desc_num);
61 bool read_dma_buffer_size_();
63 size_t read_(uint8_t *buf,
size_t len,
uint32_t timeout_ms);
82 portMUX_TYPE
dma_lock_ = portMUX_INITIALIZER_UNLOCKED;
99#if SOC_I2S_SUPPORTS_PDM_RX
Removes DC from mono or stereo PCM, retaining separate channel histories between buffers.
SemaphoreHandle_t active_listeners_semaphore_
static bool i2s_on_recv_q_ovf_cb(i2s_chan_handle_t handle, i2s_event_data_t *event, void *user_ctx)
Counts a buffer the driver dropped because the task fell behind; it will never be read.
void build_full_duplex_config(i2s_std_config_t &std_cfg) override
TaskHandle_t task_handle_
int64_t dma_receive_time_us_
DCOffsetFilter dc_offset_filter_
std::atomic< uint32_t > dma_buffers_dropped_
EventGroupHandle_t event_group_
static bool i2s_on_recv_cb(i2s_chan_handle_t handle, i2s_event_data_t *event, void *user_ctx)
Records the byte count and time of each DMA buffer the driver queues for reading.
void set_correct_dc_offset(bool correct_dc_offset)
void set_din_pin(int8_t pin)
void set_pdm_dsr(i2s_pdm_dsr_t pdm_dsr)
void configure_stream_settings_()
Starts the I2S driver.
void dump_config() override
static void mic_task(void *params)
void build_std_config_(i2s_std_config_t &std_cfg) const
Builds the standard (non-PDM) mode configuration from the configured settings.
i2s_chan_handle_t rx_handle_
uint32_t dma_bytes_received_
void full_duplex_rx_enabling(i2s_chan_handle_t rx_handle, uint32_t dma_desc_num) override
spi_device_handle_t handle