ESPHome 2026.5.1
Loading...
Searching...
No Matches
es8388.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4
8#ifdef USE_SELECT
10#endif
11
12#include "es8388_const.h"
13
14namespace esphome::es8388 {
15
21
27
28class ES8388 : public audio_dac::AudioDac, public Component, public i2c::I2CDevice {
29#ifdef USE_SELECT
30 SUB_SELECT(dac_output)
31 SUB_SELECT(adc_input_mic)
32#endif
33
34 public:
36 // Component overrides //
38
39 void setup() override;
40 void dump_config() override;
41
43 // AudioDac overrides //
45
49 bool set_volume(float volume) override;
50
53 float volume() override;
54
57 bool set_mute_off() override { return this->set_mute_state_(false); }
58
61 bool set_mute_on() override { return this->set_mute_state_(true); }
62
63 bool is_muted() override { return this->is_muted_; }
64
65 optional<DacOutputLine> get_dac_power();
66 optional<AdcInputMicLine> get_mic_input();
67
68 bool set_dac_output(DacOutputLine line);
69 bool set_adc_input_mic(AdcInputMicLine line);
70
71 protected:
75 bool set_mute_state_(bool mute_state);
76};
77
78} // namespace esphome::es8388
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:89
bool set_mute_state_(bool mute_state)
Mutes or unmutes the DAC audio out.
Definition es8388.cpp:168
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
@ ADC_INPUT_MIC_LINE1
Definition es8388.h:23
@ ADC_INPUT_MIC_DIFFERENCE
Definition es8388.h:25
@ ADC_INPUT_MIC_LINE2
Definition es8388.h:24
const char int line
Definition log.h:74