Remove power_pin

This commit is contained in:
Jesse Hills 2022-06-14 10:34:59 +12:00
parent f73435f820
commit 7efb138933
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
2 changed files with 1 additions and 16 deletions

View file

@ -3,20 +3,13 @@ import esphome.config_validation as cv
from esphome.components import i2c
from esphome.const import CONF_ID
from esphome import pins
es8388_ns = cg.esphome_ns.namespace("es8388")
ES8388Component = es8388_ns.class_("ES8388Component", cg.Component, i2c.I2CDevice)
CONF_POWER_PIN = "power_pin"
CONFIG_SCHEMA = (
cv.Schema(
{
cv.GenerateID(): cv.declare_id(ES8388Component),
cv.Required(CONF_POWER_PIN): pins.gpio_output_pin_schema,
}
)
cv.Schema({cv.GenerateID(): cv.declare_id(ES8388Component)})
.extend(i2c.i2c_device_schema(0x10))
.extend(cv.COMPONENT_SCHEMA)
)
@ -26,5 +19,3 @@ async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(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))

View file

@ -4,9 +4,6 @@ namespace esphome {
namespace es8388 {
void ES8388Component::setup() {
this->power_pin_->setup();
this->power_pin_->digital_write(false);
// reset
this->write_bytes(0x00, {0x80});
this->write_bytes(0x00, {0x00});
@ -47,9 +44,6 @@ void ES8388Component::setup() {
this->write_bytes(0x04, {0x30});
// unmute
this->write_bytes(0x19, {0x00});
// Turn on amplifier
this->power_pin_->digital_write(true);
}
} // namespace es8388
} // namespace esphome