cpu/sam0_common: GPIO: use bitarithm_test_and_clear()
This commit is contained in:
parent
403b6b15c6
commit
cc2a3c9fd3
@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "bitarithm.h"
|
||||||
#include "periph/gpio.h"
|
#include "periph/gpio.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
|
|
||||||
@ -345,9 +346,9 @@ void isr_eic(void)
|
|||||||
_EIC->INTFLAG.reg = state;
|
_EIC->INTFLAG.reg = state;
|
||||||
|
|
||||||
/* execute interrupt callbacks */
|
/* execute interrupt callbacks */
|
||||||
|
uint8_t pin = 0;
|
||||||
while (state) {
|
while (state) {
|
||||||
unsigned pin = 8 * sizeof(state) - __builtin_clz(state) - 1;
|
state = bitarithm_test_and_clear(state, &pin);
|
||||||
state &= ~(1 << pin);
|
|
||||||
gpio_config[pin].cb(gpio_config[pin].arg);
|
gpio_config[pin].cb(gpio_config[pin].arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user