Skip to content

Commit

Permalink
Added check for rst_gpio_num == GPIO_NUM_NC
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Nov 7, 2024
1 parent d056037 commit 619a5be
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion boards
Submodule boards updated 1 files
+2 −2 esp32-3248S035C.json
10 changes: 9 additions & 1 deletion src/esp_touch_cst816s.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ esp_err_t cst816s_reset(esp_lcd_touch_handle_t th)
if (th == NULL)
return ESP_ERR_INVALID_ARG;

if (th->config.rst_gpio_num == GPIO_NUM_NC)
{
log_w("No RST pin defined");
return ESP_OK;
}

esp_err_t res;
// Set RST active
if ((res = gpio_set_level(th->config.rst_gpio_num, th->config.levels.reset)) != ESP_OK)
Expand Down Expand Up @@ -293,7 +299,9 @@ esp_err_t esp_lcd_touch_new_i2c_cst816s(const esp_lcd_panel_io_handle_t io, cons
{
if ((res = esp_lcd_touch_register_interrupt_callback(th, config->interrupt_callback)) != ESP_OK)
{
gpio_reset_pin(th->config.int_gpio_num);
if (config->int_gpio_num != GPIO_NUM_NC)
gpio_reset_pin(th->config.int_gpio_num);

free(th);
log_e("Registering interrupt callback failed");
return res;
Expand Down
6 changes: 6 additions & 0 deletions src/esp_touch_gt911.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ esp_err_t gt911_reset(esp_lcd_touch_handle_t th)
if (th == NULL)
return ESP_ERR_INVALID_ARG;

if (th->config.rst_gpio_num == GPIO_NUM_NC)
{
log_w("No RST pin defined");
return ESP_OK;
}

esp_err_t res;
// Set RST active
if ((res = gpio_set_level(th->config.rst_gpio_num, th->config.levels.reset)) != ESP_OK)
Expand Down

0 comments on commit 619a5be

Please sign in to comment.