- Tue Jan 08, 2019 6:26 pm
#79958
dfrap wrote:I found that the Interrupt clearing register GPIO_STATUS_W1TC is part of the SDK. To use those API functions, external C headers must be included.
// Include API-Headers
extern "C" {
#include "ets_sys.h"
#include "os_type.h"
#include "osapi.h"
#include "mem.h"
#include "user_interface.h"
#include "cont.h"
}
unsigned long gpio_status;
//Clear GPIO Interrupt Status
gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status);
attachInterrupt(digitalPinToInterrupt(PIN), keypress, FALLING);
Hello, this problem continues?
I'm having problems with the external interruption!
It causes bug in my code and I do not know why!
I use it to read pulses with a frequency of max 50hz
but with much less than that, the esp locks and resets!
I still have not figured out the reason, but I suspect the interrupt is changing the value of the variable at the same time of some operation with it! it ends up crashing.
So I plan to enable an external interrupt without an ISR. (function that will be called when the interruption occurs)
Then I read the flag recorder to see if there was or not the interrupt and clean this recorder! I do not know if it is resolved or if it is possible.
But I would use this knowledge you posted here.
Can you give me advice?
Thank you!