1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-31 07:03:55 +00:00

Allow i2s microphone bits per sample to be configured (#4884)

This commit is contained in:
Jesse Hills
2023-05-26 15:50:44 +12:00
committed by GitHub
parent 9cd173ef83
commit 79abd773a2
7 changed files with 54 additions and 14 deletions

View File

@@ -29,6 +29,7 @@ class I2SAudioMicrophone : public I2SAudioIn, public microphone::Microphone, pub
#endif
void set_channel(i2s_channel_fmt_t channel) { this->channel_ = channel; }
void set_bits_per_sample(i2s_bits_per_sample_t bits_per_sample) { this->bits_per_sample_ = bits_per_sample; }
protected:
void start_();
@@ -41,8 +42,9 @@ class I2SAudioMicrophone : public I2SAudioIn, public microphone::Microphone, pub
bool adc_{false};
#endif
bool pdm_{false};
std::vector<uint8_t> buffer_;
uint8_t *buffer_;
i2s_channel_fmt_t channel_;
i2s_bits_per_sample_t bits_per_sample_;
HighFrequencyLoopRequester high_freq_;
};