Skip to content

Commit f341c7b

Browse files
committed
fix(touch): release ISR semaphore when delete
1 parent 6cb9866 commit f341c7b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/touch/ESP_PanelTouch.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ ESP_PanelTouch::ESP_PanelTouch(ESP_PanelBus *bus, const esp_lcd_touch_config_t &
7878
}
7979
}
8080

81+
void ESP_PanelTouch::configLevels(int reset_level, int interrupt_level)
82+
{
83+
config.levels.reset = reset_level;
84+
config.levels.interrupt = interrupt_level;
85+
}
86+
8187
bool ESP_PanelTouch::attachInterruptCallback(std::function<bool (void *)> callback, void *user_data)
8288
{
8389
ESP_PANEL_CHECK_FALSE_RET((config.interrupt_callback == onTouchInterrupt), false, "Interruption is not enabled");
@@ -109,6 +115,11 @@ bool ESP_PanelTouch::del(void)
109115
ESP_PANEL_CHECK_NULL_RET(handle, false, "Invalid handle");
110116
ESP_PANEL_CHECK_ERR_RET(esp_lcd_touch_del(handle), false, "Delete touch panel failed");
111117

118+
if (_isr_sem != NULL) {
119+
vSemaphoreDelete(_isr_sem);
120+
_isr_sem = NULL;
121+
}
122+
112123
ESP_LOGD(TAG, "Touch panel @%p deleted", handle);
113124
handle = NULL;
114125

src/touch/ESP_PanelTouch.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ class ESP_PanelTouch {
8484
*/
8585
virtual ~ESP_PanelTouch() = default;
8686

87+
/**
88+
* @brief Configure the levels of the reset and interrupt signals
89+
*
90+
* @param reset_level The level of the reset signal
91+
* @param interrupt_level The level of the interrupt signal
92+
*/
93+
void configLevels(int reset_level, int interrupt_level);
94+
8795
/**
8896
* @brief Attach a callback function, which will be called when the refreshing is finished
8997
*

test_apps/touch/i2c/main/test_i2c_touch.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ static void run_test(shared_ptr<ESP_PanelTouch> touch_device)
117117
CREATE_TEST_CASE(CST816S)
118118
CREATE_TEST_CASE(FT5x06)
119119
CREATE_TEST_CASE(GT1151)
120+
CREATE_TEST_CASE(GT911)
120121
CREATE_TEST_CASE(TT21100)
121122
CREATE_TEST_CASE(ST1633)
122123
CREATE_TEST_CASE(ST7123)

0 commit comments

Comments
 (0)