diff options
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/common.mk | 5 | ||||
| -rw-r--r-- | tmk_core/protocol/lufa.mk | 5 | ||||
| -rw-r--r-- | tmk_core/protocol/lufa/bluetooth.h | 16 | ||||
| -rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 19 |
4 files changed, 43 insertions, 2 deletions
diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 47f6fc571..3e0bd7dbc 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk | |||
| @@ -107,6 +107,11 @@ ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey) | |||
| 107 | TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_EZKEY | 107 | TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_EZKEY |
| 108 | endif | 108 | endif |
| 109 | 109 | ||
| 110 | ifeq ($(strip $(BLUETOOTH)), RN42) | ||
| 111 | TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE | ||
| 112 | TMK_COMMON_DEFS += -DMODULE_RN42 | ||
| 113 | endif | ||
| 114 | |||
| 110 | ifeq ($(strip $(ONEHAND_ENABLE)), yes) | 115 | ifeq ($(strip $(ONEHAND_ENABLE)), yes) |
| 111 | TMK_COMMON_DEFS += -DONEHAND_ENABLE | 116 | TMK_COMMON_DEFS += -DONEHAND_ENABLE |
| 112 | endif | 117 | endif |
diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk index 5b1577972..7ce727dab 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa.mk | |||
| @@ -36,6 +36,11 @@ ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey) | |||
| 36 | $(TMK_DIR)/protocol/serial_uart.c | 36 | $(TMK_DIR)/protocol/serial_uart.c |
| 37 | endif | 37 | endif |
| 38 | 38 | ||
| 39 | ifeq ($(strip $(BLUETOOTH)), RN42) | ||
| 40 | LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ | ||
| 41 | $(TMK_DIR)/protocol/serial_uart.c | ||
| 42 | endif | ||
| 43 | |||
| 39 | ifeq ($(strip $(VIRTSER_ENABLE)), yes) | 44 | ifeq ($(strip $(VIRTSER_ENABLE)), yes) |
| 40 | LUFA_SRC += $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c | 45 | LUFA_SRC += $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c |
| 41 | endif | 46 | endif |
diff --git a/tmk_core/protocol/lufa/bluetooth.h b/tmk_core/protocol/lufa/bluetooth.h index 78ece1cd0..f4b2f6f8b 100644 --- a/tmk_core/protocol/lufa/bluetooth.h +++ b/tmk_core/protocol/lufa/bluetooth.h | |||
| @@ -62,4 +62,18 @@ void bluefruit_serial_send(uint8_t data); | |||
| 62 | (usage == AC_REFRESH ? 0x0000 : \ | 62 | (usage == AC_REFRESH ? 0x0000 : \ |
| 63 | (usage == AC_BOOKMARKS ? 0x0000 : 0))))))))))))))))))) | 63 | (usage == AC_BOOKMARKS ? 0x0000 : 0))))))))))))))))))) |
| 64 | 64 | ||
| 65 | #endif \ No newline at end of file | 65 | #define CONSUMER2RN42(usage) \ |
| 66 | (usage == AUDIO_MUTE ? 0x0040 : \ | ||
| 67 | (usage == AUDIO_VOL_UP ? 0x0010 : \ | ||
| 68 | (usage == AUDIO_VOL_DOWN ? 0x0020 : \ | ||
| 69 | (usage == TRANSPORT_NEXT_TRACK ? 0x0100 : \ | ||
| 70 | (usage == TRANSPORT_PREV_TRACK ? 0x0200 : \ | ||
| 71 | (usage == TRANSPORT_STOP ? 0x0400 : \ | ||
| 72 | (usage == TRANSPORT_STOP_EJECT ? 0x0800 : \ | ||
| 73 | (usage == TRANSPORT_PLAY_PAUSE ? 0x0080 : \ | ||
| 74 | (usage == AL_EMAIL ? 0x0200 : \ | ||
| 75 | (usage == AL_LOCAL_BROWSER ? 0x8000 : \ | ||
| 76 | (usage == AC_SEARCH ? 0x0400 : \ | ||
| 77 | (usage == AC_HOME ? 0x0100 : 0)))))))))))) | ||
| 78 | |||
| 79 | #endif | ||
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 60cba8d2a..ae6129d1a 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
| @@ -606,6 +606,13 @@ static void send_keyboard(report_keyboard_t *report) | |||
| 606 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { | 606 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { |
| 607 | #ifdef MODULE_ADAFRUIT_BLE | 607 | #ifdef MODULE_ADAFRUIT_BLE |
| 608 | adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys)); | 608 | adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys)); |
| 609 | #elif MODULE_RN42 | ||
| 610 | bluefruit_serial_send(0xFD); | ||
| 611 | bluefruit_serial_send(0x09); | ||
| 612 | bluefruit_serial_send(0x01); | ||
| 613 | for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { | ||
| 614 | bluefruit_serial_send(report->raw[i]); | ||
| 615 | } | ||
| 609 | #else | 616 | #else |
| 610 | bluefruit_serial_send(0xFD); | 617 | bluefruit_serial_send(0xFD); |
| 611 | for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { | 618 | for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { |
| @@ -726,6 +733,16 @@ static void send_consumer(uint16_t data) | |||
| 726 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { | 733 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { |
| 727 | #ifdef MODULE_ADAFRUIT_BLE | 734 | #ifdef MODULE_ADAFRUIT_BLE |
| 728 | adafruit_ble_send_consumer_key(data, 0); | 735 | adafruit_ble_send_consumer_key(data, 0); |
| 736 | #elif MODULE_RN42 | ||
| 737 | static uint16_t last_data = 0; | ||
| 738 | if (data == last_data) return; | ||
| 739 | last_data = data; | ||
| 740 | uint16_t bitmap = CONSUMER2RN42(data); | ||
| 741 | bluefruit_serial_send(0xFD); | ||
| 742 | bluefruit_serial_send(0x03); | ||
| 743 | bluefruit_serial_send(0x03); | ||
| 744 | bluefruit_serial_send(bitmap&0xFF); | ||
| 745 | bluefruit_serial_send((bitmap>>8)&0xFF); | ||
| 729 | #else | 746 | #else |
| 730 | static uint16_t last_data = 0; | 747 | static uint16_t last_data = 0; |
| 731 | if (data == last_data) return; | 748 | if (data == last_data) return; |
| @@ -1132,7 +1149,7 @@ int main(void) | |||
| 1132 | // midi_send_noteoff(&midi_device, 0, 64, 127); | 1149 | // midi_send_noteoff(&midi_device, 0, 64, 127); |
| 1133 | #endif | 1150 | #endif |
| 1134 | 1151 | ||
| 1135 | #ifdef MODULE_ADAFRUIT_EZKEY | 1152 | #if defined(MODULE_ADAFRUIT_EZKEY) || defined(MODULE_RN42) |
| 1136 | serial_init(); | 1153 | serial_init(); |
| 1137 | #endif | 1154 | #endif |
| 1138 | 1155 | ||
