BLE HID Keyboard example for Delta BLE platform
Fork of BLE_HeartRate_DELTA by
This example demonstrates the HID over GATT profile for keyboard.
1. Running this application on Delta BLE platform 2. To connect and pair with device named "HID_Keyboard" in your mobile (iOS/Android) Settings>Bluetooth page 3. Open a text editing application on your mobile phone 4. On the PC, open the terminal tool (Putty or TeraTerm) and choose the correct COM/BaudRate 5. Enter any character from your PC, and it will be displayed in your mobile phone
HIDService.cpp@1:8bca989a70be, 2017-02-07 (annotated)
- Committer:
- silviaChen
- Date:
- Tue Feb 07 02:51:56 2017 +0000
- Revision:
- 1:8bca989a70be
BLE HID Keyboard demo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
silviaChen | 1:8bca989a70be | 1 | #include "HIDService.h" |
silviaChen | 1:8bca989a70be | 2 | |
silviaChen | 1:8bca989a70be | 3 | const uint8_t KeyboardReportMap[] = |
silviaChen | 1:8bca989a70be | 4 | { 0x05, 0x01, // Usage Page (Generic Desktop) |
silviaChen | 1:8bca989a70be | 5 | 0x09, 0x06, // Usage (Keyboard) |
silviaChen | 1:8bca989a70be | 6 | 0xA1, 0x01, // Collection (Application) |
silviaChen | 1:8bca989a70be | 7 | 0x05, 0x07, // Usage Page (Key Codes) |
silviaChen | 1:8bca989a70be | 8 | 0x19, 0xe0, // Usage Minimum (224) |
silviaChen | 1:8bca989a70be | 9 | 0x29, 0xe7, // Usage Maximum (231) |
silviaChen | 1:8bca989a70be | 10 | 0x15, 0x00, // Logicagl Minimum (0) |
silviaChen | 1:8bca989a70be | 11 | 0x25, 0x01, // Logical Maximum (1) |
silviaChen | 1:8bca989a70be | 12 | 0x75, 0x01, // Report Size (1) |
silviaChen | 1:8bca989a70be | 13 | 0x95, 0x08, // Report Count (8) |
silviaChen | 1:8bca989a70be | 14 | 0x81, 0x02, // Input (Data, Variable, Absolute) |
silviaChen | 1:8bca989a70be | 15 | |
silviaChen | 1:8bca989a70be | 16 | 0x95, 0x01, // Report Count (1) |
silviaChen | 1:8bca989a70be | 17 | 0x75, 0x08, // Report Size (8) |
silviaChen | 1:8bca989a70be | 18 | 0x81, 0x01, // Input (Constant) reserved byte(1) |
silviaChen | 1:8bca989a70be | 19 | |
silviaChen | 1:8bca989a70be | 20 | 0x95, 0x05, // Report Count (5) |
silviaChen | 1:8bca989a70be | 21 | 0x75, 0x01, // Report Size (1) |
silviaChen | 1:8bca989a70be | 22 | 0x05, 0x08, // Usage Page (Page# for LEDs) |
silviaChen | 1:8bca989a70be | 23 | 0x19, 0x01, // Usage Minimum (1) |
silviaChen | 1:8bca989a70be | 24 | 0x29, 0x05, // Usage Maximum (5) |
silviaChen | 1:8bca989a70be | 25 | 0x91, 0x02, // Output (Data, Variable, Absolute), Led report |
silviaChen | 1:8bca989a70be | 26 | 0x95, 0x01, // Report Count (1) |
silviaChen | 1:8bca989a70be | 27 | 0x75, 0x03, // Report Size (3) |
silviaChen | 1:8bca989a70be | 28 | 0x91, 0x01, // Output (Data, Variable, Absolute), Led report padding |
silviaChen | 1:8bca989a70be | 29 | |
silviaChen | 1:8bca989a70be | 30 | 0x95, 0x06, // Report Count (6) |
silviaChen | 1:8bca989a70be | 31 | 0x75, 0x08, // Report Size (8) |
silviaChen | 1:8bca989a70be | 32 | 0x15, 0x00, // Logical Minimum (0) |
silviaChen | 1:8bca989a70be | 33 | 0x25, 0x65, // Logical Maximum (101) |
silviaChen | 1:8bca989a70be | 34 | 0x05, 0x07, // Usage Page (Key codes) |
silviaChen | 1:8bca989a70be | 35 | 0x19, 0x00, // Usage Minimum (0) |
silviaChen | 1:8bca989a70be | 36 | 0x29, 0x65, // Usage Maximum (101) |
silviaChen | 1:8bca989a70be | 37 | 0x81, 0x00, // Input (Data, Array) Key array(6 bytes) |
silviaChen | 1:8bca989a70be | 38 | |
silviaChen | 1:8bca989a70be | 39 | 0x09, 0x05, // Usage (Vendor Defined) |
silviaChen | 1:8bca989a70be | 40 | 0x15, 0x00, // Logical Minimum (0) |
silviaChen | 1:8bca989a70be | 41 | 0x26, 0xFF, 0x00, // Logical Maximum (255) |
silviaChen | 1:8bca989a70be | 42 | 0x75, 0x08, // Report Count (2) |
silviaChen | 1:8bca989a70be | 43 | 0x95, 0x02, // Report Size (8 bit) |
silviaChen | 1:8bca989a70be | 44 | 0xB1, 0x02, // Feature (Data, Variable, Absolute) |
silviaChen | 1:8bca989a70be | 45 | 0xC0 // End Collection (Application) |
silviaChen | 1:8bca989a70be | 46 | }; |