mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/add_mutex_for_some_touchpad_apis_v3.1' into 'release/v3.1'
fix(touch): add_mutex_for_some_touchpad_apis (backport v3.1) See merge request idf/esp-idf!2963
This commit is contained in:
commit
7f4b77ca5b
@ -122,6 +122,7 @@ esp_err_t touch_pad_init();
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Un-install touch pad driver.
|
* @brief Un-install touch pad driver.
|
||||||
|
* @note After this function is called, other touch functions are prohibited from being called.
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK Success
|
* - ESP_OK Success
|
||||||
* - ESP_FAIL Touch pad driver not initialized
|
* - ESP_FAIL Touch pad driver not initialized
|
||||||
|
@ -479,7 +479,7 @@ static void touch_pad_filter_cb(void *arg)
|
|||||||
{
|
{
|
||||||
static uint32_t s_filtered_temp[TOUCH_PAD_MAX] = {0};
|
static uint32_t s_filtered_temp[TOUCH_PAD_MAX] = {0};
|
||||||
|
|
||||||
if (s_touch_pad_filter == NULL) {
|
if (s_touch_pad_filter == NULL || rtc_touch_mux == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint16_t val = 0;
|
uint16_t val = 0;
|
||||||
@ -828,15 +828,15 @@ esp_err_t touch_pad_init()
|
|||||||
|
|
||||||
esp_err_t touch_pad_deinit()
|
esp_err_t touch_pad_deinit()
|
||||||
{
|
{
|
||||||
if (rtc_touch_mux == NULL) {
|
RTC_MODULE_CHECK(rtc_touch_mux != NULL, "Touch pad not initialized", ESP_FAIL);
|
||||||
return ESP_FAIL;
|
if (s_touch_pad_filter != NULL) {
|
||||||
|
touch_pad_filter_stop();
|
||||||
|
touch_pad_filter_delete();
|
||||||
}
|
}
|
||||||
s_touch_pad_init_bit = 0x0000;
|
s_touch_pad_init_bit = 0x0000;
|
||||||
touch_pad_filter_delete();
|
|
||||||
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_SW);
|
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_SW);
|
||||||
touch_pad_clear_status();
|
touch_pad_clear_status();
|
||||||
touch_pad_intr_disable();
|
touch_pad_intr_disable();
|
||||||
vSemaphoreDelete(rtc_touch_mux);
|
|
||||||
rtc_touch_mux = NULL;
|
rtc_touch_mux = NULL;
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
@ -975,7 +975,7 @@ esp_err_t touch_pad_filter_start(uint32_t filter_period_ms)
|
|||||||
esp_err_t touch_pad_filter_stop()
|
esp_err_t touch_pad_filter_stop()
|
||||||
{
|
{
|
||||||
RTC_MODULE_CHECK(s_touch_pad_filter != NULL, "Touch pad filter not initialized", ESP_ERR_INVALID_STATE);
|
RTC_MODULE_CHECK(s_touch_pad_filter != NULL, "Touch pad filter not initialized", ESP_ERR_INVALID_STATE);
|
||||||
|
RTC_MODULE_CHECK(rtc_touch_mux != NULL, "Touch pad not initialized", ESP_ERR_INVALID_STATE);
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
xSemaphoreTake(rtc_touch_mux, portMAX_DELAY);
|
xSemaphoreTake(rtc_touch_mux, portMAX_DELAY);
|
||||||
if (s_touch_pad_filter != NULL) {
|
if (s_touch_pad_filter != NULL) {
|
||||||
@ -991,6 +991,7 @@ esp_err_t touch_pad_filter_stop()
|
|||||||
esp_err_t touch_pad_filter_delete()
|
esp_err_t touch_pad_filter_delete()
|
||||||
{
|
{
|
||||||
RTC_MODULE_CHECK(s_touch_pad_filter != NULL, "Touch pad filter not initialized", ESP_ERR_INVALID_STATE);
|
RTC_MODULE_CHECK(s_touch_pad_filter != NULL, "Touch pad filter not initialized", ESP_ERR_INVALID_STATE);
|
||||||
|
RTC_MODULE_CHECK(rtc_touch_mux != NULL, "Touch pad not initialized", ESP_ERR_INVALID_STATE);
|
||||||
xSemaphoreTake(rtc_touch_mux, portMAX_DELAY);
|
xSemaphoreTake(rtc_touch_mux, portMAX_DELAY);
|
||||||
if (s_touch_pad_filter != NULL) {
|
if (s_touch_pad_filter != NULL) {
|
||||||
if (s_touch_pad_filter->timer != NULL) {
|
if (s_touch_pad_filter->timer != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user