ESPHome 2025.6.3
Loading...
Searching...
No Matches
i2s_audio.cpp
Go to the documentation of this file.
1#include "i2s_audio.h"
2
3#ifdef USE_ESP32
4
5#include "esphome/core/log.h"
6
7namespace esphome {
8namespace i2s_audio {
9
10static const char *const TAG = "i2s_audio";
11
12#if defined(USE_ESP_IDF) && (ESP_IDF_VERSION_MAJOR >= 5)
13static const uint8_t I2S_NUM_MAX = SOC_I2S_NUM; // because IDF 5+ took this away :(
14#endif
15
17 ESP_LOGCONFIG(TAG, "Running setup");
18
19 static i2s_port_t next_port_num = I2S_NUM_0;
20 if (next_port_num >= I2S_NUM_MAX) {
21 ESP_LOGE(TAG, "Too many components");
22 this->mark_failed();
23 return;
24 }
25
26 this->port_ = next_port_num;
27 next_port_num = (i2s_port_t) (next_port_num + 1);
28}
29
30} // namespace i2s_audio
31} // namespace esphome
32
33#endif // USE_ESP32
virtual void mark_failed()
Mark this component as failed.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7