From 08087f754e08beec4c79d98cd89da386421f883e Mon Sep 17 00:00:00 2001 From: mjcross Date: Tue, 2 Mar 2021 12:39:55 +0000 Subject: [PATCH 1/6] Explain the need to enable BT and BTDM BLE in SDK If users may try to use this (excellent) example code in their own projects, without understanding the need to enable the BT stack and BTDM settings in the SDK. If they do that then their builds will fail with linker errors but they may not understand why. --- examples/provisioning/wifi_prov_mgr/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/provisioning/wifi_prov_mgr/README.md b/examples/provisioning/wifi_prov_mgr/README.md index f7fee43b53..8ca5845977 100644 --- a/examples/provisioning/wifi_prov_mgr/README.md +++ b/examples/provisioning/wifi_prov_mgr/README.md @@ -22,6 +22,8 @@ Right after provisioning is complete, BLE is turned off and disabled to free the This example can be used, as it is, for adding a provisioning service to any application intended for IoT. +> Note: If you use this example code in your own project, in BLE mode, then remember to enable the BT stack and BTDM BLE control settings in your SDK configuration (e.g. by using the `sdkconfig.defaults` file from this project). + ## How to use example ### Hardware Required From 0ce4d3f9f7f2da94935e2833ae5e62e66cbc86a7 Mon Sep 17 00:00:00 2001 From: mjcross Date: Tue, 2 Mar 2021 12:48:35 +0000 Subject: [PATCH 2/6] examples/provisioning: add comment about linker errors If the user copies the BLE example to their own project without understanding the need to enable the BT stack or BTDM BLE settings in the SDK then their build will probably fail at this line due to linker errors. Closes https://github.com/espressif/esp-idf/pull/6652 Closes IDFGH-4854 --- examples/provisioning/wifi_prov_mgr/main/app_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/provisioning/wifi_prov_mgr/main/app_main.c b/examples/provisioning/wifi_prov_mgr/main/app_main.c index a428f509fa..06b65d8b06 100644 --- a/examples/provisioning/wifi_prov_mgr/main/app_main.c +++ b/examples/provisioning/wifi_prov_mgr/main/app_main.c @@ -271,6 +271,10 @@ void app_main(void) 0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf, 0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02, }; + + /* If your build fails with linker errors at this point, then you may have + * forgotten to enable the BT stack or BTDM BLE settings in the SDK (e.g. see + * the sdkconfig.defaults in the example project) */ wifi_prov_scheme_ble_set_service_uuid(custom_service_uuid); #endif /* CONFIG_EXAMPLE_PROV_TRANSPORT_BLE */ From 7d07efb7b51723ceecc0c5602efe88027961f77c Mon Sep 17 00:00:00 2001 From: Roman Alexeev Date: Fri, 29 Jan 2021 18:51:29 +0300 Subject: [PATCH 3/6] Fixed a missed last argument (void *__arg) for pthread_create Closes https://github.com/espressif/esp-idf/pull/6479 Close IDFGH-4666 --- docs/en/api-reference/system/esp_pthread.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/api-reference/system/esp_pthread.rst b/docs/en/api-reference/system/esp_pthread.rst index afe415db43..5f8ea78412 100644 --- a/docs/en/api-reference/system/esp_pthread.rst +++ b/docs/en/api-reference/system/esp_pthread.rst @@ -29,7 +29,7 @@ Example to tune the stack size of the pthread: cfg.stack_size = (4 * 1024); esp_pthread_set_cfg(&cfg); - pthread_create(&t1, NULL, thread_func); + pthread_create(&t1, NULL, thread_func, NULL); } The API can also be used for inheriting the settings across threads. For example: @@ -48,7 +48,7 @@ The API can also be used for inheriting the settings across threads. For example { printf("In my_thread1\n"); pthread_t t2; - pthread_create(&t2, NULL, my_thread2); + pthread_create(&t2, NULL, my_thread2, NULL); return NULL; } @@ -62,7 +62,7 @@ The API can also be used for inheriting the settings across threads. For example cfg.inherit_cfg = true; esp_pthread_set_cfg(&cfg); - pthread_create(&t1, NULL, my_thread1); + pthread_create(&t1, NULL, my_thread1, NULL); } API Reference From 8f064dabcdd4f8d27741fd847d5c18a512706f43 Mon Sep 17 00:00:00 2001 From: Jon Sailor Date: Fri, 22 Jan 2021 19:00:40 -0500 Subject: [PATCH 4/6] tinyusb: add 'extern C' bit to tusb_console.h Public headers need the "if __cplusplus, extern C" boilerplate. Otherwise, C++ sources which include the header will look for a name-mangled symbol and fail at link time. Closes https://github.com/espressif/esp-idf/pull/6455 Closes IDFGH-4641 --- components/tinyusb/additions/include/tusb_console.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/tinyusb/additions/include/tusb_console.h b/components/tinyusb/additions/include/tusb_console.h index f7304eea31..530221dc6f 100644 --- a/components/tinyusb/additions/include/tusb_console.h +++ b/components/tinyusb/additions/include/tusb_console.h @@ -14,6 +14,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #include "esp_err.h" /** @@ -31,3 +35,7 @@ esp_err_t esp_tusb_init_console(int cdc_intf); * @return esp_err_t */ esp_err_t esp_tusb_deinit_console(int cdc_intf); + +#ifdef __cplusplus +} +#endif From 77922a24c3bfc85786fd0c9f3364fc8294f49069 Mon Sep 17 00:00:00 2001 From: Valeri Date: Mon, 24 Aug 2020 01:26:08 +0300 Subject: [PATCH 5/6] esp_hid: add missing static qualifier Closes https://github.com/espressif/esp-idf/pull/5778 Closes IDFGH-3877 --- components/esp_hid/src/esp_hid_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_hid/src/esp_hid_common.c b/components/esp_hid/src/esp_hid_common.c index 5bdc294f0b..9d1f4167f4 100644 --- a/components/esp_hid/src/esp_hid_common.c +++ b/components/esp_hid/src/esp_hid_common.c @@ -19,7 +19,7 @@ #if (CONFIG_GATTS_ENABLE || CONFIG_GATTC_ENABLE) #include "esp_gatt_defs.h" #endif -const char *TAG = "hid_parser"; +static const char *TAG = "hid_parser"; typedef struct { uint16_t appearance; From 1da8dd581602e037fd8577d3ff6808acc8c4c4ba Mon Sep 17 00:00:00 2001 From: Erohal <53895652+Erohal@users.noreply.github.com> Date: Sat, 10 Oct 2020 21:58:06 +0800 Subject: [PATCH 6/6] Update Gatt_Client_Example_Walkthrough.md Closes https://github.com/espressif/esp-idf/pull/5961 Closes IDFGH-4090 --- .../ble/gatt_client/tutorial/Gatt_Client_Example_Walkthrough.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bluetooth/bluedroid/ble/gatt_client/tutorial/Gatt_Client_Example_Walkthrough.md b/examples/bluetooth/bluedroid/ble/gatt_client/tutorial/Gatt_Client_Example_Walkthrough.md index 26a639b8a0..68acc482b9 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_client/tutorial/Gatt_Client_Example_Walkthrough.md +++ b/examples/bluetooth/bluedroid/ble/gatt_client/tutorial/Gatt_Client_Example_Walkthrough.md @@ -437,7 +437,7 @@ esp_log_buffer_hex(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, sizeof(esp_bd_addr_t)); ``` -The typical MTU size for a Bluetooth 4.0 connection is 23 bytes. A client can change the size of MUT, using `esp_ble_gattc_send_mtu_req()` function, which takes the GATT interface and the connection ID. The size of the requested MTU is defined by `esp_ble_gatt_set_local_mtu()`. The server can then accept or reject the request. The ESP32 supports a MTU size of up to 517 bytes, which is defined by the `ESP_GATT_MAX_MTU_SIZE` in `esp_gattc_api.h`. In this example, the MTU size is set to 500 bytes. In case the configuration fails, the returned error is printed: +The typical MTU size for a Bluetooth 4.0 connection is 23 bytes. A client can change the size of MTU, using `esp_ble_gattc_send_mtu_req()` function, which takes the GATT interface and the connection ID. The size of the requested MTU is defined by `esp_ble_gatt_set_local_mtu()`. The server can then accept or reject the request. The ESP32 supports a MTU size of up to 517 bytes, which is defined by the `ESP_GATT_MAX_MTU_SIZE` in `esp_gattc_api.h`. In this example, the MTU size is set to 500 bytes. In case the configuration fails, the returned error is printed: ```c esp_err_t mtu_ret = esp_ble_gattc_send_mtu_req (gattc_if, conn_id);