mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
example/hid: Added the readme file.
This commit is contained in:
parent
efb747d167
commit
eb9d0315e5
31
examples/bluetooth/ble_hid_device_demo/README.md
Normal file
31
examples/bluetooth/ble_hid_device_demo/README.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
ESP-IDF BLE HID device demo
|
||||||
|
========================
|
||||||
|
This example Implemented BLE HID device profile related functions, in which the HID device has
|
||||||
|
4 Reports (1 is mouse, 2 is keyboard and LED, 3 is Consumer Devices, 4 is Vendor devices).
|
||||||
|
Users can choose different reports according to their own application scenarios.
|
||||||
|
BLE HID profile inheritance and USB HID class.
|
||||||
|
|
||||||
|
ble_hidd_demo_main.c
|
||||||
|
==========================
|
||||||
|
This 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
|
||||||
|
volume++ or volume-- etc., or connected to the Windows 10 PC act as a keyboard or mouse)
|
||||||
|
|
||||||
|
hidd_le_prf_int.h
|
||||||
|
==========================
|
||||||
|
This header file includes some HID profile related definitions.
|
||||||
|
|
||||||
|
esp_hidd_prf_api.h & esp_hidd_prf_api.c
|
||||||
|
===========================================
|
||||||
|
These files contains the the api of the HID profile
|
||||||
|
|
||||||
|
When 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.
|
||||||
|
|
||||||
|
hid_dev.h & hid_dev.c
|
||||||
|
======================
|
||||||
|
These file define the HID spec related definitions
|
||||||
|
|
||||||
|
hid_device_le_prf.c
|
||||||
|
======================
|
||||||
|
This file is the HID profile definition file, it include the main function of the HID profile.
|
||||||
|
It mainly includes how to create HID service. If you send and receive HID data and convert the data to keyboard keys,
|
||||||
|
the mouse and consumer values are forwarded to the application.
|
@ -233,14 +233,14 @@ void hid_demo_task(void *pvParameters)
|
|||||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
if (sec_conn) {
|
if (sec_conn) {
|
||||||
LOG_ERROR("Send the volume");
|
LOG_ERROR("Send the volume");
|
||||||
//send_volum_up = true;
|
send_volum_up = true;
|
||||||
uint8_t key_vaule = {HID_KEY_A};
|
//uint8_t key_vaule = {HID_KEY_A};
|
||||||
esp_hidd_send_keyboard_value(hid_conn_id, 0, &key_vaule, 1);
|
//esp_hidd_send_keyboard_value(hid_conn_id, 0, &key_vaule, 1);
|
||||||
//esp_hidd_send_consumer_value(hid_conn_id, HID_CONSUMER_VOLUME_UP, true);
|
esp_hidd_send_consumer_value(hid_conn_id, HID_CONSUMER_VOLUME_UP, true);
|
||||||
vTaskDelay(3000 / portTICK_PERIOD_MS);
|
vTaskDelay(3000 / portTICK_PERIOD_MS);
|
||||||
if (send_volum_up) {
|
if (send_volum_up) {
|
||||||
send_volum_up = false;
|
send_volum_up = false;
|
||||||
//esp_hidd_send_consumer_value(hid_conn_id, HID_CONSUMER_VOLUME_UP, false);
|
esp_hidd_send_consumer_value(hid_conn_id, HID_CONSUMER_VOLUME_UP, false);
|
||||||
esp_hidd_send_consumer_value(hid_conn_id, HID_CONSUMER_VOLUME_DOWN, true);
|
esp_hidd_send_consumer_value(hid_conn_id, HID_CONSUMER_VOLUME_DOWN, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user