From 763b472958a42fa1ce2b54340181b0fa9291b325 Mon Sep 17 00:00:00 2001 From: wangyuanze Date: Wed, 24 Aug 2022 12:03:07 +0800 Subject: [PATCH] example: update format string in touch related examples --- .../touch_button/main/CMakeLists.txt | 1 - .../main/touch_button_example_main.c | 17 +++++++------- .../main/CMakeLists.txt | 1 - .../main/waterproof_example_main.c | 11 +++++----- .../main/CMakeLists.txt | 1 - .../main/touch_elements_example_main.c | 19 +++++++++------- .../touch_matrix/main/CMakeLists.txt | 1 - .../main/touch_matrix_example_main.c | 22 +++++++++++++------ .../touch_slider/main/CMakeLists.txt | 1 - .../main/touch_slider_example_main.c | 16 ++++++++------ .../touch_pad_interrupt/main/CMakeLists.txt | 1 - .../main/tp_interrupt_main.c | 3 ++- .../touch_pad_read/main/CMakeLists.txt | 1 - .../touch_pad_read/main/tp_read_main.c | 5 +++-- .../touch_pad_interrupt/main/CMakeLists.txt | 1 - .../main/tp_interrupt_main.c | 15 +++++++------ .../touch_pad_read/main/CMakeLists.txt | 1 - .../touch_pad_read/main/tp_read_main.c | 3 ++- 18 files changed, 65 insertions(+), 55 deletions(-) diff --git a/examples/peripherals/touch_sensor/touch_element/touch_button/main/CMakeLists.txt b/examples/peripherals/touch_sensor/touch_element/touch_button/main/CMakeLists.txt index 01c1423b223..64e4f4dd82a 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_button/main/CMakeLists.txt +++ b/examples/peripherals/touch_sensor/touch_element/touch_button/main/CMakeLists.txt @@ -1,4 +1,3 @@ idf_component_register(SRCS "touch_button_example_main.c" INCLUDE_DIRS "." PRIV_REQUIRES touch_element) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/peripherals/touch_sensor/touch_element/touch_button/main/touch_button_example_main.c b/examples/peripherals/touch_sensor/touch_element/touch_button/main/touch_button_example_main.c index 031106ab25c..1456c085712 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_button/main/touch_button_example_main.c +++ b/examples/peripherals/touch_sensor/touch_element/touch_button/main/touch_button_example_main.c @@ -66,11 +66,11 @@ static void button_handler_task(void *arg) /* Decode message */ const touch_button_message_t *button_message = touch_button_get_message(&element_message); if (button_message->event == TOUCH_BUTTON_EVT_ON_PRESS) { - ESP_LOGI(TAG, "Button[%d] Press", (uint32_t)element_message.arg); + ESP_LOGI(TAG, "Button[%d] Press", (int)element_message.arg); } else if (button_message->event == TOUCH_BUTTON_EVT_ON_RELEASE) { - ESP_LOGI(TAG, "Button[%d] Release", (uint32_t)element_message.arg); + ESP_LOGI(TAG, "Button[%d] Release", (int)element_message.arg); } else if (button_message->event == TOUCH_BUTTON_EVT_ON_LONGPRESS) { - ESP_LOGI(TAG, "Button[%d] LongPress", (uint32_t)element_message.arg); + ESP_LOGI(TAG, "Button[%d] LongPress", (int)element_message.arg); } } } @@ -80,11 +80,11 @@ static void button_handler(touch_button_handle_t out_handle, touch_button_messag { (void) out_handle; //Unused if (out_message->event == TOUCH_BUTTON_EVT_ON_PRESS) { - ESP_LOGI(TAG, "Button[%d] Press", (uint32_t)arg); + ESP_LOGI(TAG, "Button[%d] Press", (int)arg); } 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", (int)arg); } 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", (int)arg); } } #endif @@ -107,8 +107,9 @@ void app_main(void) /* Create Touch buttons */ ESP_ERROR_CHECK(touch_button_create(&button_config, &button_handle[i])); /* Subscribe touch button events (On Press, On Release, On LongPress) */ - ESP_ERROR_CHECK(touch_button_subscribe_event(button_handle[i], TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS, - (void *)channel_array[i])); + ESP_ERROR_CHECK(touch_button_subscribe_event(button_handle[i], + TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS, + (void *)channel_array[i])); #ifdef CONFIG_TOUCH_ELEM_EVENT /* Set EVENT as the dispatch method */ ESP_ERROR_CHECK(touch_button_set_dispatch_method(button_handle[i], TOUCH_ELEM_DISP_EVENT)); diff --git a/examples/peripherals/touch_sensor/touch_element/touch_element_waterproof/main/CMakeLists.txt b/examples/peripherals/touch_sensor/touch_element/touch_element_waterproof/main/CMakeLists.txt index 80a1673df57..df1acc5837a 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_element_waterproof/main/CMakeLists.txt +++ b/examples/peripherals/touch_sensor/touch_element/touch_element_waterproof/main/CMakeLists.txt @@ -1,4 +1,3 @@ idf_component_register(SRCS "waterproof_example_main.c" INCLUDE_DIRS "." PRIV_REQUIRES touch_element) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/peripherals/touch_sensor/touch_element/touch_element_waterproof/main/waterproof_example_main.c b/examples/peripherals/touch_sensor/touch_element/touch_element_waterproof/main/waterproof_example_main.c index 427d63cbbba..631670de8db 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_element_waterproof/main/waterproof_example_main.c +++ b/examples/peripherals/touch_sensor/touch_element/touch_element_waterproof/main/waterproof_example_main.c @@ -36,11 +36,11 @@ static void button_handler_task(void *arg) touch_element_message_receive(&element_message, portMAX_DELAY); //Block take const touch_button_message_t *button_message = touch_button_get_message(&element_message); if (button_message->event == TOUCH_BUTTON_EVT_ON_PRESS) { - ESP_LOGI(TAG, "Button[%d] Press", (uint32_t)element_message.arg); + ESP_LOGI(TAG, "Button[%d] Press", (int)element_message.arg); } else if (button_message->event == TOUCH_BUTTON_EVT_ON_RELEASE) { - ESP_LOGI(TAG, "Button[%d] Release", (uint32_t)element_message.arg); + ESP_LOGI(TAG, "Button[%d] Release", (int)element_message.arg); } else if (button_message->event == TOUCH_BUTTON_EVT_ON_LONGPRESS) { - ESP_LOGI(TAG, "Button[%d] LongPress", (uint32_t)element_message.arg); + ESP_LOGI(TAG, "Button[%d] LongPress", (int)element_message.arg); } } } @@ -74,8 +74,9 @@ void app_main(void) /* Create touch button */ ESP_ERROR_CHECK(touch_button_create(&button_config, &button_handle[i])); /* Subscribe touch button event(Press, Release, LongPress) */ - ESP_ERROR_CHECK(touch_button_subscribe_event(button_handle[i], TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS, - (void *)channel_array[i])); + ESP_ERROR_CHECK(touch_button_subscribe_event(button_handle[i], + TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS, + (void *)channel_array[i])); /* Button set dispatch method */ ESP_ERROR_CHECK(touch_button_set_dispatch_method(button_handle[i], TOUCH_ELEM_DISP_EVENT)); #ifdef CONFIG_TOUCH_WATERPROOF_GUARD_ENABLE diff --git a/examples/peripherals/touch_sensor/touch_element/touch_elements_combination/main/CMakeLists.txt b/examples/peripherals/touch_sensor/touch_element/touch_elements_combination/main/CMakeLists.txt index 4cfd621f1e5..a768337bd26 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_elements_combination/main/CMakeLists.txt +++ b/examples/peripherals/touch_sensor/touch_element/touch_elements_combination/main/CMakeLists.txt @@ -1,4 +1,3 @@ idf_component_register(SRCS "touch_elements_example_main.c" INCLUDE_DIRS "." PRIV_REQUIRES touch_element) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/peripherals/touch_sensor/touch_element/touch_elements_combination/main/touch_elements_example_main.c b/examples/peripherals/touch_sensor/touch_element/touch_elements_combination/main/touch_elements_example_main.c index 4e529a1a63e..7b8396527be 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_elements_combination/main/touch_elements_example_main.c +++ b/examples/peripherals/touch_sensor/touch_element/touch_elements_combination/main/touch_elements_example_main.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "touch_element/touch_button.h" @@ -53,11 +54,11 @@ static void button_handler(touch_elem_message_t element_message) { const touch_button_message_t *button_message = touch_button_get_message(&element_message); if (button_message->event == TOUCH_BUTTON_EVT_ON_PRESS) { - ESP_LOGI(TAG, "Button[%d] Press", (uint32_t)element_message.arg); + ESP_LOGI(TAG, "Button[%d] Press", (int)element_message.arg); } else if (button_message->event == TOUCH_BUTTON_EVT_ON_RELEASE) { - ESP_LOGI(TAG, "Button[%d] Release", (uint32_t)element_message.arg); + ESP_LOGI(TAG, "Button[%d] Release", (int)element_message.arg); } else if (button_message->event == TOUCH_BUTTON_EVT_ON_LONGPRESS) { - ESP_LOGI(TAG, "Button[%d] LongPress", (uint32_t)element_message.arg); + ESP_LOGI(TAG, "Button[%d] LongPress", (int)element_message.arg); } } @@ -65,11 +66,11 @@ static void slider_handler(touch_elem_message_t element_message) { const touch_slider_message_t *slider_message = touch_slider_get_message(&element_message); if (slider_message->event == TOUCH_SLIDER_EVT_ON_PRESS) { - ESP_LOGI(TAG, "Slider Press, position: %d", slider_message->position); + ESP_LOGI(TAG, "Slider Press, position: %"PRIu32, slider_message->position); } else if (slider_message->event == TOUCH_SLIDER_EVT_ON_RELEASE) { - ESP_LOGI(TAG, "Slider Release, position: %d", slider_message->position); + ESP_LOGI(TAG, "Slider Release, position: %"PRIu32, slider_message->position); } else if (slider_message->event == TOUCH_SLIDER_EVT_ON_CALCULATION) { - ESP_LOGI(TAG, "Slider Calculate, position: %d", slider_message->position); + ESP_LOGI(TAG, "Slider Calculate, position: %"PRIu32, slider_message->position); } } @@ -107,7 +108,8 @@ void button_example_init(void) /* Create Touch buttons */ ESP_ERROR_CHECK(touch_button_create(&button_config, &button_handle[i])); /* Subscribe touch button events (On Press, On Release, On LongPress) */ - ESP_ERROR_CHECK(touch_button_subscribe_event(button_handle[i], TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS, + ESP_ERROR_CHECK(touch_button_subscribe_event(button_handle[i], + TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS, (void *)button_channel_array[i])); /* Set EVENT as the dispatch method */ ESP_ERROR_CHECK(touch_button_set_dispatch_method(button_handle[i], TOUCH_ELEM_DISP_EVENT)); @@ -131,7 +133,8 @@ void slider_example_init(void) }; ESP_ERROR_CHECK(touch_slider_create(&slider_config, &slider_handle)); /* Subscribe touch slider events (On Press, On Release, On Calculation) */ - ESP_ERROR_CHECK(touch_slider_subscribe_event(slider_handle, TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_CALCULATION, NULL)); + ESP_ERROR_CHECK(touch_slider_subscribe_event(slider_handle, + TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_CALCULATION, NULL)); /* Set EVENT as the dispatch method */ ESP_ERROR_CHECK(touch_slider_set_dispatch_method(slider_handle, TOUCH_ELEM_DISP_EVENT)); ESP_LOGI(TAG, "Touch slider created"); diff --git a/examples/peripherals/touch_sensor/touch_element/touch_matrix/main/CMakeLists.txt b/examples/peripherals/touch_sensor/touch_element/touch_matrix/main/CMakeLists.txt index 69b1052aeb9..ca3814e9f0d 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_matrix/main/CMakeLists.txt +++ b/examples/peripherals/touch_sensor/touch_element/touch_matrix/main/CMakeLists.txt @@ -1,4 +1,3 @@ idf_component_register(SRCS "touch_matrix_example_main.c" INCLUDE_DIRS "." PRIV_REQUIRES touch_element) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/peripherals/touch_sensor/touch_element/touch_matrix/main/touch_matrix_example_main.c b/examples/peripherals/touch_sensor/touch_element/touch_matrix/main/touch_matrix_example_main.c index 0ba483dc5a3..de6c0921601 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_matrix/main/touch_matrix_example_main.c +++ b/examples/peripherals/touch_sensor/touch_element/touch_matrix/main/touch_matrix_example_main.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "touch_element/touch_matrix.h" @@ -58,11 +59,14 @@ static void matrix_handler_task(void *arg) /* Decode message */ const touch_matrix_message_t *matrix_message = touch_matrix_get_message(&element_message); if (matrix_message->event == TOUCH_MATRIX_EVT_ON_PRESS) { - ESP_LOGI(TAG, "Matrix Press, axis: (%d, %d) index: %d", matrix_message->position.x_axis, matrix_message->position.y_axis, matrix_message->position.index); + ESP_LOGI(TAG, "Matrix Press, axis: (%"PRIu8", %"PRIu8") index: %"PRIu8, matrix_message->position.x_axis, + matrix_message->position.y_axis, matrix_message->position.index); } else if (matrix_message->event == TOUCH_MATRIX_EVT_ON_RELEASE) { - ESP_LOGI(TAG, "Matrix Release, axis: (%d, %d) index: %d", matrix_message->position.x_axis, matrix_message->position.y_axis, matrix_message->position.index); + ESP_LOGI(TAG, "Matrix Release, axis: (%"PRIu8", %"PRIu8") index: %"PRIu8, matrix_message->position.x_axis, + matrix_message->position.y_axis, matrix_message->position.index); } else if (matrix_message->event == TOUCH_MATRIX_EVT_ON_LONGPRESS) { - ESP_LOGI(TAG, "Matrix LongPress, axis: (%d, %d) index: %d", matrix_message->position.x_axis, matrix_message->position.y_axis, matrix_message->position.index); + ESP_LOGI(TAG, "Matrix LongPress, axis: (%"PRIu8", %"PRIu8") index: %"PRIu8, matrix_message->position.x_axis, + matrix_message->position.y_axis, matrix_message->position.index); } } } @@ -75,11 +79,14 @@ void matrix_handler(touch_matrix_handle_t out_handle, touch_matrix_message_t *ou return; } 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: (%"PRIu8", %"PRIu8") index: %"PRIu8, out_message->position.x_axis, + out_message->position.y_axis, out_message->position.index); } 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: (%"PRIu8", %"PRIu8") index: %"PRIu8, out_message->position.x_axis, + out_message->position.y_axis, out_message->position.index); } 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: (%"PRIu8", %"PRIu8") index: %"PRIu8, out_message->position.x_axis, + out_message->position.y_axis, out_message->position.index); } } #endif @@ -105,7 +112,8 @@ void app_main(void) }; ESP_ERROR_CHECK(touch_matrix_create(&matrix_config, &matrix_handle)); /* Subscribe touch matrix events (On Press, On Release, On LongPress) */ - ESP_ERROR_CHECK(touch_matrix_subscribe_event(matrix_handle, TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS, NULL)); + ESP_ERROR_CHECK(touch_matrix_subscribe_event(matrix_handle, + TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS, NULL)); #ifdef CONFIG_TOUCH_ELEM_EVENT /* Set EVENT as the dispatch method */ ESP_ERROR_CHECK(touch_matrix_set_dispatch_method(matrix_handle, TOUCH_ELEM_DISP_EVENT)); diff --git a/examples/peripherals/touch_sensor/touch_element/touch_slider/main/CMakeLists.txt b/examples/peripherals/touch_sensor/touch_element/touch_slider/main/CMakeLists.txt index 3a69d86adf2..8742ecf28ce 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_slider/main/CMakeLists.txt +++ b/examples/peripherals/touch_sensor/touch_element/touch_slider/main/CMakeLists.txt @@ -1,4 +1,3 @@ idf_component_register(SRCS "touch_slider_example_main.c" INCLUDE_DIRS "." PRIV_REQUIRES touch_element) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/peripherals/touch_sensor/touch_element/touch_slider/main/touch_slider_example_main.c b/examples/peripherals/touch_sensor/touch_element/touch_slider/main/touch_slider_example_main.c index 3ae4eb7f932..4df27f28825 100644 --- a/examples/peripherals/touch_sensor/touch_element/touch_slider/main/touch_slider_example_main.c +++ b/examples/peripherals/touch_sensor/touch_element/touch_slider/main/touch_slider_example_main.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: CC0-1.0 */ +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "touch_element/touch_slider.h" @@ -51,11 +52,11 @@ static void slider_handler_task(void *arg) /* Decode message */ const touch_slider_message_t *slider_message = touch_slider_get_message(&element_message); if (slider_message->event == TOUCH_SLIDER_EVT_ON_PRESS) { - ESP_LOGI(TAG, "Slider Press, position: %d", slider_message->position); + ESP_LOGI(TAG, "Slider Press, position: %"PRIu32, slider_message->position); } else if (slider_message->event == TOUCH_SLIDER_EVT_ON_RELEASE) { - ESP_LOGI(TAG, "Slider Release, position: %d", slider_message->position); + ESP_LOGI(TAG, "Slider Release, position: %"PRIu32, slider_message->position); } else if (slider_message->event == TOUCH_SLIDER_EVT_ON_CALCULATION) { - ESP_LOGI(TAG, "Slider Calculate, position: %d", slider_message->position); + ESP_LOGI(TAG, "Slider Calculate, position: %"PRIu32, slider_message->position); } } } @@ -69,11 +70,11 @@ void slider_handler(touch_slider_handle_t out_handle, touch_slider_message_t *ou return; } 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: %"PRIu32, out_message->position); } 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: %"PRIu32, out_message->position); } 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: %"PRIu32, out_message->position); } } #endif @@ -97,7 +98,8 @@ void app_main(void) }; ESP_ERROR_CHECK(touch_slider_create(&slider_config, &slider_handle)); /* Subscribe touch slider events (On Press, On Release, On Calculation) */ - ESP_ERROR_CHECK(touch_slider_subscribe_event(slider_handle, TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_CALCULATION, NULL)); + ESP_ERROR_CHECK(touch_slider_subscribe_event(slider_handle, + TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_CALCULATION, NULL)); #ifdef CONFIG_TOUCH_ELEM_EVENT /* Set EVENT as the dispatch method */ ESP_ERROR_CHECK(touch_slider_set_dispatch_method(slider_handle, TOUCH_ELEM_DISP_EVENT)); diff --git a/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_interrupt/main/CMakeLists.txt b/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_interrupt/main/CMakeLists.txt index 43bd93bcf49..94fac9872e9 100644 --- a/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_interrupt/main/CMakeLists.txt +++ b/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_interrupt/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "tp_interrupt_main.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_interrupt/main/tp_interrupt_main.c b/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_interrupt/main/tp_interrupt_main.c index 22fb8f45150..58e3da4f9d7 100644 --- a/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_interrupt/main/tp_interrupt_main.c +++ b/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_interrupt/main/tp_interrupt_main.c @@ -5,6 +5,7 @@ */ #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/queue.h" @@ -93,7 +94,7 @@ static void tp_example_read_task(void *pvParameter) touch_pad_read_filtered(i, &value); if (value < s_pad_init_val[i] * TOUCH_THRESH_PERCENT / 100) { ESP_LOGI(TAG, "T%d activated!", i); - ESP_LOGI(TAG, "value: %d; init val: %d", value, s_pad_init_val[i]); + ESP_LOGI(TAG, "value: %"PRIu16"; init val: %"PRIu32, value, s_pad_init_val[i]); vTaskDelay(200 / portTICK_PERIOD_MS); // Reset the counter to stop changing mode. change_mode = 1; diff --git a/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_read/main/CMakeLists.txt b/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_read/main/CMakeLists.txt index 9454ca36501..2b9a209ec42 100644 --- a/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_read/main/CMakeLists.txt +++ b/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_read/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "tp_read_main.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_read/main/tp_read_main.c b/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_read/main/tp_read_main.c index b6056210721..59ba5955e3c 100644 --- a/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_read/main/tp_read_main.c +++ b/examples/peripherals/touch_sensor/touch_sensor_v1/touch_pad_read/main/tp_read_main.c @@ -5,6 +5,7 @@ */ #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/touch_pad.h" @@ -33,10 +34,10 @@ static void tp_example_read_task(void *pvParameter) // If open the filter mode, please use this API to get the touch pad count. touch_pad_read_raw_data(i, &touch_value); touch_pad_read_filtered(i, &touch_filter_value); - printf("T%d:[%4d,%4d] ", i, touch_value, touch_filter_value); + printf("T%d:[%4"PRIu16",%4"PRIu16"] ", i, touch_value, touch_filter_value); #else touch_pad_read(i, &touch_value); - printf("T%d:[%4d] ", i, touch_value); + printf("T%d:[%4"PRIu16"] ", i, touch_value); #endif } printf("\n"); diff --git a/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_interrupt/main/CMakeLists.txt b/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_interrupt/main/CMakeLists.txt index 43bd93bcf49..94fac9872e9 100644 --- a/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_interrupt/main/CMakeLists.txt +++ b/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_interrupt/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "tp_interrupt_main.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_interrupt/main/tp_interrupt_main.c b/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_interrupt/main/tp_interrupt_main.c index 1285558143f..a852a069e0a 100644 --- a/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_interrupt/main/tp_interrupt_main.c +++ b/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_interrupt/main/tp_interrupt_main.c @@ -5,6 +5,7 @@ */ #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/queue.h" @@ -76,7 +77,7 @@ static void tp_example_set_thresholds(void) touch_pad_read_benchmark(button[i], &touch_value); //set interrupt threshold. touch_pad_set_thresh(button[i], touch_value * button_threshold[i]); - ESP_LOGI(TAG, "touch pad [%d] base %d, thresh %d", \ + ESP_LOGI(TAG, "touch pad [%d] base %"PRIu32", thresh %"PRIu32, \ button[i], touch_value, (uint32_t)(touch_value * button_threshold[i])); } } @@ -113,10 +114,10 @@ static void tp_example_read_task(void *pvParameter) /* if guard pad be touched, other pads no response. */ if (evt.pad_num == button[3]) { guard_mode_flag = 1; - ESP_LOGW(TAG, "TouchSensor [%d] be activated, enter guard mode", evt.pad_num); + ESP_LOGW(TAG, "TouchSensor [%"PRIu32"] be activated, enter guard mode", evt.pad_num); } else { if (guard_mode_flag == 0) { - ESP_LOGI(TAG, "TouchSensor [%d] be activated, status mask 0x%x", evt.pad_num, evt.pad_status); + ESP_LOGI(TAG, "TouchSensor [%"PRIu32"] be activated, status mask 0x%"PRIu32"", evt.pad_num, evt.pad_status); } else { ESP_LOGW(TAG, "In guard mode. No response"); } @@ -126,19 +127,19 @@ static void tp_example_read_task(void *pvParameter) /* if guard pad be touched, other pads no response. */ if (evt.pad_num == button[3]) { guard_mode_flag = 0; - ESP_LOGW(TAG, "TouchSensor [%d] be inactivated, exit guard mode", evt.pad_num); + ESP_LOGW(TAG, "TouchSensor [%"PRIu32"] be inactivated, exit guard mode", evt.pad_num); } else { if (guard_mode_flag == 0) { - ESP_LOGI(TAG, "TouchSensor [%d] be inactivated, status mask 0x%x", evt.pad_num, evt.pad_status); + ESP_LOGI(TAG, "TouchSensor [%"PRIu32"] be inactivated, status mask 0x%"PRIu32, evt.pad_num, evt.pad_status); } } } if (evt.intr_mask & TOUCH_PAD_INTR_MASK_SCAN_DONE) { - ESP_LOGI(TAG, "The touch sensor group measurement is done [%d].", evt.pad_num); + ESP_LOGI(TAG, "The touch sensor group measurement is done [%"PRIu32"].", evt.pad_num); } if (evt.intr_mask & TOUCH_PAD_INTR_MASK_TIMEOUT) { /* Add your exception handling in here. */ - ESP_LOGI(TAG, "Touch sensor channel %d measure timeout. Skip this exception channel!!", evt.pad_num); + ESP_LOGI(TAG, "Touch sensor channel %"PRIu32" measure timeout. Skip this exception channel!!", evt.pad_num); touch_pad_timeout_resume(); // Point on the next channel to measure. } } diff --git a/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read/main/CMakeLists.txt b/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read/main/CMakeLists.txt index 9454ca36501..2b9a209ec42 100644 --- a/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read/main/CMakeLists.txt +++ b/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "tp_read_main.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read/main/tp_read_main.c b/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read/main/tp_read_main.c index 83d5eee05ea..c082d9e6b3d 100644 --- a/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read/main/tp_read_main.c +++ b/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read/main/tp_read_main.c @@ -5,6 +5,7 @@ */ #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/touch_pad.h" @@ -46,7 +47,7 @@ static void tp_example_read_task(void *pvParameter) while (1) { for (int i = 0; i < TOUCH_BUTTON_NUM; i++) { touch_pad_read_raw_data(button[i], &touch_value); // read raw data. - printf("T%d: [%4d] ", button[i], touch_value); + printf("T%d: [%4"PRIu32"] ", button[i], touch_value); } printf("\n"); vTaskDelay(200 / portTICK_PERIOD_MS);