forked from espressif/esp-idf
Merge branch 'bugfix/touch_element_callback_para_v4.3' into 'release/v4.3'
touch_element: fix event callback parameter type, change it into pointer (backport v4.3) See merge request espressif/esp-idf!12629
This commit is contained in:
@@ -61,7 +61,7 @@ typedef struct {
|
|||||||
} touch_button_message_t;
|
} touch_button_message_t;
|
||||||
|
|
||||||
typedef touch_elem_handle_t touch_button_handle_t; //!< Button handle
|
typedef touch_elem_handle_t touch_button_handle_t; //!< Button handle
|
||||||
typedef void(*touch_button_callback_t)(touch_button_handle_t, touch_button_message_t, void *); //!< Button callback type
|
typedef void(*touch_button_callback_t)(touch_button_handle_t, touch_button_message_t *, void *); //!< Button callback type
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Touch Button initialize
|
* @brief Touch Button initialize
|
||||||
@@ -160,6 +160,8 @@ esp_err_t touch_button_set_dispatch_method(touch_button_handle_t button_handle,
|
|||||||
* @param[in] button_handle Button handle
|
* @param[in] button_handle Button handle
|
||||||
* @param[in] button_callback User input callback
|
* @param[in] button_callback User input callback
|
||||||
*
|
*
|
||||||
|
* @note Button message will be passed from the callback function and it will be destroyed when the callback function return.
|
||||||
|
*
|
||||||
* @warning Since this input callback routine runs on driver core (esp-timer callback routine),
|
* @warning Since this input callback routine runs on driver core (esp-timer callback routine),
|
||||||
* it should not do something that attempts to Block, such as calling vTaskDelay().
|
* it should not do something that attempts to Block, such as calling vTaskDelay().
|
||||||
*
|
*
|
||||||
|
@@ -75,7 +75,7 @@ typedef struct {
|
|||||||
} touch_matrix_message_t;
|
} touch_matrix_message_t;
|
||||||
|
|
||||||
typedef touch_elem_handle_t touch_matrix_handle_t; //!< Matrix button instance handle
|
typedef touch_elem_handle_t touch_matrix_handle_t; //!< Matrix button instance handle
|
||||||
typedef void(*touch_matrix_callback_t)(touch_matrix_handle_t, touch_matrix_message_t, void *); //!< Matrix button callback type
|
typedef void(*touch_matrix_callback_t)(touch_matrix_handle_t, touch_matrix_message_t *, void *); //!< Matrix button callback type
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Touch matrix button initialize
|
* @brief Touch matrix button initialize
|
||||||
@@ -178,6 +178,8 @@ esp_err_t touch_matrix_set_dispatch_method(touch_matrix_handle_t matrix_handle,
|
|||||||
* @param[in] matrix_handle Matrix button handle
|
* @param[in] matrix_handle Matrix button handle
|
||||||
* @param[in] matrix_callback User input callback
|
* @param[in] matrix_callback User input callback
|
||||||
*
|
*
|
||||||
|
* @note Matrix message will be passed from the callback function and it will be destroyed when the callback function return.
|
||||||
|
*
|
||||||
* @warning Since this input callback routine runs on driver core (esp-timer callback routine),
|
* @warning Since this input callback routine runs on driver core (esp-timer callback routine),
|
||||||
* it should not do something that attempts to Block, such as calling vTaskDelay().
|
* it should not do something that attempts to Block, such as calling vTaskDelay().
|
||||||
*
|
*
|
||||||
|
@@ -77,7 +77,7 @@ typedef struct {
|
|||||||
} touch_slider_message_t;
|
} touch_slider_message_t;
|
||||||
|
|
||||||
typedef touch_elem_handle_t touch_slider_handle_t; //!< Slider instance handle
|
typedef touch_elem_handle_t touch_slider_handle_t; //!< Slider instance handle
|
||||||
typedef void(*touch_slider_callback_t)(touch_slider_handle_t, touch_slider_message_t, void *); //!< Slider callback type
|
typedef void(*touch_slider_callback_t)(touch_slider_handle_t, touch_slider_message_t *, void *); //!< Slider callback type
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Touch slider initialize
|
* @brief Touch slider initialize
|
||||||
@@ -178,6 +178,8 @@ esp_err_t touch_slider_set_dispatch_method(touch_slider_handle_t slider_handle,
|
|||||||
* @param[in] slider_handle Slider handle
|
* @param[in] slider_handle Slider handle
|
||||||
* @param[in] slider_callback User input callback
|
* @param[in] slider_callback User input callback
|
||||||
*
|
*
|
||||||
|
* @note Slider message will be passed from the callback function and it will be destroyed when the callback function return.
|
||||||
|
*
|
||||||
* @warning Since this input callback routine runs on driver core (esp-timer callback routine),
|
* @warning Since this input callback routine runs on driver core (esp-timer callback routine),
|
||||||
* it should not do something that attempts to Block, such as calling vTaskDelay().
|
* it should not do something that attempts to Block, such as calling vTaskDelay().
|
||||||
*
|
*
|
||||||
|
@@ -347,7 +347,7 @@ static inline void button_dispatch(te_button_handle_t button_handle, touch_elem_
|
|||||||
} else if (dispatch_method == TOUCH_ELEM_DISP_CALLBACK) {
|
} else if (dispatch_method == TOUCH_ELEM_DISP_CALLBACK) {
|
||||||
touch_button_message_t button_info;
|
touch_button_message_t button_info;
|
||||||
button_info.event = button_handle->event;
|
button_info.event = button_handle->event;
|
||||||
button_handle->config->callback(button_handle, button_info, button_handle->config->arg); //Event callback
|
button_handle->config->callback(button_handle, &button_info, button_handle->config->arg); //Event callback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -404,7 +404,7 @@ static inline void matrix_dispatch(te_matrix_handle_t matrix_handle, touch_elem_
|
|||||||
matrix_info.event = matrix_handle->event;
|
matrix_info.event = matrix_handle->event;
|
||||||
matrix_info.position = matrix_handle->position;
|
matrix_info.position = matrix_handle->position;
|
||||||
void *arg = matrix_handle->config->arg;
|
void *arg = matrix_handle->config->arg;
|
||||||
matrix_handle->config->callback(matrix_handle, matrix_info, arg); //Event callback
|
matrix_handle->config->callback(matrix_handle, &matrix_info, arg); //Event callback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -406,7 +406,7 @@ static inline void slider_dispatch(te_slider_handle_t slider_handle, touch_elem_
|
|||||||
slider_info.event = slider_handle->event;
|
slider_info.event = slider_handle->event;
|
||||||
slider_info.position = slider_handle->position;
|
slider_info.position = slider_handle->position;
|
||||||
void *arg = slider_handle->config->arg;
|
void *arg = slider_handle->config->arg;
|
||||||
slider_handle->config->callback(slider_handle, slider_info, arg); //Event callback
|
slider_handle->config->callback(slider_handle, &slider_info, arg); //Event callback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -84,14 +84,14 @@ static void button_handler_task(void *arg)
|
|||||||
}
|
}
|
||||||
#elif CONFIG_TOUCH_ELEM_CALLBACK
|
#elif CONFIG_TOUCH_ELEM_CALLBACK
|
||||||
/* Button callback routine */
|
/* Button callback routine */
|
||||||
static void button_handler(touch_button_handle_t out_handle, touch_button_message_t out_message, void *arg)
|
static void button_handler(touch_button_handle_t out_handle, touch_button_message_t *out_message, void *arg)
|
||||||
{
|
{
|
||||||
(void) out_handle; //Unused
|
(void) out_handle; //Unused
|
||||||
if (out_message.event == TOUCH_BUTTON_EVT_ON_PRESS) {
|
if (out_message->event == TOUCH_BUTTON_EVT_ON_PRESS) {
|
||||||
ESP_LOGI(TAG, "Button[%d] Press", (uint32_t)arg);
|
ESP_LOGI(TAG, "Button[%d] Press", (uint32_t)arg);
|
||||||
} else if (out_message.event == TOUCH_BUTTON_EVT_ON_RELEASE) {
|
} else if (out_message->event == TOUCH_BUTTON_EVT_ON_RELEASE) {
|
||||||
ESP_LOGI(TAG, "Button[%d] Release", (uint32_t)arg);
|
ESP_LOGI(TAG, "Button[%d] Release", (uint32_t)arg);
|
||||||
} else if (out_message.event == TOUCH_BUTTON_EVT_ON_LONGPRESS) {
|
} else if (out_message->event == TOUCH_BUTTON_EVT_ON_LONGPRESS) {
|
||||||
ESP_LOGI(TAG, "Button[%d] LongPress", (uint32_t)arg);
|
ESP_LOGI(TAG, "Button[%d] LongPress", (uint32_t)arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -76,18 +76,18 @@ static void matrix_handler_task(void *arg)
|
|||||||
}
|
}
|
||||||
#elif CONFIG_TOUCH_ELEM_CALLBACK
|
#elif CONFIG_TOUCH_ELEM_CALLBACK
|
||||||
/* Matrix callback routine */
|
/* Matrix callback routine */
|
||||||
void matrix_handler(touch_matrix_handle_t out_handle, touch_matrix_message_t out_message, void *arg)
|
void matrix_handler(touch_matrix_handle_t out_handle, touch_matrix_message_t *out_message, void *arg)
|
||||||
{
|
{
|
||||||
(void) arg; //Unused
|
(void) arg; //Unused
|
||||||
if (out_handle != matrix_handle) {
|
if (out_handle != matrix_handle) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (out_message.event == TOUCH_MATRIX_EVT_ON_PRESS) {
|
if (out_message->event == TOUCH_MATRIX_EVT_ON_PRESS) {
|
||||||
ESP_LOGI(TAG, "Matrix Press, axis: (%d, %d) index: %d", out_message.position.x_axis, out_message.position.y_axis, out_message.position.index);
|
ESP_LOGI(TAG, "Matrix Press, axis: (%d, %d) index: %d", out_message->position.x_axis, out_message->position.y_axis, out_message->position.index);
|
||||||
} else if (out_message.event == TOUCH_MATRIX_EVT_ON_RELEASE) {
|
} else if (out_message->event == TOUCH_MATRIX_EVT_ON_RELEASE) {
|
||||||
ESP_LOGI(TAG, "Matrix Release, axis: (%d, %d) index: %d", out_message.position.x_axis, out_message.position.y_axis, out_message.position.index);
|
ESP_LOGI(TAG, "Matrix Release, axis: (%d, %d) index: %d", out_message->position.x_axis, out_message->position.y_axis, out_message->position.index);
|
||||||
} else if (out_message.event == TOUCH_MATRIX_EVT_ON_LONGPRESS) {
|
} else if (out_message->event == TOUCH_MATRIX_EVT_ON_LONGPRESS) {
|
||||||
ESP_LOGI(TAG, "Matrix LongPress, axis: (%d, %d) index: %d", out_message.position.x_axis, out_message.position.y_axis, out_message.position.index);
|
ESP_LOGI(TAG, "Matrix LongPress, axis: (%d, %d) index: %d", out_message->position.x_axis, out_message->position.y_axis, out_message->position.index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -70,18 +70,18 @@ static void slider_handler_task(void *arg)
|
|||||||
}
|
}
|
||||||
#elif CONFIG_TOUCH_ELEM_CALLBACK
|
#elif CONFIG_TOUCH_ELEM_CALLBACK
|
||||||
/* Slider callback routine */
|
/* Slider callback routine */
|
||||||
void slider_handler(touch_slider_handle_t out_handle, touch_slider_message_t out_message, void *arg)
|
void slider_handler(touch_slider_handle_t out_handle, touch_slider_message_t *out_message, void *arg)
|
||||||
{
|
{
|
||||||
(void) arg; //Unused
|
(void) arg; //Unused
|
||||||
if (out_handle != slider_handle) {
|
if (out_handle != slider_handle) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (out_message.event == TOUCH_SLIDER_EVT_ON_PRESS) {
|
if (out_message->event == TOUCH_SLIDER_EVT_ON_PRESS) {
|
||||||
ESP_LOGI(TAG, "Slider Press, position: %d", out_message.position);
|
ESP_LOGI(TAG, "Slider Press, position: %d", out_message->position);
|
||||||
} else if (out_message.event == TOUCH_SLIDER_EVT_ON_RELEASE) {
|
} else if (out_message->event == TOUCH_SLIDER_EVT_ON_RELEASE) {
|
||||||
ESP_LOGI(TAG, "Slider Release, position: %d", out_message.position);
|
ESP_LOGI(TAG, "Slider Release, position: %d", out_message->position);
|
||||||
} else if (out_message.event == TOUCH_SLIDER_EVT_ON_CALCULATION) {
|
} else if (out_message->event == TOUCH_SLIDER_EVT_ON_CALCULATION) {
|
||||||
ESP_LOGI(TAG, "Slider Calculate, position: %d", out_message.position);
|
ESP_LOGI(TAG, "Slider Calculate, position: %d", out_message->position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user