-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use gpio interrupt? #8
Comments
@ly0 have you found any info on this ? I am looking for the same info. |
@donnib refered to http://g-lab.ca/esp8266ex-gpio-registers/, maybe we need to handle the related registers directly. search 'INT' for more info on that page. But I haven't tried. |
gpio driver has been upload, you can have a test. |
@espressif which driver are you reffering to ? 0.9.4 has GPIO interrupt supported ? If so any documentation about that ? |
In the exemple you talked about a gpio_intr_ack function (https://github.com/espressif/esp_iot_rtos_sdk/blob/master/examples/driver_lib/driver/gpio.c#L101). But I can't find it anywhere. Even if I add the signature : void gpio_intr_ack(uint32 mask); the linker can't find it. EDIT: I managed to compile by providing the address to the linker (PROVIDE ( gpio_intr_ack = 0x40004dcc );) But now I'm getting this exception when I trigger my interrupt :
Here is my code : LOCAL void (*callbacks[16])(void);
LOCAL void interruptHandler(int gpio_mask) {
for (int i=0 ; i<16 ; i++) {
if ((0x1<<i) & gpio_mask) {
if (callbacks[i] != NULL) {
(*callbacks[i])();
}
}
}
gpio_intr_ack(gpio_mask);
} And this is how i register the handler : for (int i=0 ; i<16 ; i++) {
callbacks[i] = NULL;
}
_xt_isr_attach(ETS_GPIO_INUM, (_xt_isr)interruptHandler);
_xt_isr_unmask(1<<ETS_GPIO_INUM); EDIT2: It seems that the interrupt is given no arguments (gpio_mask is always 16, whatever the pin are). I tried to use gpio_intr_pending(); but it always return 0 and throw a 29 (EXCCAUSE_STORE_PROHIBITED) exception. It also seems that the interrupt is triggered a lot before crashing, shouldn't it be triggered once ? EDIT3: I tried to use _xt_clear_ints(uint32 mask); and _xt_read_ints(); but I have the same issue, with _xt_read_ints(); returning a lot of 20 and some 84. |
Any idea ? This issue seems to be linked with the pwm one. Edit: an answer has been found by hreintke on esp8266.com : http://www.esp8266.com/viewtopic.php?f=8&t=241&p=7246#p7246 |
Now, 2 years later, is there an answer to this? Is there a conclusive example how to do this?? |
I propose to add this to the official distribution: it is backward compatible and it means people can have a 'one-stop-shop-experience' by just reading the gpio.h file.
|
I haven't seen any API could do this.
The text was updated successfully, but these errors were encountered: