Skip to content

Calling LowPower.attachInterruptWakeup with irq_mode CHANGE causes ISR to be fired #61

Open
@Dario503

Description

@Dario503

Platform: Seeeduino XIAO SAMD21

Device supports Interrupts on any and all pins (just not 5 & 7 at the same time)

The input IO lines are all strapped low for test.

Setting up 6 interrupts:

const uint8_t switchPins[] = { 0, 1, 2, 3, 8, 10 };
const uint8_t numSwitches = sizeof(switchPins) / sizeof(switchPins[0]);

void (*ISRFunctions[numSwitches])() = {
  [] {
    switchChanged(0);
  },
  [] {
    switchChanged(1);
  },
  [] {
    switchChanged(2);
  },
  [] {
    switchChanged(3);
  },
  [] {
    switchChanged(4);
  },
  [] {
    switchChanged(5);
  }
};

void setup(){

...

for (uint8_t i = 0; i < numSwitches; i++) {
    pinMode(switchPins[i], INPUT_PULLUP);
  }
  delay(500);

   for (uint8_t i = 0; i < numSwitches; i++) {
    LowPower.attachInterruptWakeup((digitalPinToInterrupt(switchPins[i])), ISRFunctions[i], CHANGE);
  }
delay(1000);
}

//This will trigger 5 (not 6) calls to the ISR

The current workaround:

for (uint8_t i = 0; i < numSwitches; i++) {
    LowPower.attachInterruptWakeup((digitalPinToInterrupt(switchPins[i])), ISRFunctions[i], RISING);
  }
  delay(1000);
   for (uint8_t i = 0; i < numSwitches; i++) {
    LowPower.attachInterruptWakeup((digitalPinToInterrupt(switchPins[i])), ISRFunctions[i], CHANGE);
  }
  delay(1000);

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions