Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Dario503 opened this issue Dec 2, 2023 · 0 comments
Labels
type: imperfection Perceived defect in any part of project

Comments

@Dario503
Copy link

Dario503 commented Dec 2, 2023

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);

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants