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:
J. Nick Koston
2026-04-04 10:22:19 -10:00
parent aeb8e9413b
commit af87f21e68
5 changed files with 0 additions and 25 deletions
-5
View File
@@ -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_();
}
-6
View File
@@ -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_();
}
-5
View File
@@ -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_();
}
-6
View File
@@ -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);