Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e007c15

Browse files
committed
zephyrCommon: Fixed a bug in the interrupt handler acquisition
Fixed an issue where the reference location for the interrupt handler was a bit mask instead of an index value. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
1 parent c85c470 commit e007c15

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎cores/arduino/zephyrCommon.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void setInterruptHandler(pin_size_t pinNumber, voidFuncPtr func)
104104
struct gpio_port_callback *pcb = find_gpio_port_callback(arduino_pins[pinNumber].port);
105105

106106
if (pcb) {
107-
pcb->handlers[BIT(arduino_pins[pinNumber].pin)].handler = func;
107+
pcb->handlers[arduino_pins[pinNumber].pin].handler = func;
108108
}
109109
}
110110

@@ -113,8 +113,8 @@ void handleGpioCallback(const struct device *port, struct gpio_callback *cb, uin
113113
struct gpio_port_callback *pcb = (struct gpio_port_callback *)cb;
114114

115115
for (uint32_t i = 0; i < max_ngpios; i++) {
116-
if (pins & BIT(i) && pcb->handlers[BIT(i)].enabled) {
117-
pcb->handlers[BIT(i)].handler();
116+
if (pins & BIT(i) && pcb->handlers[i].enabled) {
117+
pcb->handlers[i].handler();
118118
}
119119
}
120120
}
@@ -455,15 +455,15 @@ void enableInterrupt(pin_size_t pinNumber) {
455455
struct gpio_port_callback *pcb = find_gpio_port_callback(arduino_pins[pinNumber].port);
456456

457457
if (pcb) {
458-
pcb->handlers[BIT(arduino_pins[pinNumber].pin)].enabled = true;
458+
pcb->handlers[arduino_pins[pinNumber].pin].enabled = true;
459459
}
460460
}
461461

462462
void disableInterrupt(pin_size_t pinNumber) {
463463
struct gpio_port_callback *pcb = find_gpio_port_callback(arduino_pins[pinNumber].port);
464464

465465
if (pcb) {
466-
pcb->handlers[BIT(arduino_pins[pinNumber].pin)].enabled = false;
466+
pcb->handlers[arduino_pins[pinNumber].pin].enabled = false;
467467
}
468468
}
469469

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /