1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 14:43:51 +00:00

Add read interface to microphone (#5131)

This commit is contained in:
Jesse Hills
2023-08-08 09:45:56 +12:00
committed by GitHub
parent 9980b9972f
commit 0b1b25191d
3 changed files with 25 additions and 28 deletions

View File

@@ -21,6 +21,8 @@ class I2SAudioMicrophone : public I2SAudioIn, public microphone::Microphone, pub
void set_din_pin(int8_t pin) { this->din_pin_ = pin; }
void set_pdm(bool pdm) { this->pdm_ = pdm; }
size_t read(int16_t *buf, size_t len) override;
#if SOC_I2S_SUPPORTS_ADC
void set_adc_channel(adc1_channel_t channel) {
this->adc_channel_ = channel;
@@ -42,7 +44,6 @@ class I2SAudioMicrophone : public I2SAudioIn, public microphone::Microphone, pub
bool adc_{false};
#endif
bool pdm_{false};
uint8_t *buffer_;
i2s_channel_fmt_t channel_;
i2s_bits_per_sample_t bits_per_sample_;