函数原型:
mic_config_t config(void);
功能说明:
传入参数:
返回值:
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 obtain 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;
};
函数原型:
void config(const mic_config_t& cfg);
功能说明:
传入参数:
返回值:
函数原型:
bool begin(void);
功能说明:
传入参数:
返回值:
函数原型:
void end(void);
功能说明:
传入参数:
返回值:
函数原型:
bool isRunning(void);
功能说明:
传入参数:
返回值:
函数原型:
bool isEnabled(void);
功能说明:
传入参数:
返回值:
函数原型:
size_t isRecording(void);
功能说明:
传入参数:
返回值:
函数原型:
void setSampleRate(uint32_t sample_rate);
功能说明:
传入参数:
返回值:
函数原型:
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);
功能说明:
传入参数:
返回值: