Skip to content

gpio_default_irq_handler() calls callback with incorrect gpio parameter #879

Closed
@earlephilhower

Description

@earlephilhower

In the develop branch, after #850 was merged, it seems like the GPIO sent to the user callback is not correct.

I have called the init function as follows for any change on GPIO 9:

gpio_set_irq_enabled_with_callback(9 /*gpio #9*/, 12 /* rise or fall */, true /*enabled*/, _gpioInterruptDispatcher /* userland irq handler */);

When I set a breakpoint in GDB I can see that a toggle on GPIO #9 does result in a callback to the SDK gpio_default_irq_handler(), so the interrupt enables are set properly, but the callback routine gets called with 8 as the interrupting GPIO, not 9.

Right now the code is only returning GPIO 0, 8, 16, or 24:

if (events && !(raw_irq_mask[core] & (1u << i))) {
gpio_acknowledge_irq(i, events);
if (callback) {
callback(gpio, events);
}
}

Line 155 should be

         callback(i, events); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions