GPIO ISF not active with RTOS_SDK-1.4.2[RTOS_SDK-1.4.2版本下GPIO中断服务程序不工作]

User avatar
mike.wu
Posts: 2
Joined: Tue Nov 08, 2016 8:27 am
Contact:

GPIO ISF not active with RTOS_SDK-1.4.2[RTOS_SDK-1.4.2版本下GPIO中断服务程序不工作]

Postby mike.wu » Tue Nov 08, 2016 3:39 pm

hi, all. Code is below. :? :? :? :?

Code: Select all

LOCAL void gpio_int_handler(void)
{
    uint32 gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
    //ETS_GPIO_INTR_DISABLE();
    ETS_INTR_LOCK();
    GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status);
    //GPIO_OUTPUT(GPIO_Pin_4,1);
    if (gpio_status & BIT(GPIO_ID_PIN(12)))
    {
        if( GPIO_ID_PIN(12) )
        {
            printf("yes----------------\n");
            GPIO_OUTPUT_SET(GPIO_ID_PIN(4), 1);
        }
        else
        {
            printf("no-----------------\n");
        }
    }
    //ETS_GPIO_INTR_ENABLE();
    ETS_INTR_UNLOCK();
}

void user_init(void)
{
    printf("SDK version:%s\n", system_get_sdk_version());
    GPIO_ConfigTypeDef gpio_conf4;
    gpio_conf4.GPIO_Pin = GPIO_Pin_4;
    gpio_conf4.GPIO_Mode = GPIO_Mode_Output;
    gpio_conf4.GPIO_Pullup = GPIO_PullUp_EN;
    gpio_conf4.GPIO_IntrType = GPIO_PIN_INTR_DISABLE;
    gpio_config(&gpio_conf4);
    GPIO_OUTPUT_SET(GPIO_ID_PIN(4), 1);

    GPIO_ConfigTypeDef gpio_conf12;
    ETS_INTR_LOCK();
    gpio_conf12.GPIO_Pin = GPIO_Pin_12;
    gpio_conf12.GPIO_Mode = GPIO_Mode_Input;
    gpio_conf12.GPIO_Pullup = GPIO_PullUp_DIS;
    gpio_conf12.GPIO_IntrType = GPIO_PIN_INTR_POSEDGE;
    gpio_intr_handler_register(gpio_int_handler,NULL);
    gpio_config(&gpio_conf12);
    ETS_INTR_UNLOCK();
    GPIO_OUTPUT_SET(GPIO_ID_PIN(4), 0);
    while(1);
}

ESP_Xutao
Posts: 134
Joined: Tue Sep 27, 2016 5:42 pm

Re: GPIO ISF not active with RTOS_SDK-1.4.2[RTOS_SDK-1.4.2版本下GPIO中断服务程序不工作]

Postby ESP_Xutao » Fri Nov 25, 2016 5:10 pm

你好:
RTOS V1.4.2版本的GPIO中断是是可以正常工作的,刚刚将github上的GPIOtest sample code测试了一下完全可以。有关GPIO中断的代码可以参考一下官网github上面的GPIOtest。https://github.com/espressif/esp8266-rtos-sample-code.git
谢谢对ESP8266的关注。

Who is online

Users browsing this forum: No registered users and 304 guests