1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #4815 from DipSwitch/pr/fix_stm32_exti_isr

STM32 GPIO: Fix exti_isr handling to only call callbacks of lines with there IRQ enabled
This commit is contained in:
Hauke Petersen 2016-02-21 14:11:36 +01:00
commit c82dda9b74
5 changed files with 15 additions and 5 deletions

View File

@ -199,8 +199,10 @@ void gpio_write(gpio_t pin, int value)
void isr_exti(void)
{
/* only generate interrupts against lines which have their IMR set */
uint32_t pending_isr = (EXTI->PR & EXTI->IMR);
for (size_t i = 0; i < EXTI_NUMOF; i++) {
if (EXTI->PR & (1 << i)) {
if (pending_isr & (1 << i)) {
EXTI->PR = (1 << i); /* clear by writing a 1 */
isr_ctx[i].cb(isr_ctx[i].arg);
}

View File

@ -207,8 +207,10 @@ void gpio_write(gpio_t pin, int value)
void isr_exti(void)
{
/* only generate interrupts against lines which have their IMR set */
uint32_t pending_isr = (EXTI->PR & EXTI->IMR);
for (unsigned i = 0; i < GPIO_ISR_CHAN_NUMOF; i++) {
if (EXTI->PR & (1 << i)) {
if (pending_isr & (1 << i)) {
EXTI->PR = (1 << i); /* clear by writing a 1 */
exti_ctx[i].cb(exti_ctx[i].arg);
}

View File

@ -203,8 +203,10 @@ void gpio_write(gpio_t pin, int value)
void isr_exti(void)
{
/* only generate interrupts against lines which have their IMR set */
uint32_t pending_isr = (EXTI->PR & EXTI->IMR);
for (int i = 0; i < EXTI_NUMOF; i++) {
if (EXTI->PR & (1 << i)) {
if (pending_isr & (1 << i)) {
EXTI->PR |= (1 << i); /* clear by writing a 1 */
exti_chan[i].cb(exti_chan[i].arg);
}

View File

@ -200,8 +200,10 @@ void gpio_write(gpio_t pin, int value)
void isr_exti(void)
{
/* only generate interrupts against lines which have their IMR set */
uint32_t pending_isr = (EXTI->PR & EXTI->IMR);
for (unsigned i = 0; i < GPIO_ISR_CHAN_NUMOF; i++) {
if (EXTI->PR & (1 << i)) {
if (pending_isr & (1 << i)) {
EXTI->PR |= (1 << i); /* clear by writing a 1 */
exti_chan[i].cb(exti_chan[i].arg);
}

View File

@ -204,8 +204,10 @@ void gpio_write(gpio_t pin, int value)
void isr_exti(void)
{
/* only generate interrupts against lines which have their IMR set */
uint32_t pending_isr = (EXTI->PR & EXTI->IMR);
for (int i = 0; i < GPIO_ISR_CHAN_NUMOF; i++) {
if (EXTI->PR & (1 << i)) {
if (pending_isr & (1 << i)) {
EXTI->PR |= (1 << i); /* clear by writing a 1 */
exti_chan[i].cb(exti_chan[i].arg);
}