Greetings to All,
I am trying to set up GPIO-based interrupt using the RTOS SDK (see code below).
It seems I need to use the gpio_pin_intr_state_set() function but it is missing from the SDK libraries. Any help would be greatly appreciated!
Best,
Emmanuel
void main_int_handler()
{
printf("main_int_callback!\n");
int i;
uint32 gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
uint32 gpio_mask = _xt_read_ints();
printf("Generic interrupt gpio_mask= 0x%08x, status = 0x%08x\n",gpio_mask,gpio_status);
for (i=0 ; i<16 ; i++) {
if ((0x1<<i) & gpio_status) {
printf("Mask set %d\n",i);
}
}
void registerInterrupt(int pin, GPIO_INT_TYPE mode)
{
portENTER_CRITICAL();
// disable open drain
GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(pin)),
GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(pin))) & (~ GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)));
//clear interrupt status
GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(pin));
// set the mode
_xt_isr_unmask(1<<ETS_GPIO_INUM);
//gpio_pin_intr_state_set(GPIO_ID_PIN(pin), mode); // does not link if this line is enabled...
portENABLE_INTERRUPTS();
portEXIT_CRITICAL();
}
in user_init():
_xt_isr_attach(ETS_GPIO_INUM, (_xt_isr)main_int_handler, NULL);
_xt_isr_unmask(1<<ETS_GPIO_INUM);
registerInterrupt(15, GPIO_PIN_INTR_ANYEDGE); // setting INT on GPIO15
GPIO interrupt using RTOS SDK: how to?
Who is online
Users browsing this forum: No registered users and 54 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.