mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Remove power_pin
This commit is contained in:
parent
f73435f820
commit
7efb138933
2 changed files with 1 additions and 16 deletions
|
@ -3,20 +3,13 @@ import esphome.config_validation as cv
|
||||||
|
|
||||||
from esphome.components import i2c
|
from esphome.components import i2c
|
||||||
from esphome.const import CONF_ID
|
from esphome.const import CONF_ID
|
||||||
from esphome import pins
|
|
||||||
|
|
||||||
es8388_ns = cg.esphome_ns.namespace("es8388")
|
es8388_ns = cg.esphome_ns.namespace("es8388")
|
||||||
ES8388Component = es8388_ns.class_("ES8388Component", cg.Component, i2c.I2CDevice)
|
ES8388Component = es8388_ns.class_("ES8388Component", cg.Component, i2c.I2CDevice)
|
||||||
|
|
||||||
CONF_POWER_PIN = "power_pin"
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = (
|
CONFIG_SCHEMA = (
|
||||||
cv.Schema(
|
cv.Schema({cv.GenerateID(): cv.declare_id(ES8388Component)})
|
||||||
{
|
|
||||||
cv.GenerateID(): cv.declare_id(ES8388Component),
|
|
||||||
cv.Required(CONF_POWER_PIN): pins.gpio_output_pin_schema,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.extend(i2c.i2c_device_schema(0x10))
|
.extend(i2c.i2c_device_schema(0x10))
|
||||||
.extend(cv.COMPONENT_SCHEMA)
|
.extend(cv.COMPONENT_SCHEMA)
|
||||||
)
|
)
|
||||||
|
@ -26,5 +19,3 @@ async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
await i2c.register_i2c_device(var, config)
|
await i2c.register_i2c_device(var, config)
|
||||||
pin = await cg.gpio_pin_expression(config[CONF_POWER_PIN])
|
|
||||||
cg.add(var.set_power_pin(pin))
|
|
||||||
|
|
|
@ -4,9 +4,6 @@ namespace esphome {
|
||||||
namespace es8388 {
|
namespace es8388 {
|
||||||
|
|
||||||
void ES8388Component::setup() {
|
void ES8388Component::setup() {
|
||||||
this->power_pin_->setup();
|
|
||||||
this->power_pin_->digital_write(false);
|
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
this->write_bytes(0x00, {0x80});
|
this->write_bytes(0x00, {0x80});
|
||||||
this->write_bytes(0x00, {0x00});
|
this->write_bytes(0x00, {0x00});
|
||||||
|
@ -47,9 +44,6 @@ void ES8388Component::setup() {
|
||||||
this->write_bytes(0x04, {0x30});
|
this->write_bytes(0x04, {0x30});
|
||||||
// unmute
|
// unmute
|
||||||
this->write_bytes(0x19, {0x00});
|
this->write_bytes(0x19, {0x00});
|
||||||
|
|
||||||
// Turn on amplifier
|
|
||||||
this->power_pin_->digital_write(true);
|
|
||||||
}
|
}
|
||||||
} // namespace es8388
|
} // namespace es8388
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
Loading…
Reference in a new issue