bugfix(gpio): Repair GPIO interrupt function

Because the interrupt structure of esp8266 and esp32 is not the same, the following functions need to be deleted
* Delete the gpio_intr_enable() and gpio_intr_disable() functions

Related issues
* Fixes https://github.com/espressif/ESP8266_RTOS_SDK/issues/282
* Fixes https://github.com/espressif/ESP8266_RTOS_SDK/issues/284
This commit is contained in:
XiongYu
2018-08-14 13:47:15 +08:00
parent fd63b5e561
commit 8c97d2956c
3 changed files with 6 additions and 47 deletions

View File

@ -141,18 +141,6 @@ esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type)
return ESP_OK;
}
esp_err_t gpio_intr_enable(gpio_num_t gpio_num)
{
_xt_isr_unmask(0x1 << ETS_GPIO_INUM);
return ESP_OK;
}
esp_err_t gpio_intr_disable(gpio_num_t gpio_num)
{
_xt_isr_mask(0x1 << ETS_GPIO_INUM);
return ESP_OK;
}
static esp_err_t gpio_output_disable(gpio_num_t gpio_num)
{
GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
@ -327,12 +315,6 @@ esp_err_t gpio_config(const gpio_config_t *gpio_cfg)
if (!RTC_GPIO_IS_VALID_GPIO(io_num)) {
gpio_set_intr_type(io_num, gpio_cfg->intr_type);
if (gpio_cfg->intr_type) {
gpio_intr_enable(io_num);
} else {
gpio_intr_disable(io_num);
}
}
pin_reg.val = READ_PERI_REG(GPIO_PIN_REG(io_num));
@ -418,15 +400,14 @@ esp_err_t gpio_isr_handler_remove(gpio_num_t gpio_num)
return ESP_OK;
}
esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int no_use, gpio_isr_handle_t *handle)
esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int no_use, gpio_isr_handle_t *handle_no_use)
{
GPIO_CHECK(fn, "GPIO ISR null", ESP_ERR_INVALID_ARG);
_xt_isr_attach(ETS_GPIO_INUM, gpio_intr_service, NULL);
_xt_isr_attach(ETS_GPIO_INUM, fn, arg);
return ESP_OK;
}
esp_err_t gpio_install_isr_service(int no_use)
{
GPIO_CHECK(gpio_isr_func == NULL, "GPIO isr service already installed", ESP_FAIL);

View File

@ -76,7 +76,7 @@ typedef enum {
GPIO_NUM_13 = 13, /*!< GPIO13, input and output */
GPIO_NUM_14 = 14, /*!< GPIO14, input and output */
GPIO_NUM_15 = 15, /*!< GPIO15, input and output */
GPIO_NUM_16 = 16, /*!< GPIO15, input and output */
GPIO_NUM_16 = 16, /*!< GPIO16, input and output */
GPIO_NUM_MAX = 17,
/** @endcond */
} gpio_num_t;
@ -153,28 +153,6 @@ esp_err_t gpio_config(const gpio_config_t *gpio_cfg);
*/
esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type);
/**
* @brief Enable GPIO module interrupt signal
*
* @param gpio_num GPIO number. If you want to enable an interrupt on e.g. GPIO12, gpio_num should be GPIO_NUM_12 (12);
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t gpio_intr_enable(gpio_num_t gpio_num);
/**
* @brief Disable GPIO module interrupt signal
*
* @param gpio_num GPIO number. If you want to disable the interrupt of e.g. GPIO12, gpio_num should be GPIO_NUM_12 (12);
*
* @return
* - ESP_OK success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t gpio_intr_disable(gpio_num_t gpio_num);
/**
* @brief GPIO set output level
*
@ -267,14 +245,14 @@ esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num);
* @param fn Interrupt handler function.
* @param no_use In order to be compatible with esp32, the parameter has no practical meaning and can be filled with 0.
* @param arg Parameter for handler function
* @param handle Pointer to return handle. In order to be compatible with esp32,the parameter has no practical meaning and can be filled with NULL.
* @param handle_no_use Pointer to return handle. In order to be compatible with esp32,the parameter has no practical meaning and can be filled with NULL.
*
* @return
* - ESP_OK Success ;
* - ESP_ERR_INVALID_ARG GPIO error
* - ESP_ERR_NOT_FOUND No free interrupt found with the specified flags
*/
esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int no_use, gpio_isr_handle_t *handle);
esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int no_use, gpio_isr_handle_t *handle_no_use);
/**
* @brief Enable pull-up on GPIO.

View File

@ -77,7 +77,7 @@ void app_main(void)
io_conf.intr_type = GPIO_INTR_DISABLE;
//set as output mode
io_conf.mode = GPIO_MODE_OUTPUT;
//bit mask of the pins that you want to set,e.g.GPIO18/19
//bit mask of the pins that you want to set,e.g.GPIO15/16
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
//disable pull-down mode
io_conf.pull_down_en = 0;