esphome 2024.10.3__py3-none-any.whl → 2024.11.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esphome/__main__.py +22 -4
- esphome/automation.py +29 -2
- esphome/components/animation/__init__.py +5 -8
- esphome/components/animation/animation.cpp +1 -1
- esphome/components/audio/__init__.py +9 -0
- esphome/components/audio/audio.h +21 -0
- esphome/components/axs15231/__init__.py +6 -0
- esphome/components/axs15231/touchscreen/__init__.py +36 -0
- esphome/components/axs15231/touchscreen/axs15231_touchscreen.cpp +64 -0
- esphome/components/axs15231/touchscreen/axs15231_touchscreen.h +27 -0
- esphome/components/bme68x_bsec2/__init__.py +1 -1
- esphome/components/bytebuffer/__init__.py +5 -0
- esphome/components/bytebuffer/bytebuffer.h +421 -0
- esphome/components/climate/__init__.py +14 -13
- esphome/components/datetime/__init__.py +3 -3
- esphome/components/debug/debug_esp32.cpp +16 -8
- esphome/components/dfplayer/dfplayer.cpp +132 -6
- esphome/components/dfplayer/dfplayer.h +19 -53
- esphome/components/display/display.cpp +142 -0
- esphome/components/display/display.h +7 -0
- esphome/components/es8311/__init__.py +0 -0
- esphome/components/es8311/audio_dac.py +70 -0
- esphome/components/es8311/es8311.cpp +227 -0
- esphome/components/es8311/es8311.h +135 -0
- esphome/components/es8311/es8311_const.h +195 -0
- esphome/components/esp32/boards.py +199 -1
- esphome/components/esp32/gpio.py +3 -1
- esphome/components/esp32_ble/const_esp32c6.h +7 -0
- esphome/components/esp32_ble_client/ble_client_base.h +1 -1
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +2 -1
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +2 -2
- esphome/components/esp32_rmt_led_strip/led_strip.h +2 -0
- esphome/components/esp32_rmt_led_strip/light.py +3 -1
- esphome/components/esp8266/gpio.py +7 -5
- esphome/components/ethernet/__init__.py +55 -1
- esphome/components/ethernet/ethernet_component.cpp +14 -1
- esphome/components/ethernet/ethernet_component.h +7 -1
- esphome/components/font/__init__.py +213 -108
- esphome/components/gp8403/output/__init__.py +1 -1
- esphome/components/host/gpio.py +6 -4
- esphome/components/http_request/__init__.py +12 -0
- esphome/components/http_request/http_request.h +65 -3
- esphome/components/http_request/http_request_arduino.cpp +2 -3
- esphome/components/http_request/http_request_idf.cpp +6 -14
- esphome/components/http_request/ota/ota_http_request.cpp +1 -1
- esphome/components/http_request/update/http_request_update.cpp +1 -1
- esphome/components/i2c_device/__init__.py +26 -0
- esphome/components/i2c_device/i2c_device.cpp +17 -0
- esphome/components/i2c_device/i2c_device.h +18 -0
- esphome/components/i2s_audio/__init__.py +1 -3
- esphome/components/i2s_audio/speaker/__init__.py +12 -4
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +432 -197
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +91 -32
- esphome/components/ili9xxx/display.py +5 -1
- esphome/components/image/__init__.py +5 -8
- esphome/components/image/image.cpp +14 -14
- esphome/components/image/image.h +20 -24
- esphome/components/internal_temperature/internal_temperature.cpp +51 -2
- esphome/components/internal_temperature/internal_temperature.h +1 -0
- esphome/components/libretiny/gpio.py +4 -2
- esphome/components/light/__init__.py +32 -1
- esphome/components/light/automation.py +39 -32
- esphome/components/light/effects.py +36 -36
- esphome/components/light/light_state.cpp +6 -16
- esphome/components/light/light_state.h +34 -0
- esphome/components/light/types.py +3 -1
- esphome/components/logger/logger_esp32.cpp +15 -0
- esphome/components/lvgl/__init__.py +202 -95
- esphome/components/lvgl/automation.py +42 -40
- esphome/components/lvgl/binary_sensor/__init__.py +8 -15
- esphome/components/lvgl/defines.py +14 -8
- esphome/components/lvgl/encoders.py +11 -8
- esphome/components/lvgl/keypads.py +77 -0
- esphome/components/lvgl/light/__init__.py +6 -8
- esphome/components/lvgl/lv_validation.py +2 -4
- esphome/components/lvgl/lvcode.py +3 -9
- esphome/components/lvgl/lvgl_esphome.cpp +210 -89
- esphome/components/lvgl/lvgl_esphome.h +113 -30
- esphome/components/lvgl/lvgl_proxy.h +17 -0
- esphome/components/lvgl/number/__init__.py +10 -15
- esphome/components/lvgl/schemas.py +4 -2
- esphome/components/lvgl/select/__init__.py +12 -37
- esphome/components/lvgl/select/lvgl_select.h +27 -33
- esphome/components/lvgl/sensor/__init__.py +8 -14
- esphome/components/lvgl/styles.py +3 -4
- esphome/components/lvgl/switch/__init__.py +8 -13
- esphome/components/lvgl/text/__init__.py +5 -6
- esphome/components/lvgl/text_sensor/__init__.py +15 -15
- esphome/components/lvgl/touchscreens.py +2 -3
- esphome/components/lvgl/trigger.py +7 -9
- esphome/components/lvgl/types.py +9 -3
- esphome/components/lvgl/widgets/__init__.py +32 -21
- esphome/components/lvgl/widgets/dropdown.py +22 -10
- esphome/components/lvgl/widgets/msgbox.py +6 -5
- esphome/components/lvgl/widgets/obj.py +4 -2
- esphome/components/lvgl/widgets/page.py +3 -2
- esphome/components/lvgl/widgets/qrcode.py +54 -0
- esphome/components/lvgl/widgets/roller.py +21 -14
- esphome/components/lvgl/widgets/tileview.py +2 -1
- esphome/components/max17043/__init__.py +1 -0
- esphome/components/max17043/automation.h +20 -0
- esphome/components/max17043/max17043.cpp +98 -0
- esphome/components/max17043/max17043.h +29 -0
- esphome/components/max17043/sensor.py +77 -0
- esphome/components/media_player/__init__.py +11 -0
- esphome/components/media_player/automation.h +10 -0
- esphome/components/media_player/media_player.cpp +4 -0
- esphome/components/midea/air_conditioner.cpp +17 -1
- esphome/components/mlx90393/sensor.py +1 -1
- esphome/components/modbus_controller/__init__.py +31 -1
- esphome/components/modbus_controller/automation.h +16 -0
- esphome/components/modbus_controller/const.py +2 -0
- esphome/components/modbus_controller/modbus_controller.cpp +14 -2
- esphome/components/modbus_controller/modbus_controller.h +9 -0
- esphome/components/mopeka_pro_check/mopeka_pro_check.cpp +40 -21
- esphome/components/mopeka_pro_check/mopeka_pro_check.h +9 -2
- esphome/components/mopeka_pro_check/sensor.py +41 -0
- esphome/components/mqtt/__init__.py +36 -0
- esphome/components/mqtt/mqtt_client.cpp +27 -3
- esphome/components/mqtt/mqtt_client.h +27 -2
- esphome/components/mqtt/mqtt_climate.cpp +4 -2
- esphome/components/mqtt/mqtt_component.cpp +6 -0
- esphome/components/mqtt/mqtt_component.h +4 -0
- esphome/components/mqtt/mqtt_const.h +6 -0
- esphome/components/online_image/online_image.cpp +2 -8
- esphome/components/online_image/online_image.h +2 -6
- esphome/components/opentherm/__init__.py +35 -9
- esphome/components/opentherm/binary_sensor/__init__.py +33 -0
- esphome/components/opentherm/const.py +11 -0
- esphome/components/opentherm/generate.py +142 -0
- esphome/components/opentherm/hub.cpp +130 -24
- esphome/components/opentherm/hub.h +62 -9
- esphome/components/opentherm/input.h +18 -0
- esphome/components/opentherm/input.py +51 -0
- esphome/components/opentherm/number/__init__.py +74 -0
- esphome/components/opentherm/number/number.cpp +40 -0
- esphome/components/opentherm/number/number.h +31 -0
- esphome/components/opentherm/opentherm.cpp +30 -0
- esphome/components/opentherm/opentherm.h +34 -2
- esphome/components/opentherm/opentherm_macros.h +151 -0
- esphome/components/opentherm/output/__init__.py +47 -0
- esphome/components/opentherm/output/output.cpp +18 -0
- esphome/components/opentherm/output/output.h +33 -0
- esphome/components/opentherm/schema.py +814 -0
- esphome/components/opentherm/sensor/__init__.py +51 -0
- esphome/components/opentherm/switch/__init__.py +43 -0
- esphome/components/opentherm/switch/switch.cpp +28 -0
- esphome/components/opentherm/switch/switch.h +20 -0
- esphome/components/opentherm/validate.py +31 -0
- esphome/components/pcd8544/display.py +8 -4
- esphome/components/prometheus/prometheus_handler.cpp +176 -14
- esphome/components/prometheus/prometheus_handler.h +25 -7
- esphome/components/qspi_amoled/display.py +1 -141
- esphome/components/qspi_dbi/display.py +185 -0
- esphome/components/qspi_dbi/models.py +64 -0
- esphome/components/{qspi_amoled/qspi_amoled.cpp → qspi_dbi/qspi_dbi.cpp} +95 -46
- esphome/components/{qspi_amoled/qspi_amoled.h → qspi_dbi/qspi_dbi.h} +26 -15
- esphome/components/rp2040/__init__.py +6 -3
- esphome/components/rp2040/gpio.py +5 -3
- esphome/components/rtttl/rtttl.cpp +4 -1
- esphome/components/rtttl/rtttl.h +1 -0
- esphome/components/sdl/sdl_esphome.cpp +22 -5
- esphome/components/sdl/sdl_esphome.h +1 -0
- esphome/components/sensor/__init__.py +18 -8
- esphome/components/sensor/filter.cpp +19 -18
- esphome/components/sensor/filter.h +9 -10
- esphome/components/sgp4x/sgp4x.cpp +40 -74
- esphome/components/sgp4x/sgp4x.h +5 -3
- esphome/components/speaker/__init__.py +51 -5
- esphome/components/speaker/automation.h +25 -0
- esphome/components/speaker/speaker.h +72 -1
- esphome/components/spi/__init__.py +15 -14
- esphome/components/spi_device/__init__.py +4 -15
- esphome/components/ssd1306_spi/display.py +6 -2
- esphome/components/ssd1322_spi/display.py +6 -2
- esphome/components/ssd1325_spi/display.py +6 -2
- esphome/components/ssd1327_spi/display.py +6 -2
- esphome/components/ssd1331_spi/display.py +6 -2
- esphome/components/ssd1351_spi/display.py +6 -2
- esphome/components/st7567_spi/display.py +6 -2
- esphome/components/st7701s/display.py +5 -1
- esphome/components/st7735/display.py +10 -5
- esphome/components/st7789v/display.py +12 -7
- esphome/components/statsd/statsd.cpp +2 -0
- esphome/components/statsd/statsd.h +2 -0
- esphome/components/sun/sun.h +3 -0
- esphome/components/tc74/__init__.py +1 -0
- esphome/components/tc74/sensor.py +32 -0
- esphome/components/tc74/tc74.cpp +68 -0
- esphome/components/tc74/tc74.h +28 -0
- esphome/components/touchscreen/__init__.py +41 -50
- esphome/components/touchscreen/touchscreen.h +4 -8
- esphome/components/udp/udp_component.cpp +6 -3
- esphome/components/udp/udp_component.h +4 -2
- esphome/components/waveshare_epaper/display.py +6 -2
- esphome/components/web_server/web_server.cpp +22 -0
- esphome/components/web_server/web_server.h +3 -0
- esphome/components/weikai/weikai.h +2 -2
- esphome/components/wifi/wifi_component.cpp +2 -2
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +4 -4
- esphome/components/wifi/wifi_component_esp8266.cpp +4 -4
- esphome/components/wifi/wifi_component_esp_idf.cpp +2 -2
- esphome/components/xpt2046/touchscreen/__init__.py +7 -32
- esphome/config_validation.py +3 -1
- esphome/const.py +8 -1
- esphome/core/defines.h +8 -2
- esphome/core/helpers.cpp +32 -17
- esphome/core/helpers.h +32 -16
- esphome/core/ring_buffer.cpp +2 -2
- esphome/core/ring_buffer.h +2 -2
- esphome/dashboard/core.py +25 -0
- esphome/dashboard/status/mdns.py +3 -4
- esphome/dashboard/web_server.py +54 -19
- esphome/espota2.py +36 -35
- esphome/helpers.py +68 -16
- esphome/mqtt.py +9 -2
- esphome/storage_json.py +4 -0
- esphome/writer.py +7 -18
- esphome/zeroconf.py +8 -6
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/METADATA +7 -5
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/RECORD +226 -180
- esphome/core/bytebuffer.cpp +0 -167
- esphome/core/bytebuffer.h +0 -144
- /esphome/components/{qspi_amoled → qspi_dbi}/__init__.py +0 -0
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/LICENSE +0 -0
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/WHEEL +0 -0
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/entry_points.txt +0 -0
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,227 @@
|
|
1
|
+
#include "es8311.h"
|
2
|
+
#include "es8311_const.h"
|
3
|
+
#include "esphome/core/hal.h"
|
4
|
+
#include "esphome/core/log.h"
|
5
|
+
#include <cinttypes>
|
6
|
+
|
7
|
+
namespace esphome {
|
8
|
+
namespace es8311 {
|
9
|
+
|
10
|
+
static const char *const TAG = "es8311";
|
11
|
+
|
12
|
+
// Mark the component as failed; use only in setup
|
13
|
+
#define ES8311_ERROR_FAILED(func) \
|
14
|
+
if (!(func)) { \
|
15
|
+
this->mark_failed(); \
|
16
|
+
return; \
|
17
|
+
}
|
18
|
+
// Return false; use outside of setup
|
19
|
+
#define ES8311_ERROR_CHECK(func) \
|
20
|
+
if (!(func)) { \
|
21
|
+
return false; \
|
22
|
+
}
|
23
|
+
|
24
|
+
void ES8311::setup() {
|
25
|
+
ESP_LOGCONFIG(TAG, "Setting up ES8311...");
|
26
|
+
|
27
|
+
// Reset
|
28
|
+
ES8311_ERROR_FAILED(this->write_byte(ES8311_REG00_RESET, 0x1F));
|
29
|
+
ES8311_ERROR_FAILED(this->write_byte(ES8311_REG00_RESET, 0x00));
|
30
|
+
|
31
|
+
ES8311_ERROR_FAILED(this->configure_clock_());
|
32
|
+
ES8311_ERROR_FAILED(this->configure_format_());
|
33
|
+
ES8311_ERROR_FAILED(this->configure_mic_());
|
34
|
+
|
35
|
+
// Set initial volume
|
36
|
+
this->set_volume(0.75); // 0.75 = 0xBF = 0dB
|
37
|
+
|
38
|
+
// Power up analog circuitry
|
39
|
+
ES8311_ERROR_FAILED(this->write_byte(ES8311_REG0D_SYSTEM, 0x01));
|
40
|
+
// Enable analog PGA, enable ADC modulator
|
41
|
+
ES8311_ERROR_FAILED(this->write_byte(ES8311_REG0E_SYSTEM, 0x02));
|
42
|
+
// Power up DAC
|
43
|
+
ES8311_ERROR_FAILED(this->write_byte(ES8311_REG12_SYSTEM, 0x00));
|
44
|
+
// Enable output to HP drive
|
45
|
+
ES8311_ERROR_FAILED(this->write_byte(ES8311_REG13_SYSTEM, 0x10));
|
46
|
+
// ADC Equalizer bypass, cancel DC offset in digital domain
|
47
|
+
ES8311_ERROR_FAILED(this->write_byte(ES8311_REG1C_ADC, 0x6A));
|
48
|
+
// Bypass DAC equalizer
|
49
|
+
ES8311_ERROR_FAILED(this->write_byte(ES8311_REG37_DAC, 0x08));
|
50
|
+
// Power On
|
51
|
+
ES8311_ERROR_FAILED(this->write_byte(ES8311_REG00_RESET, 0x80));
|
52
|
+
}
|
53
|
+
|
54
|
+
void ES8311::dump_config() {
|
55
|
+
ESP_LOGCONFIG(TAG, "ES8311 Audio Codec:");
|
56
|
+
ESP_LOGCONFIG(TAG, " Use MCLK: %s", YESNO(this->use_mclk_));
|
57
|
+
ESP_LOGCONFIG(TAG, " Use Microphone: %s", YESNO(this->use_mic_));
|
58
|
+
ESP_LOGCONFIG(TAG, " DAC Bits per Sample: %" PRIu8, this->resolution_out_);
|
59
|
+
ESP_LOGCONFIG(TAG, " Sample Rate: %" PRIu32, this->sample_frequency_);
|
60
|
+
|
61
|
+
if (this->is_failed()) {
|
62
|
+
ESP_LOGCONFIG(TAG, " Failed to initialize!");
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
bool ES8311::set_volume(float volume) {
|
68
|
+
volume = clamp(volume, 0.0f, 1.0f);
|
69
|
+
uint8_t reg32 = remap<uint8_t, float>(volume, 0.0f, 1.0f, 0, 255);
|
70
|
+
return this->write_byte(ES8311_REG32_DAC, reg32);
|
71
|
+
}
|
72
|
+
|
73
|
+
float ES8311::volume() {
|
74
|
+
uint8_t reg32;
|
75
|
+
this->read_byte(ES8311_REG32_DAC, ®32);
|
76
|
+
return remap<float, uint8_t>(reg32, 0, 255, 0.0f, 1.0f);
|
77
|
+
}
|
78
|
+
|
79
|
+
uint8_t ES8311::calculate_resolution_value(ES8311Resolution resolution) {
|
80
|
+
switch (resolution) {
|
81
|
+
case ES8311_RESOLUTION_16:
|
82
|
+
return (3 << 2);
|
83
|
+
case ES8311_RESOLUTION_18:
|
84
|
+
return (2 << 2);
|
85
|
+
case ES8311_RESOLUTION_20:
|
86
|
+
return (1 << 2);
|
87
|
+
case ES8311_RESOLUTION_24:
|
88
|
+
return (0 << 2);
|
89
|
+
case ES8311_RESOLUTION_32:
|
90
|
+
return (4 << 2);
|
91
|
+
default:
|
92
|
+
return 0;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
const ES8311Coefficient *ES8311::get_coefficient(uint32_t mclk, uint32_t rate) {
|
97
|
+
for (const auto &coefficient : ES8311_COEFFICIENTS) {
|
98
|
+
if (coefficient.mclk == mclk && coefficient.rate == rate)
|
99
|
+
return &coefficient;
|
100
|
+
}
|
101
|
+
return nullptr;
|
102
|
+
}
|
103
|
+
|
104
|
+
bool ES8311::configure_clock_() {
|
105
|
+
// Register 0x01: select clock source for internal MCLK and determine its frequency
|
106
|
+
uint8_t reg01 = 0x3F; // Enable all clocks
|
107
|
+
|
108
|
+
uint32_t mclk_frequency = this->sample_frequency_ * this->mclk_multiple_;
|
109
|
+
if (!this->use_mclk_) {
|
110
|
+
reg01 |= BIT(7); // Use SCLK
|
111
|
+
mclk_frequency = this->sample_frequency_ * (int) this->resolution_out_ * 2;
|
112
|
+
}
|
113
|
+
if (this->mclk_inverted_) {
|
114
|
+
reg01 |= BIT(6); // Invert MCLK pin
|
115
|
+
}
|
116
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG01_CLK_MANAGER, reg01));
|
117
|
+
|
118
|
+
// Get clock coefficients from coefficient table
|
119
|
+
auto *coefficient = get_coefficient(mclk_frequency, this->sample_frequency_);
|
120
|
+
if (coefficient == nullptr) {
|
121
|
+
ESP_LOGE(TAG, "Unable to configure sample rate %" PRIu32 "Hz with %" PRIu32 "Hz MCLK", this->sample_frequency_,
|
122
|
+
mclk_frequency);
|
123
|
+
return false;
|
124
|
+
}
|
125
|
+
|
126
|
+
// Register 0x02
|
127
|
+
uint8_t reg02;
|
128
|
+
ES8311_ERROR_CHECK(this->read_byte(ES8311_REG02_CLK_MANAGER, ®02));
|
129
|
+
reg02 &= 0x07;
|
130
|
+
reg02 |= (coefficient->pre_div - 1) << 5;
|
131
|
+
reg02 |= coefficient->pre_mult << 3;
|
132
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG02_CLK_MANAGER, reg02));
|
133
|
+
|
134
|
+
// Register 0x03
|
135
|
+
const uint8_t reg03 = (coefficient->fs_mode << 6) | coefficient->adc_osr;
|
136
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG03_CLK_MANAGER, reg03));
|
137
|
+
|
138
|
+
// Register 0x04
|
139
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG04_CLK_MANAGER, coefficient->dac_osr));
|
140
|
+
|
141
|
+
// Register 0x05
|
142
|
+
const uint8_t reg05 = ((coefficient->adc_div - 1) << 4) | (coefficient->dac_div - 1);
|
143
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG05_CLK_MANAGER, reg05));
|
144
|
+
|
145
|
+
// Register 0x06
|
146
|
+
uint8_t reg06;
|
147
|
+
ES8311_ERROR_CHECK(this->read_byte(ES8311_REG06_CLK_MANAGER, ®06));
|
148
|
+
if (this->sclk_inverted_) {
|
149
|
+
reg06 |= BIT(5);
|
150
|
+
} else {
|
151
|
+
reg06 &= ~BIT(5);
|
152
|
+
}
|
153
|
+
reg06 &= 0xE0;
|
154
|
+
if (coefficient->bclk_div < 19) {
|
155
|
+
reg06 |= (coefficient->bclk_div - 1) << 0;
|
156
|
+
} else {
|
157
|
+
reg06 |= (coefficient->bclk_div) << 0;
|
158
|
+
}
|
159
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG06_CLK_MANAGER, reg06));
|
160
|
+
|
161
|
+
// Register 0x07
|
162
|
+
uint8_t reg07;
|
163
|
+
ES8311_ERROR_CHECK(this->read_byte(ES8311_REG07_CLK_MANAGER, ®07));
|
164
|
+
reg07 &= 0xC0;
|
165
|
+
reg07 |= coefficient->lrck_h << 0;
|
166
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG07_CLK_MANAGER, reg07));
|
167
|
+
|
168
|
+
// Register 0x08
|
169
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG08_CLK_MANAGER, coefficient->lrck_l));
|
170
|
+
|
171
|
+
// Successfully configured the clock
|
172
|
+
return true;
|
173
|
+
}
|
174
|
+
|
175
|
+
bool ES8311::configure_format_() {
|
176
|
+
// Configure I2S mode and format
|
177
|
+
uint8_t reg00;
|
178
|
+
ES8311_ERROR_CHECK(this->read_byte(ES8311_REG00_RESET, ®00));
|
179
|
+
reg00 &= 0xBF;
|
180
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG00_RESET, reg00));
|
181
|
+
|
182
|
+
// Configure SDP in resolution
|
183
|
+
uint8_t reg09 = calculate_resolution_value(this->resolution_in_);
|
184
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG09_SDPIN, reg09));
|
185
|
+
|
186
|
+
// Configure SDP out resolution
|
187
|
+
uint8_t reg0a = calculate_resolution_value(this->resolution_out_);
|
188
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG0A_SDPOUT, reg0a));
|
189
|
+
|
190
|
+
// Successfully configured the format
|
191
|
+
return true;
|
192
|
+
}
|
193
|
+
|
194
|
+
bool ES8311::configure_mic_() {
|
195
|
+
uint8_t reg14 = 0x1A; // Enable analog MIC and max PGA gain
|
196
|
+
if (this->use_mic_) {
|
197
|
+
reg14 |= BIT(6); // Enable PDM digital microphone
|
198
|
+
}
|
199
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG14_SYSTEM, reg14));
|
200
|
+
|
201
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG16_ADC, this->mic_gain_)); // ADC gain scale up
|
202
|
+
ES8311_ERROR_CHECK(this->write_byte(ES8311_REG17_ADC, 0xC8)); // Set ADC gain
|
203
|
+
|
204
|
+
// Successfully configured the microphones
|
205
|
+
return true;
|
206
|
+
}
|
207
|
+
|
208
|
+
bool ES8311::set_mute_state_(bool mute_state) {
|
209
|
+
uint8_t reg31;
|
210
|
+
|
211
|
+
this->is_muted_ = mute_state;
|
212
|
+
|
213
|
+
if (!this->read_byte(ES8311_REG31_DAC, ®31)) {
|
214
|
+
return false;
|
215
|
+
}
|
216
|
+
|
217
|
+
if (mute_state) {
|
218
|
+
reg31 |= BIT(6) | BIT(5);
|
219
|
+
} else {
|
220
|
+
reg31 &= ~(BIT(6) | BIT(5));
|
221
|
+
}
|
222
|
+
|
223
|
+
return this->write_byte(ES8311_REG31_DAC, reg31);
|
224
|
+
}
|
225
|
+
|
226
|
+
} // namespace es8311
|
227
|
+
} // namespace esphome
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/components/audio_dac/audio_dac.h"
|
4
|
+
#include "esphome/components/i2c/i2c.h"
|
5
|
+
#include "esphome/core/component.h"
|
6
|
+
|
7
|
+
namespace esphome {
|
8
|
+
namespace es8311 {
|
9
|
+
|
10
|
+
enum ES8311MicGain {
|
11
|
+
ES8311_MIC_GAIN_MIN = -1,
|
12
|
+
ES8311_MIC_GAIN_0DB,
|
13
|
+
ES8311_MIC_GAIN_6DB,
|
14
|
+
ES8311_MIC_GAIN_12DB,
|
15
|
+
ES8311_MIC_GAIN_18DB,
|
16
|
+
ES8311_MIC_GAIN_24DB,
|
17
|
+
ES8311_MIC_GAIN_30DB,
|
18
|
+
ES8311_MIC_GAIN_36DB,
|
19
|
+
ES8311_MIC_GAIN_42DB,
|
20
|
+
ES8311_MIC_GAIN_MAX
|
21
|
+
};
|
22
|
+
|
23
|
+
enum ES8311Resolution : uint8_t {
|
24
|
+
ES8311_RESOLUTION_16 = 16,
|
25
|
+
ES8311_RESOLUTION_18 = 18,
|
26
|
+
ES8311_RESOLUTION_20 = 20,
|
27
|
+
ES8311_RESOLUTION_24 = 24,
|
28
|
+
ES8311_RESOLUTION_32 = 32
|
29
|
+
};
|
30
|
+
|
31
|
+
struct ES8311Coefficient {
|
32
|
+
uint32_t mclk; // mclk frequency
|
33
|
+
uint32_t rate; // sample rate
|
34
|
+
uint8_t pre_div; // the pre divider with range from 1 to 8
|
35
|
+
uint8_t pre_mult; // the pre multiplier with x1, x2, x4 and x8 selection
|
36
|
+
uint8_t adc_div; // adcclk divider
|
37
|
+
uint8_t dac_div; // dacclk divider
|
38
|
+
uint8_t fs_mode; // single speed (0) or double speed (1)
|
39
|
+
uint8_t lrck_h; // adc lrck divider and dac lrck divider
|
40
|
+
uint8_t lrck_l; //
|
41
|
+
uint8_t bclk_div; // sclk divider
|
42
|
+
uint8_t adc_osr; // adc osr
|
43
|
+
uint8_t dac_osr; // dac osr
|
44
|
+
};
|
45
|
+
|
46
|
+
class ES8311 : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
|
47
|
+
public:
|
48
|
+
/////////////////////////
|
49
|
+
// Component overrides //
|
50
|
+
/////////////////////////
|
51
|
+
|
52
|
+
void setup() override;
|
53
|
+
float get_setup_priority() const override { return setup_priority::DATA; }
|
54
|
+
void dump_config() override;
|
55
|
+
|
56
|
+
////////////////////////
|
57
|
+
// AudioDac overrides //
|
58
|
+
////////////////////////
|
59
|
+
|
60
|
+
/// @brief Writes the volume out to the DAC
|
61
|
+
/// @param volume floating point between 0.0 and 1.0
|
62
|
+
/// @return True if successful and false otherwise
|
63
|
+
bool set_volume(float volume) override;
|
64
|
+
|
65
|
+
/// @brief Gets the current volume out from the DAC
|
66
|
+
/// @return floating point between 0.0 and 1.0
|
67
|
+
float volume() override;
|
68
|
+
|
69
|
+
/// @brief Disables mute for audio out
|
70
|
+
/// @return True if successful and false otherwise
|
71
|
+
bool set_mute_off() override { return this->set_mute_state_(false); }
|
72
|
+
|
73
|
+
/// @brief Enables mute for audio out
|
74
|
+
/// @return True if successful and false otherwise
|
75
|
+
bool set_mute_on() override { return this->set_mute_state_(true); }
|
76
|
+
|
77
|
+
bool is_muted() override { return this->is_muted_; }
|
78
|
+
|
79
|
+
//////////////////////////////////
|
80
|
+
// ES8311 configuration setters //
|
81
|
+
//////////////////////////////////
|
82
|
+
|
83
|
+
void set_use_mclk(bool use_mclk) { this->use_mclk_ = use_mclk; }
|
84
|
+
void set_bits_per_sample(ES8311Resolution resolution) {
|
85
|
+
this->resolution_in_ = resolution;
|
86
|
+
this->resolution_out_ = resolution;
|
87
|
+
}
|
88
|
+
void set_sample_frequency(uint32_t sample_frequency) { this->sample_frequency_ = sample_frequency; }
|
89
|
+
void set_use_mic(bool use_mic) { this->use_mic_ = use_mic; }
|
90
|
+
void set_mic_gain(ES8311MicGain mic_gain) { this->mic_gain_ = mic_gain; }
|
91
|
+
|
92
|
+
protected:
|
93
|
+
/// @brief Computes the register value for the configured resolution (bits per sample)
|
94
|
+
/// @param resolution bits per sample enum for both audio in and audio out
|
95
|
+
/// @return register value
|
96
|
+
static uint8_t calculate_resolution_value(ES8311Resolution resolution);
|
97
|
+
|
98
|
+
/// @brief Retrieves the appropriate registers values for the configured mclk and rate
|
99
|
+
/// @param mclk mlck frequency in Hz
|
100
|
+
/// @param rate sample rate frequency in Hz
|
101
|
+
/// @return ES8311Coeffecient containing appropriate register values to configure the ES8311 or nullptr if impossible
|
102
|
+
static const ES8311Coefficient *get_coefficient(uint32_t mclk, uint32_t rate);
|
103
|
+
|
104
|
+
/// @brief Configures the ES8311 registers for the chosen sample rate
|
105
|
+
/// @return True if successful and false otherwise
|
106
|
+
bool configure_clock_();
|
107
|
+
|
108
|
+
/// @brief Configures the ES8311 registers for the chosen bits per sample
|
109
|
+
/// @return True if successful and false otherwise
|
110
|
+
bool configure_format_();
|
111
|
+
|
112
|
+
/// @brief Configures the ES8311 microphone registers
|
113
|
+
/// @return True if successful and false otherwise
|
114
|
+
bool configure_mic_();
|
115
|
+
|
116
|
+
/// @brief Mutes or unmute the DAC audio out
|
117
|
+
/// @param mute_state True to mute, false to unmute
|
118
|
+
/// @return
|
119
|
+
bool set_mute_state_(bool mute_state);
|
120
|
+
|
121
|
+
bool use_mic_;
|
122
|
+
ES8311MicGain mic_gain_;
|
123
|
+
|
124
|
+
bool use_mclk_; // true = use dedicated MCLK pin, false = use SCLK
|
125
|
+
bool sclk_inverted_{false}; // SCLK is inverted
|
126
|
+
bool mclk_inverted_{false}; // MCLK is inverted (ignored if use_mclk_ == false)
|
127
|
+
uint32_t mclk_multiple_{256}; // MCLK frequency is sample rate * mclk_multiple_ (ignored if use_mclk_ == false)
|
128
|
+
|
129
|
+
uint32_t sample_frequency_; // in Hz
|
130
|
+
ES8311Resolution resolution_in_;
|
131
|
+
ES8311Resolution resolution_out_;
|
132
|
+
};
|
133
|
+
|
134
|
+
} // namespace es8311
|
135
|
+
} // namespace esphome
|
@@ -0,0 +1,195 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "es8311.h"
|
4
|
+
|
5
|
+
namespace esphome {
|
6
|
+
namespace es8311 {
|
7
|
+
|
8
|
+
// ES8311 register addresses
|
9
|
+
static const uint8_t ES8311_REG00_RESET = 0x00; // Reset
|
10
|
+
static const uint8_t ES8311_REG01_CLK_MANAGER = 0x01; // Clock Manager: select clk src for mclk, enable clock for codec
|
11
|
+
static const uint8_t ES8311_REG02_CLK_MANAGER = 0x02; // Clock Manager: clk divider and clk multiplier
|
12
|
+
static const uint8_t ES8311_REG03_CLK_MANAGER = 0x03; // Clock Manager: adc fsmode and osr
|
13
|
+
static const uint8_t ES8311_REG04_CLK_MANAGER = 0x04; // Clock Manager: dac osr
|
14
|
+
static const uint8_t ES8311_REG05_CLK_MANAGER = 0x05; // Clock Manager: clk divider for adc and dac
|
15
|
+
static const uint8_t ES8311_REG06_CLK_MANAGER = 0x06; // Clock Manager: bclk inverter BIT(5) and divider
|
16
|
+
static const uint8_t ES8311_REG07_CLK_MANAGER = 0x07; // Clock Manager: tri-state, lrck divider
|
17
|
+
static const uint8_t ES8311_REG08_CLK_MANAGER = 0x08; // Clock Manager: lrck divider
|
18
|
+
static const uint8_t ES8311_REG09_SDPIN = 0x09; // Serial Digital Port: DAC
|
19
|
+
static const uint8_t ES8311_REG0A_SDPOUT = 0x0A; // Serial Digital Port: ADC
|
20
|
+
static const uint8_t ES8311_REG0B_SYSTEM = 0x0B; // System
|
21
|
+
static const uint8_t ES8311_REG0C_SYSTEM = 0x0C; // System
|
22
|
+
static const uint8_t ES8311_REG0D_SYSTEM = 0x0D; // System: power up/down
|
23
|
+
static const uint8_t ES8311_REG0E_SYSTEM = 0x0E; // System: power up/down
|
24
|
+
static const uint8_t ES8311_REG0F_SYSTEM = 0x0F; // System: low power
|
25
|
+
static const uint8_t ES8311_REG10_SYSTEM = 0x10; // System
|
26
|
+
static const uint8_t ES8311_REG11_SYSTEM = 0x11; // System
|
27
|
+
static const uint8_t ES8311_REG12_SYSTEM = 0x12; // System: Enable DAC
|
28
|
+
static const uint8_t ES8311_REG13_SYSTEM = 0x13; // System
|
29
|
+
static const uint8_t ES8311_REG14_SYSTEM = 0x14; // System: select DMIC, select analog pga gain
|
30
|
+
static const uint8_t ES8311_REG15_ADC = 0x15; // ADC: adc ramp rate, dmic sense
|
31
|
+
static const uint8_t ES8311_REG16_ADC = 0x16; // ADC
|
32
|
+
static const uint8_t ES8311_REG17_ADC = 0x17; // ADC: volume
|
33
|
+
static const uint8_t ES8311_REG18_ADC = 0x18; // ADC: alc enable and winsize
|
34
|
+
static const uint8_t ES8311_REG19_ADC = 0x19; // ADC: alc maxlevel
|
35
|
+
static const uint8_t ES8311_REG1A_ADC = 0x1A; // ADC: alc automute
|
36
|
+
static const uint8_t ES8311_REG1B_ADC = 0x1B; // ADC: alc automute, adc hpf s1
|
37
|
+
static const uint8_t ES8311_REG1C_ADC = 0x1C; // ADC: equalizer, hpf s2
|
38
|
+
static const uint8_t ES8311_REG1D_ADCEQ = 0x1D; // ADCEQ: equalizer B0
|
39
|
+
static const uint8_t ES8311_REG1E_ADCEQ = 0x1E; // ADCEQ: equalizer B0
|
40
|
+
static const uint8_t ES8311_REG1F_ADCEQ = 0x1F; // ADCEQ: equalizer B0
|
41
|
+
static const uint8_t ES8311_REG20_ADCEQ = 0x20; // ADCEQ: equalizer B0
|
42
|
+
static const uint8_t ES8311_REG21_ADCEQ = 0x21; // ADCEQ: equalizer A1
|
43
|
+
static const uint8_t ES8311_REG22_ADCEQ = 0x22; // ADCEQ: equalizer A1
|
44
|
+
static const uint8_t ES8311_REG23_ADCEQ = 0x23; // ADCEQ: equalizer A1
|
45
|
+
static const uint8_t ES8311_REG24_ADCEQ = 0x24; // ADCEQ: equalizer A1
|
46
|
+
static const uint8_t ES8311_REG25_ADCEQ = 0x25; // ADCEQ: equalizer A2
|
47
|
+
static const uint8_t ES8311_REG26_ADCEQ = 0x26; // ADCEQ: equalizer A2
|
48
|
+
static const uint8_t ES8311_REG27_ADCEQ = 0x27; // ADCEQ: equalizer A2
|
49
|
+
static const uint8_t ES8311_REG28_ADCEQ = 0x28; // ADCEQ: equalizer A2
|
50
|
+
static const uint8_t ES8311_REG29_ADCEQ = 0x29; // ADCEQ: equalizer B1
|
51
|
+
static const uint8_t ES8311_REG2A_ADCEQ = 0x2A; // ADCEQ: equalizer B1
|
52
|
+
static const uint8_t ES8311_REG2B_ADCEQ = 0x2B; // ADCEQ: equalizer B1
|
53
|
+
static const uint8_t ES8311_REG2C_ADCEQ = 0x2C; // ADCEQ: equalizer B1
|
54
|
+
static const uint8_t ES8311_REG2D_ADCEQ = 0x2D; // ADCEQ: equalizer B2
|
55
|
+
static const uint8_t ES8311_REG2E_ADCEQ = 0x2E; // ADCEQ: equalizer B2
|
56
|
+
static const uint8_t ES8311_REG2F_ADCEQ = 0x2F; // ADCEQ: equalizer B2
|
57
|
+
static const uint8_t ES8311_REG30_ADCEQ = 0x30; // ADCEQ: equalizer B2
|
58
|
+
static const uint8_t ES8311_REG31_DAC = 0x31; // DAC: mute
|
59
|
+
static const uint8_t ES8311_REG32_DAC = 0x32; // DAC: volume
|
60
|
+
static const uint8_t ES8311_REG33_DAC = 0x33; // DAC: offset
|
61
|
+
static const uint8_t ES8311_REG34_DAC = 0x34; // DAC: drc enable, drc winsize
|
62
|
+
static const uint8_t ES8311_REG35_DAC = 0x35; // DAC: drc maxlevel, minilevel
|
63
|
+
static const uint8_t ES8311_REG36_DAC = 0x36; // DAC
|
64
|
+
static const uint8_t ES8311_REG37_DAC = 0x37; // DAC: ramprate
|
65
|
+
static const uint8_t ES8311_REG38_DACEQ = 0x38; // DACEQ: equalizer B0
|
66
|
+
static const uint8_t ES8311_REG39_DACEQ = 0x39; // DACEQ: equalizer B0
|
67
|
+
static const uint8_t ES8311_REG3A_DACEQ = 0x3A; // DACEQ: equalizer B0
|
68
|
+
static const uint8_t ES8311_REG3B_DACEQ = 0x3B; // DACEQ: equalizer B0
|
69
|
+
static const uint8_t ES8311_REG3C_DACEQ = 0x3C; // DACEQ: equalizer B1
|
70
|
+
static const uint8_t ES8311_REG3D_DACEQ = 0x3D; // DACEQ: equalizer B1
|
71
|
+
static const uint8_t ES8311_REG3E_DACEQ = 0x3E; // DACEQ: equalizer B1
|
72
|
+
static const uint8_t ES8311_REG3F_DACEQ = 0x3F; // DACEQ: equalizer B1
|
73
|
+
static const uint8_t ES8311_REG40_DACEQ = 0x40; // DACEQ: equalizer A1
|
74
|
+
static const uint8_t ES8311_REG41_DACEQ = 0x41; // DACEQ: equalizer A1
|
75
|
+
static const uint8_t ES8311_REG42_DACEQ = 0x42; // DACEQ: equalizer A1
|
76
|
+
static const uint8_t ES8311_REG43_DACEQ = 0x43; // DACEQ: equalizer A1
|
77
|
+
static const uint8_t ES8311_REG44_GPIO = 0x44; // GPIO: dac2adc for test
|
78
|
+
static const uint8_t ES8311_REG45_GP = 0x45; // GPIO: GP control
|
79
|
+
static const uint8_t ES8311_REGFA_I2C = 0xFA; // I2C: reset registers
|
80
|
+
static const uint8_t ES8311_REGFC_FLAG = 0xFC; // Flag
|
81
|
+
static const uint8_t ES8311_REGFD_CHD1 = 0xFD; // Chip: ID1
|
82
|
+
static const uint8_t ES8311_REGFE_CHD2 = 0xFE; // Chip: ID2
|
83
|
+
static const uint8_t ES8311_REGFF_CHVER = 0xFF; // Chip: Version
|
84
|
+
|
85
|
+
// ES8311 clock divider coefficients
|
86
|
+
static const ES8311Coefficient ES8311_COEFFICIENTS[] = {
|
87
|
+
// clang-format off
|
88
|
+
|
89
|
+
// mclk, rate, pre_ pre_ adc_ dac_ fs_ lrck lrck bclk_ adc_ dac_
|
90
|
+
// div, mult, div, div, mode, _h, _l, div, osr, osr
|
91
|
+
|
92
|
+
// 8k
|
93
|
+
{12288000, 8000, 0x06, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
94
|
+
{18432000, 8000, 0x03, 0x02, 0x03, 0x03, 0x00, 0x05, 0xff, 0x18, 0x10, 0x20},
|
95
|
+
{16384000, 8000, 0x08, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
96
|
+
{ 8192000, 8000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
97
|
+
{ 6144000, 8000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
98
|
+
{ 4096000, 8000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
99
|
+
{ 3072000, 8000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
100
|
+
{ 2048000, 8000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
101
|
+
{ 1536000, 8000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
102
|
+
{ 1024000, 8000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
103
|
+
|
104
|
+
// 11.025k
|
105
|
+
{11289600, 11025, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
106
|
+
{ 5644800, 11025, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
107
|
+
{ 2822400, 11025, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
108
|
+
{ 1411200, 11025, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
109
|
+
|
110
|
+
// 12k
|
111
|
+
{12288000, 12000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
112
|
+
{ 6144000, 12000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
113
|
+
{ 3072000, 12000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
114
|
+
{ 1536000, 12000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
115
|
+
|
116
|
+
// 16k
|
117
|
+
{12288000, 16000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
118
|
+
{18432000, 16000, 0x03, 0x02, 0x03, 0x03, 0x00, 0x02, 0xff, 0x0c, 0x10, 0x20},
|
119
|
+
{16384000, 16000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
120
|
+
{ 8192000, 16000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
121
|
+
{ 6144000, 16000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
122
|
+
{ 4096000, 16000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
123
|
+
{ 3072000, 16000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
124
|
+
{ 2048000, 16000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
125
|
+
{ 1536000, 16000, 0x03, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
126
|
+
{ 1024000, 16000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20},
|
127
|
+
|
128
|
+
// 22.05k
|
129
|
+
{11289600, 22050, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
130
|
+
{ 5644800, 22050, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
131
|
+
{ 2822400, 22050, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
132
|
+
{ 1411200, 22050, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
133
|
+
|
134
|
+
// 24k
|
135
|
+
{12288000, 24000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
136
|
+
{18432000, 24000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
137
|
+
{ 6144000, 24000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
138
|
+
{ 3072000, 24000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
139
|
+
{ 1536000, 24000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
140
|
+
|
141
|
+
// 32k
|
142
|
+
{12288000, 32000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
143
|
+
{18432000, 32000, 0x03, 0x04, 0x03, 0x03, 0x00, 0x02, 0xff, 0x0c, 0x10, 0x10},
|
144
|
+
{16384000, 32000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
145
|
+
{ 8192000, 32000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
146
|
+
{ 6144000, 32000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
147
|
+
{ 4096000, 32000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
148
|
+
{ 3072000, 32000, 0x03, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
149
|
+
{ 2048000, 32000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
150
|
+
{ 1536000, 32000, 0x03, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, 0x10},
|
151
|
+
{ 1024000, 32000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
152
|
+
|
153
|
+
// 44.1k
|
154
|
+
{11289600, 44100, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
155
|
+
{ 5644800, 44100, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
156
|
+
{ 2822400, 44100, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
157
|
+
{ 1411200, 44100, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
158
|
+
|
159
|
+
// 48k
|
160
|
+
{12288000, 48000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
161
|
+
{18432000, 48000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
162
|
+
{ 6144000, 48000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
163
|
+
{ 3072000, 48000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
164
|
+
{ 1536000, 48000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
165
|
+
|
166
|
+
// 64k
|
167
|
+
{12288000, 64000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
168
|
+
{18432000, 64000, 0x03, 0x04, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, 0x10},
|
169
|
+
{16384000, 64000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
170
|
+
{ 8192000, 64000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
171
|
+
{ 6144000, 64000, 0x01, 0x04, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, 0x10},
|
172
|
+
{ 4096000, 64000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
173
|
+
{ 3072000, 64000, 0x01, 0x08, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, 0x10},
|
174
|
+
{ 2048000, 64000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
175
|
+
{ 1536000, 64000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0xbf, 0x03, 0x18, 0x18},
|
176
|
+
{ 1024000, 64000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, 0x10},
|
177
|
+
|
178
|
+
// 88.2k
|
179
|
+
{11289600, 88200, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
180
|
+
{ 5644800, 88200, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
181
|
+
{ 2822400, 88200, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
182
|
+
{ 1411200, 88200, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, 0x10},
|
183
|
+
|
184
|
+
// 96k
|
185
|
+
{12288000, 96000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
186
|
+
{18432000, 96000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
187
|
+
{ 6144000, 96000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
188
|
+
{ 3072000, 96000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x10},
|
189
|
+
{ 1536000, 96000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, 0x10},
|
190
|
+
|
191
|
+
// clang-format on
|
192
|
+
};
|
193
|
+
|
194
|
+
} // namespace es8311
|
195
|
+
} // namespace esphome
|