AndroidにキーボードとしてBLEモジュールを認識させて、ショートカットを叩けます。 ショートカットキー btn1:Alt + Tab btn2: Enter
Dependencies: BLE_API mbed nRF51822
HIDService.cpp@0:f9f11f6ee09d, 2015-09-15 (annotated)
- Committer:
- leibun
- Date:
- Tue Sep 15 02:53:19 2015 +0000
- Revision:
- 0:f9f11f6ee09d
First commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
leibun | 0:f9f11f6ee09d | 1 | #include "HIDService.h" |
leibun | 0:f9f11f6ee09d | 2 | |
leibun | 0:f9f11f6ee09d | 3 | const uint8_t KeyboardReportMap[] = |
leibun | 0:f9f11f6ee09d | 4 | { 0x05, 0x01, // Usage Page (Generic Desktop) |
leibun | 0:f9f11f6ee09d | 5 | 0x09, 0x06, // Usage (Keyboard) |
leibun | 0:f9f11f6ee09d | 6 | 0xA1, 0x01, // Collection (Application) |
leibun | 0:f9f11f6ee09d | 7 | 0x05, 0x07, // Usage Page (Key Codes) |
leibun | 0:f9f11f6ee09d | 8 | 0x19, 0xe0, // Usage Minimum (224) |
leibun | 0:f9f11f6ee09d | 9 | 0x29, 0xe7, // Usage Maximum (231) |
leibun | 0:f9f11f6ee09d | 10 | 0x15, 0x00, // Logicagl Minimum (0) |
leibun | 0:f9f11f6ee09d | 11 | 0x25, 0x01, // Logical Maximum (1) |
leibun | 0:f9f11f6ee09d | 12 | 0x75, 0x01, // Report Size (1) |
leibun | 0:f9f11f6ee09d | 13 | 0x95, 0x08, // Report Count (8) |
leibun | 0:f9f11f6ee09d | 14 | 0x81, 0x02, // Input (Data, Variable, Absolute) |
leibun | 0:f9f11f6ee09d | 15 | |
leibun | 0:f9f11f6ee09d | 16 | 0x95, 0x01, // Report Count (1) |
leibun | 0:f9f11f6ee09d | 17 | 0x75, 0x08, // Report Size (8) |
leibun | 0:f9f11f6ee09d | 18 | 0x81, 0x01, // Input (Constant) reserved byte(1) |
leibun | 0:f9f11f6ee09d | 19 | |
leibun | 0:f9f11f6ee09d | 20 | 0x95, 0x05, // Report Count (5) |
leibun | 0:f9f11f6ee09d | 21 | 0x75, 0x01, // Report Size (1) |
leibun | 0:f9f11f6ee09d | 22 | 0x05, 0x08, // Usage Page (Page# for LEDs) |
leibun | 0:f9f11f6ee09d | 23 | 0x19, 0x01, // Usage Minimum (1) |
leibun | 0:f9f11f6ee09d | 24 | 0x29, 0x05, // Usage Maximum (5) |
leibun | 0:f9f11f6ee09d | 25 | 0x91, 0x02, // Output (Data, Variable, Absolute), Led report |
leibun | 0:f9f11f6ee09d | 26 | 0x95, 0x01, // Report Count (1) |
leibun | 0:f9f11f6ee09d | 27 | 0x75, 0x03, // Report Size (3) |
leibun | 0:f9f11f6ee09d | 28 | 0x91, 0x01, // Output (Data, Variable, Absolute), Led report padding |
leibun | 0:f9f11f6ee09d | 29 | |
leibun | 0:f9f11f6ee09d | 30 | 0x95, 0x06, // Report Count (6) |
leibun | 0:f9f11f6ee09d | 31 | 0x75, 0x08, // Report Size (8) |
leibun | 0:f9f11f6ee09d | 32 | 0x15, 0x00, // Logical Minimum (0) |
leibun | 0:f9f11f6ee09d | 33 | 0x25, 0x65, // Logical Maximum (101) |
leibun | 0:f9f11f6ee09d | 34 | 0x05, 0x07, // Usage Page (Key codes) |
leibun | 0:f9f11f6ee09d | 35 | 0x19, 0x00, // Usage Minimum (0) |
leibun | 0:f9f11f6ee09d | 36 | // 0x29, 0x65, // Usage Maximum (101) |
leibun | 0:f9f11f6ee09d | 37 | 0x29, 0xA4, // Usage Maximum (0xA4) |
leibun | 0:f9f11f6ee09d | 38 | 0x81, 0x00, // Input (Data, Array) Key array(6 bytes) |
leibun | 0:f9f11f6ee09d | 39 | |
leibun | 0:f9f11f6ee09d | 40 | 0x09, 0x05, // Usage (Vendor Defined) |
leibun | 0:f9f11f6ee09d | 41 | 0x15, 0x00, // Logical Minimum (0) |
leibun | 0:f9f11f6ee09d | 42 | 0x26, 0xFF, 0x00, // Logical Maximum (255) |
leibun | 0:f9f11f6ee09d | 43 | 0x75, 0x08, // Report Count (2) |
leibun | 0:f9f11f6ee09d | 44 | 0x95, 0x02, // Report Size (8 bit) |
leibun | 0:f9f11f6ee09d | 45 | 0xB1, 0x02, // Feature (Data, Variable, Absolute) |
leibun | 0:f9f11f6ee09d | 46 | 0xC0 // End Collection (Application) |
leibun | 0:f9f11f6ee09d | 47 | }; |
leibun | 0:f9f11f6ee09d | 48 | |
leibun | 0:f9f11f6ee09d | 49 | const uint8_t KeyboardReportMap2[] = |
leibun | 0:f9f11f6ee09d | 50 | { |
leibun | 0:f9f11f6ee09d | 51 | 0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 47 |
leibun | 0:f9f11f6ee09d | 52 | 0x09, 0x06, // USAGE (Keyboard) |
leibun | 0:f9f11f6ee09d | 53 | 0xa1, 0x01, // COLLECTION (Application) |
leibun | 0:f9f11f6ee09d | 54 | 0x85, 0x02, // REPORT_ID (2) |
leibun | 0:f9f11f6ee09d | 55 | 0x05, 0x07, // USAGE_PAGE (Keyboard) |
leibun | 0:f9f11f6ee09d | 56 | |
leibun | 0:f9f11f6ee09d | 57 | 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) |
leibun | 0:f9f11f6ee09d | 58 | 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) |
leibun | 0:f9f11f6ee09d | 59 | 0x15, 0x00, // LOGICAL_MINIMUM (0) |
leibun | 0:f9f11f6ee09d | 60 | 0x25, 0x01, // LOGICAL_MAXIMUM (1) |
leibun | 0:f9f11f6ee09d | 61 | 0x75, 0x01, // REPORT_SIZE (1) |
leibun | 0:f9f11f6ee09d | 62 | |
leibun | 0:f9f11f6ee09d | 63 | 0x95, 0x08, // REPORT_COUNT (8) |
leibun | 0:f9f11f6ee09d | 64 | 0x81, 0x02, // INPUT (Data,Var,Abs) |
leibun | 0:f9f11f6ee09d | 65 | 0x95, 0x01, // REPORT_COUNT (1) |
leibun | 0:f9f11f6ee09d | 66 | 0x75, 0x08, // REPORT_SIZE (8) |
leibun | 0:f9f11f6ee09d | 67 | 0x81, 0x03, // INPUT (Cnst,Var,Abs) |
leibun | 0:f9f11f6ee09d | 68 | |
leibun | 0:f9f11f6ee09d | 69 | 0x95, 0x06, // REPORT_COUNT (6) |
leibun | 0:f9f11f6ee09d | 70 | 0x75, 0x08, // REPORT_SIZE (8) |
leibun | 0:f9f11f6ee09d | 71 | 0x15, 0x00, // LOGICAL_MINIMUM (0) |
leibun | 0:f9f11f6ee09d | 72 | 0x25, 0x65, // LOGICAL_MAXIMUM (101) |
leibun | 0:f9f11f6ee09d | 73 | 0x05, 0x07, // USAGE_PAGE (Keyboard) |
leibun | 0:f9f11f6ee09d | 74 | |
leibun | 0:f9f11f6ee09d | 75 | 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) |
leibun | 0:f9f11f6ee09d | 76 | 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) |
leibun | 0:f9f11f6ee09d | 77 | 0x81, 0x00, // INPUT (Data,Ary,Abs) |
leibun | 0:f9f11f6ee09d | 78 | 0xc0, // END_COLLECTION |
leibun | 0:f9f11f6ee09d | 79 | }; |