Syntax:
mic_config_t config(void);
Description:
Parameters:
Return:
struct mic_config_t
{
/// i2s_data_in (for mic)
int pin_data_in = -1;
/// i2s_bclk
int pin_bck = I2S_PIN_NO_CHANGE;
/// i2s_mclk
int pin_mck = I2S_PIN_NO_CHANGE;
/// i2s_ws (lrck)
int pin_ws = I2S_PIN_NO_CHANGE;
/// input sampling rate (Hz)
uint32_t sample_rate = 16000;
union
{
struct
{
uint8_t left_channel : 1;
uint8_t stereo : 1;
uint8_t reserve : 6;
};
input_channel_t input_channel = input_only_right;
};
/// Sampling times of obtaining the average value
uint8_t over_sampling = 2;
/// multiplier for input value
uint8_t magnification = 16;
/// Coefficient of the previous value, used for noise filtering
uint8_t noise_filter_level = 0;
/// use analog input mic ( need only pin_data_in )
bool use_adc = false;
/// for I2S dma_buf_len
size_t dma_buf_len = 128;
/// for I2S dma_buf_count
size_t dma_buf_count = 8;
/// background task priority
uint8_t task_priority = 2;
/// background task pinned core
uint8_t task_pinned_core = -1;
/// I2S port
i2s_port_t i2s_port = i2s_port_t::I2S_NUM_0;
};
Syntax:
void config(const mic_config_t& cfg);
Description:
Parameters:
Return:
Syntax:
bool begin(void);
Description:
Parameters:
Return:
Syntax:
void end(void);
Description:
Parameters:
Return:
Syntax:
bool isRunning(void);
Description:
Parameters:
Return:
Syntax:
bool isEnabled(void);
Description:
Parameters:
Return:
Syntax:
size_t isRecording(void);
Description:
Parameters:
Return:
Syntax:
void setSampleRate(uint32_t sample_rate);
Description:
Parameters:
Return:
Syntax:
bool record(uint8_t* rec_data, size_t array_len, uint32_t sample_rate, bool stereo = false);
bool record(int16_t* rec_data, size_t array_len, uint32_t sample_rate, bool stereo = false);
bool record(uint8_t* rec_data, size_t array_len);
bool record(int16_t* rec_data, size_t array_len);
Description:
Parameters:
Return: