1| Supported Targets | ESP32 | ESP32-C3 | 2| ----------------- | ----- | -------- | 3 4# ESP-IDF BLE HID Example 5 6This example implement a BLE HID device profile related functions, in which the HID device has 4 Reports: 7 81. Mouse 92. Keyboard and LED 103. Consumer Devices 114. Vendor devices 12 13Users can choose different reports according to their own application scenarios. 14BLE HID profile inheritance and USB HID class. 15 16## How to Use Example 17 18Before project configuration and build, be sure to set the correct chip target using: 19 20```bash 21idf.py set-target <chip_name> 22``` 23 24### Hardware Required 25 26* A development board with ESP32/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.) 27* A USB cable for Power supply and programming 28 29See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it. 30 31### Configure the Project 32 33* `ble_hidd_demo_main.c` 34This file is the demo to show how to used the HID(you can used it to connected to the smart phone act as the consumer device then can used the button to 35volume++ or volume-- etc., or connected to the Windows 10 PC act as a keyboard or mouse) 36 37* `hidd_le_prf_int.h` 38This header file includes some HID profile related definitions. 39 40* `esp_hidd_prf_api.h` & `esp_hidd_prf_api.c` 41These files contains the the api of the HID profile 42When you used the HID profile, you just need to added the esp_hidd_prf_api.h includes file and send the HID data used the function defined in the esp_hidd_prf_api.c file. 43 44* `hid_dev.h & hid_dev.c` 45These file define the HID spec related definitions 46 47* `hid_device_le_prf.c` 48This file is the HID profile definition file, it include the main function of the HID profile. 49It mainly includes how to create HID service. If you send and receive HID data and convert the data to keyboard keys, 50the mouse and consumer values are forwarded to the application. 51 52### Build and Flash 53 54Run `idf.py -p PORT flash monitor` to build, flash and monitor the project. 55 56(To exit the serial monitor, type ``Ctrl-]``.) 57 58See the [Getting Started Guide](https://idf.espressif.com/) for full steps to configure and use ESP-IDF to build projects. 59 60## Example Output 61 62``` 63I (0) cpu_start: Starting scheduler on APP CPU. 64I (584) BTDM_INIT: BT controller compile version [1342a48] 65I (584) system_api: Base MAC address is not set 66I (584) system_api: read default base MAC address from EFUSE 67I (594) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07 68I (1024) HID_LE_PRF: esp_hidd_prf_cb_hdl(), start added the hid service to the stack database. incl_handle = 40 69I (1034) HID_LE_PRF: hid svc handle = 2d 70I (5964) HID_LE_PRF: HID connection establish, conn_id = 0 71I (5964) HID_DEMO: ESP_HIDD_EVENT_BLE_CONNECT 72I (6744) HID_DEMO: remote BD_ADDR: 7767f4abe386 73I (6744) HID_DEMO: address type = 1 74I (6744) HID_DEMO: pair status = success 75I (8024) HID_DEMO: Send the volume 76I (16024) HID_DEMO: Send the volume 77I (24024) HID_DEMO: Send the volume 78I (27784) HID_DEMO: ESP_HIDD_EVENT_BLE_DISCONNECT 79``` 80 81## Troubleshooting 82 83For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon. 84