martinayotte wrote:BTW, folks and @rudi, using "switch/case" with numeric values for each interrupt is not a good practice.
If both interrupts come at the same time, your code won't handle any, since gpio_intr_status will be set to 393216.
You should use bitmask as "if (gpio_intr_status & 0x02000) {}" and "if (gpio_intr_status & 0x04000) {}" for GPIO17/GPIO18 respectively.
yes you are right martin
http://esp32.com/viewtopic.php?f=13&t=3 ... t=10#p1594
(if we not enable isr on gpio17 but pushes one time)
if i push gpio17 i get no fired isr,
( usr only on gpio18 )
but if i push gpio18,
i get gpio_intr_status
393216
means
1100000000000000000
gpio18 + gpio17
if you enable only one gpio, then we can mask, or cases or do with you mentioned example too in the isr.
i think - but if we enable more, then we can only handle on same time only one fired INTR ?!
the default case in enable two ( 17, 18 ) was for probe the things, does it (fast) bounce or not "in the isr" in the meantime in "fire" moment.
if we want handle a second without isr fire we can example look up for the value on the pin after fired and in the isr every time
( see the preview example with disabled gpio17 isr )
( btw similar example fire on SDA pin..and a lookup for the value of an other pin(scl) in the isr meantime after sda fired )
Code: Select all
scl=GPIO_INPUT_GET(GPIO_ID_PIN(I2C_SLAVE_SDL_GPIO));
sda=GPIO_INPUT_GET(GPIO_ID_PIN(I2C_SLAVE_SDA_GPIO));
if(( (gpio_status>>I2C_SLAVE_SDA_GPIO)& BIT0)&&scl) //SDA trigger and sdl high
{
if( sda )// sda posedge , stop
..
..
else //sda negedge,start
..
this was only a "example" because bounce was theme.
btw, how you would handle it ?
best wishes
rudi