Commit 71e9f7a3 authored by Sandeep Mistry's avatar Sandeep Mistry

Correct attachInterrupt/detachInterrupt to use pin map

parent d919a43d
...@@ -50,6 +50,12 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) ...@@ -50,6 +50,12 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
enabled = 1; enabled = 1;
} }
if (pin >= PINS_COUNT) {
return;
}
pin = g_ADigitalPinMap[pin];
nrf_gpiote_polarity_t polarity; nrf_gpiote_polarity_t polarity;
switch (mode) { switch (mode) {
...@@ -88,6 +94,12 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode) ...@@ -88,6 +94,12 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
*/ */
void detachInterrupt(uint32_t pin) void detachInterrupt(uint32_t pin)
{ {
if (pin >= PINS_COUNT) {
return;
}
pin = g_ADigitalPinMap[pin];
for (int ch = 0; ch < NUMBER_OF_GPIO_TE; ch++) { for (int ch = 0; ch < NUMBER_OF_GPIO_TE; ch++) {
if ((uint32_t)channelMap[ch] == pin) { if ((uint32_t)channelMap[ch] == pin) {
channelMap[ch] = -1; channelMap[ch] = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment