Using two gpio pins to trigger an interrupt in esp-idf
Posted: Fri Oct 25, 2024 5:03 pm
I am trying to trigger an interrupt using two gpio pins say A and B. The interrupt would only trigger if gpio A is a low and gpio B is a high.
This is the code I am using to set the interrupt pins and also to trigger it.
However, the interrupt is not triggered even if the the conditions are right. What could I be doing wrong?
This is the code I am using to set the interrupt pins and also to trigger it.
Code: Select all
gpio_config_t intr_conf = {
.mode = GPIO_MODE_INPUT,
.pin_bit_mask = (1ULL << ON_SIGNAL) | (1ULL << COIL_OUTPUT),
.intr_type = GPIO_INTR_ANYEDGE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.pull_up_en = GPIO_PULLUP_DISABLE};
ESP_ERROR_CHECK(gpio_config(&intr_conf));
}
void IRAM_ATTR ignitionOff(void *args)
{
// uint32_t gpio_num = (uint32_t)args;
if ((gpio_get_level(ON_SIGNAL) == 0) && (gpio_get_level(COIL_OUTPUT) == 1))
{
gpio_set_level(GATE_SIGNAL, 1);
printf("interrupt triggered\n");
// puts screen to sleep
sendData("sleep=1");
BaseType_t pxHigherPriorityTaskWoken = pdFALSE;
if (xTimerStartFromISR(xIgnitionPulseTimer, &pxHigherPriorityTaskWoken) == pdPASS)
portYIELD_FROM_ISR();
}
}
void vIgnitionPulseCallback(TimerHandle_t xTimer)
{
gpio_set_level(GATE_SIGNAL, 0);
}