mirror of
https://github.com/esphome/esphome.git
synced 2026-06-01 01:19:45 +08:00
Add comments explaining why latched interrupts are not cleared at setup
This commit is contained in:
@@ -27,6 +27,9 @@ template<uint8_t N> class MCP23XXXBase : public Component, public gpio_expander:
|
||||
}
|
||||
|
||||
protected:
|
||||
// No need to clear latched interrupts before attaching the ISR — if INT is
|
||||
// already low the ISR fires immediately, loop runs, cache invalidates, and
|
||||
// the GPIO read clears the latch. One harmless extra read at most.
|
||||
void setup_interrupt_pin_() {
|
||||
if (this->interrupt_pin_ != nullptr) {
|
||||
this->interrupt_pin_->setup();
|
||||
|
||||
@@ -34,6 +34,9 @@ void PI4IOE5V6408Component::setup() {
|
||||
}
|
||||
}
|
||||
|
||||
// No need to clear latched interrupts before attaching the ISR — if INT is
|
||||
// already low the ISR fires immediately, loop runs, cache invalidates, and
|
||||
// the read clears the latch. One harmless extra read at most.
|
||||
if (this->interrupt_pin_ != nullptr) {
|
||||
this->interrupt_pin_->setup();
|
||||
this->interrupt_pin_->attach_interrupt(&PI4IOE5V6408Component::gpio_intr, this, gpio::INTERRUPT_FALLING_EDGE);
|
||||
|
||||
Reference in New Issue
Block a user