ESPHome
2026.5.1
Loading...
Searching...
No Matches
esphome
components
es8388
es8388.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <map>
4
5
#include "
esphome/components/audio_dac/audio_dac.h
"
6
#include "
esphome/components/i2c/i2c.h
"
7
#include "
esphome/core/component.h
"
8
#ifdef USE_SELECT
9
#include "
esphome/components/select/select.h
"
10
#endif
11
12
#include "
es8388_const.h
"
13
14
namespace
esphome::es8388
{
15
16
enum
DacOutputLine
: uint8_t {
17
DAC_OUTPUT_LINE1
,
18
DAC_OUTPUT_LINE2
,
19
DAC_OUTPUT_BOTH
,
20
};
21
22
enum
AdcInputMicLine
: uint8_t {
23
ADC_INPUT_MIC_LINE1
,
24
ADC_INPUT_MIC_LINE2
,
25
ADC_INPUT_MIC_DIFFERENCE
,
26
};
27
28
class
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
audio_dac.h
esphome::Component
Definition
component.h:145
esphome::Component::setup
virtual void setup()
Where the component's initialization should happen.
Definition
component.cpp:89
esphome::audio_dac::AudioDac
Definition
audio_dac.h:8
esphome::audio_dac::AudioDac::is_muted_
bool is_muted_
Definition
audio_dac.h:18
esphome::es8388::ES8388
Definition
es8388.h:28
esphome::es8388::ES8388::set_mute_state_
bool set_mute_state_(bool mute_state)
Mutes or unmutes the DAC audio out.
Definition
es8388.cpp:168
esphome::i2c::I2CDevice
This Class provides the methods to read/write bytes from/to an i2c device.
Definition
i2c.h:132
component.h
es8388_const.h
i2c.h
esphome::es8388
Definition
es8388.cpp:7
esphome::es8388::DacOutputLine
DacOutputLine
Definition
es8388.h:16
esphome::es8388::DAC_OUTPUT_LINE1
@ DAC_OUTPUT_LINE1
Definition
es8388.h:17
esphome::es8388::DAC_OUTPUT_BOTH
@ DAC_OUTPUT_BOTH
Definition
es8388.h:19
esphome::es8388::DAC_OUTPUT_LINE2
@ DAC_OUTPUT_LINE2
Definition
es8388.h:18
esphome::es8388::AdcInputMicLine
AdcInputMicLine
Definition
es8388.h:22
esphome::es8388::ADC_INPUT_MIC_LINE1
@ ADC_INPUT_MIC_LINE1
Definition
es8388.h:23
esphome::es8388::ADC_INPUT_MIC_DIFFERENCE
@ ADC_INPUT_MIC_DIFFERENCE
Definition
es8388.h:25
esphome::es8388::ADC_INPUT_MIC_LINE2
@ ADC_INPUT_MIC_LINE2
Definition
es8388.h:24
esphome::line
const char int line
Definition
log.h:74
select.h
Generated by
1.12.0