ESPHome
2025.9.0-dev
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
{
15
namespace
es8388 {
16
17
enum
DacOutputLine
: uint8_t {
18
DAC_OUTPUT_LINE1
,
19
DAC_OUTPUT_LINE2
,
20
DAC_OUTPUT_BOTH
,
21
};
22
23
enum
AdcInputMicLine
: uint8_t {
24
ADC_INPUT_MIC_LINE1
,
25
ADC_INPUT_MIC_LINE2
,
26
ADC_INPUT_MIC_DIFFERENCE
,
27
};
28
29
class
ES8388
:
public
audio_dac::AudioDac
,
public
Component
,
public
i2c::I2CDevice
{
30
#ifdef USE_SELECT
31
SUB_SELECT(dac_output)
32
SUB_SELECT(adc_input_mic)
33
#endif
34
35
public
:
37
// Component overrides //
39
40
void
setup
()
override
;
41
void
dump_config()
override
;
42
44
// AudioDac overrides //
46
50
bool
set_volume(
float
volume)
override
;
51
54
float
volume()
override
;
55
58
bool
set_mute_off()
override
{
return
this->
set_mute_state_
(
false
); }
59
62
bool
set_mute_on()
override
{
return
this->
set_mute_state_
(
true
); }
63
64
bool
is_muted()
override
{
return
this->
is_muted_
; }
65
66
optional<DacOutputLine>
get_dac_power();
67
optional<AdcInputMicLine>
get_mic_input();
68
69
bool
set_dac_output(
DacOutputLine
line);
70
bool
set_adc_input_mic(
AdcInputMicLine
line);
71
72
protected
:
76
bool
set_mute_state_
(
bool
mute_state);
77
};
78
79
}
// namespace es8388
80
}
// namespace esphome
audio_dac.h
esphome::Component
Definition
component.h:71
esphome::Component::setup
virtual void setup()
Where the component's initialization should happen.
Definition
component.cpp:85
esphome::audio_dac::AudioDac
Definition
audio_dac.h:9
esphome::audio_dac::AudioDac::is_muted_
bool is_muted_
Definition
audio_dac.h:19
esphome::es8388::ES8388
Definition
es8388.h:29
esphome::es8388::ES8388::set_mute_state_
bool set_mute_state_(bool mute_state)
Mutes or unmutes the DAC audio out.
Definition
es8388.cpp:171
esphome::i2c::I2CDevice
This Class provides the methods to read/write bytes from/to an i2c device.
Definition
i2c.h:133
esphome::optional
Definition
optional.h:36
component.h
es8388_const.h
i2c.h
esphome::es8388::DacOutputLine
DacOutputLine
Definition
es8388.h:17
esphome::es8388::DAC_OUTPUT_LINE1
@ DAC_OUTPUT_LINE1
Definition
es8388.h:18
esphome::es8388::DAC_OUTPUT_BOTH
@ DAC_OUTPUT_BOTH
Definition
es8388.h:20
esphome::es8388::DAC_OUTPUT_LINE2
@ DAC_OUTPUT_LINE2
Definition
es8388.h:19
esphome::es8388::AdcInputMicLine
AdcInputMicLine
Definition
es8388.h:23
esphome::es8388::ADC_INPUT_MIC_LINE1
@ ADC_INPUT_MIC_LINE1
Definition
es8388.h:24
esphome::es8388::ADC_INPUT_MIC_DIFFERENCE
@ ADC_INPUT_MIC_DIFFERENCE
Definition
es8388.h:26
esphome::es8388::ADC_INPUT_MIC_LINE2
@ ADC_INPUT_MIC_LINE2
Definition
es8388.h:25
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
select.h
Generated by
1.12.0