mirror of
https://github.com/esphome/esphome.git
synced 2026-06-01 01:19:45 +08:00
Remove unnecessary latched interrupt clearing during setup
A latched interrupt at boot is harmless - the ISR fires immediately, loop runs, cache invalidates, and a normal read cycle clears it. The extra register reads added unnecessary complexity.
This commit is contained in:
@@ -23,11 +23,6 @@ void MCP23008::setup() {
|
||||
this->write_reg(mcp23x08_base::MCP23X08_IOCON, iocon | IOCON_ODR);
|
||||
}
|
||||
|
||||
// Clear any latched interrupt by reading GPIO before attaching ISR
|
||||
if (this->interrupt_pin_ != nullptr) {
|
||||
uint8_t val;
|
||||
this->read_reg(mcp23x08_base::MCP23X08_GPIO, &val);
|
||||
}
|
||||
this->setup_interrupt_pin_();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,12 +33,6 @@ void MCP23017::setup() {
|
||||
this->write_reg(mcp23x17_base::MCP23X17_IOCONB, iocon | iocon_flags);
|
||||
}
|
||||
|
||||
// Clear any latched interrupt by reading GPIO before attaching ISR
|
||||
if (this->interrupt_pin_ != nullptr) {
|
||||
uint8_t val;
|
||||
this->read_reg(mcp23x17_base::MCP23X17_GPIOA, &val);
|
||||
this->read_reg(mcp23x17_base::MCP23X17_GPIOB, &val);
|
||||
}
|
||||
this->setup_interrupt_pin_();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,6 @@ void MCP23S08::setup() {
|
||||
this->write_reg(mcp23x08_base::MCP23X08_IOCON, IOCON_SEQOP | IOCON_HAEN | IOCON_ODR);
|
||||
}
|
||||
|
||||
// Clear any latched interrupt by reading GPIO before attaching ISR
|
||||
if (this->interrupt_pin_ != nullptr) {
|
||||
uint8_t val;
|
||||
this->read_reg(mcp23x08_base::MCP23X08_GPIO, &val);
|
||||
}
|
||||
this->setup_interrupt_pin_();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,12 +51,6 @@ void MCP23S17::setup() {
|
||||
this->write_reg(mcp23x17_base::MCP23X17_IOCONB, iocon_flags);
|
||||
}
|
||||
|
||||
// Clear any latched interrupt by reading GPIO before attaching ISR
|
||||
if (this->interrupt_pin_ != nullptr) {
|
||||
uint8_t val;
|
||||
this->read_reg(mcp23x17_base::MCP23X17_GPIOA, &val);
|
||||
this->read_reg(mcp23x17_base::MCP23X17_GPIOB, &val);
|
||||
}
|
||||
this->setup_interrupt_pin_();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,6 @@ void PI4IOE5V6408Component::setup() {
|
||||
}
|
||||
|
||||
if (this->interrupt_pin_ != nullptr) {
|
||||
// Clear any latched interrupt status from before boot
|
||||
uint8_t status;
|
||||
this->read_byte(PI4IOE5V6408_REGISTER_INTERRUPT_STATUS, &status);
|
||||
this->interrupt_pin_->setup();
|
||||
this->interrupt_pin_->attach_interrupt(&PI4IOE5V6408Component::gpio_intr, this, gpio::INTERRUPT_FALLING_EDGE);
|
||||
this->set_invalidate_on_read_(false);
|
||||
|
||||
Reference in New Issue
Block a user