Skip to content

Commit cff2033

Browse files
committed
Merge branch 'bugfix/fix_gpio_isr_v3.0' into 'release/v3.0'
bugfix(gpio): Repair GPIO interrupt function(backport v3.0) See merge request sdk/ESP8266_RTOS_SDK!397
2 parents 15bbe60 + 8c97d29 commit cff2033

File tree

3 files changed

+6
-47
lines changed

3 files changed

+6
-47
lines changed

components/esp8266/driver/gpio.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,6 @@ esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type)
141141
return ESP_OK;
142142
}
143143

144-
esp_err_t gpio_intr_enable(gpio_num_t gpio_num)
145-
{
146-
_xt_isr_unmask(0x1 << ETS_GPIO_INUM);
147-
return ESP_OK;
148-
}
149-
150-
esp_err_t gpio_intr_disable(gpio_num_t gpio_num)
151-
{
152-
_xt_isr_mask(0x1 << ETS_GPIO_INUM);
153-
return ESP_OK;
154-
}
155-
156144
static esp_err_t gpio_output_disable(gpio_num_t gpio_num)
157145
{
158146
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)
327315

328316
if (!RTC_GPIO_IS_VALID_GPIO(io_num)) {
329317
gpio_set_intr_type(io_num, gpio_cfg->intr_type);
330-
331-
if (gpio_cfg->intr_type) {
332-
gpio_intr_enable(io_num);
333-
} else {
334-
gpio_intr_disable(io_num);
335-
}
336318
}
337319

338320
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)
418400
return ESP_OK;
419401
}
420402

421-
esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int no_use, gpio_isr_handle_t *handle)
403+
esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int no_use, gpio_isr_handle_t *handle_no_use)
422404
{
423405
GPIO_CHECK(fn, "GPIO ISR null", ESP_ERR_INVALID_ARG);
424406

425-
_xt_isr_attach(ETS_GPIO_INUM, gpio_intr_service, NULL);
407+
_xt_isr_attach(ETS_GPIO_INUM, fn, arg);
426408
return ESP_OK;
427409
}
428410

429-
430411
esp_err_t gpio_install_isr_service(int no_use)
431412
{
432413
GPIO_CHECK(gpio_isr_func == NULL, "GPIO isr service already installed", ESP_FAIL);

components/esp8266/include/driver/gpio.h

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ typedef enum {
7676
GPIO_NUM_13 = 13, /*!< GPIO13, input and output */
7777
GPIO_NUM_14 = 14, /*!< GPIO14, input and output */
7878
GPIO_NUM_15 = 15, /*!< GPIO15, input and output */
79-
GPIO_NUM_16 = 16, /*!< GPIO15, input and output */
79+
GPIO_NUM_16 = 16, /*!< GPIO16, input and output */
8080
GPIO_NUM_MAX = 17,
8181
/** @endcond */
8282
} gpio_num_t;
@@ -153,28 +153,6 @@ esp_err_t gpio_config(const gpio_config_t *gpio_cfg);
153153
*/
154154
esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type);
155155

156-
/**
157-
* @brief Enable GPIO module interrupt signal
158-
*
159-
* @param gpio_num GPIO number. If you want to enable an interrupt on e.g. GPIO12, gpio_num should be GPIO_NUM_12 (12);
160-
*
161-
* @return
162-
* - ESP_OK Success
163-
* - ESP_ERR_INVALID_ARG Parameter error
164-
*/
165-
esp_err_t gpio_intr_enable(gpio_num_t gpio_num);
166-
167-
/**
168-
* @brief Disable GPIO module interrupt signal
169-
*
170-
* @param gpio_num GPIO number. If you want to disable the interrupt of e.g. GPIO12, gpio_num should be GPIO_NUM_12 (12);
171-
*
172-
* @return
173-
* - ESP_OK success
174-
* - ESP_ERR_INVALID_ARG Parameter error
175-
*/
176-
esp_err_t gpio_intr_disable(gpio_num_t gpio_num);
177-
178156
/**
179157
* @brief GPIO set output level
180158
*
@@ -267,14 +245,14 @@ esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num);
267245
* @param fn Interrupt handler function.
268246
* @param no_use In order to be compatible with esp32, the parameter has no practical meaning and can be filled with 0.
269247
* @param arg Parameter for handler function
270-
* @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.
248+
* @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.
271249
*
272250
* @return
273251
* - ESP_OK Success ;
274252
* - ESP_ERR_INVALID_ARG GPIO error
275253
* - ESP_ERR_NOT_FOUND No free interrupt found with the specified flags
276254
*/
277-
esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int no_use, gpio_isr_handle_t *handle);
255+
esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int no_use, gpio_isr_handle_t *handle_no_use);
278256

279257
/**
280258
* @brief Enable pull-up on GPIO.

examples/peripherals/gpio/main/user_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void app_main(void)
7777
io_conf.intr_type = GPIO_INTR_DISABLE;
7878
//set as output mode
7979
io_conf.mode = GPIO_MODE_OUTPUT;
80-
//bit mask of the pins that you want to set,e.g.GPIO18/19
80+
//bit mask of the pins that you want to set,e.g.GPIO15/16
8181
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
8282
//disable pull-down mode
8383
io_conf.pull_down_en = 0;

0 commit comments

Comments
 (0)