aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2020-08-25 19:03:45 +1000
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2020-08-29 14:30:02 -0700
commit0f596881b36587a298568192078f9b467c51c109 (patch)
tree187554101f88057c2f6a826ebc33a3533ec9adc6 /tmk_core
parent15df82cdf3f5b5d81af2cc235fbfe7643cd044b9 (diff)
downloadqmk_firmware-0f596881b36587a298568192078f9b467c51c109.tar.gz
qmk_firmware-0f596881b36587a298568192078f9b467c51c109.zip
Remove support for Adafruit EZ-Key (#10103)
* Remove support for Adafruit EZ-Key * Update docs/ja/feature_bluetooth.md Co-authored-by: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Co-authored-by: Takeshi ISHII <2170248+mtei@users.noreply.github.com>
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common.mk6
-rw-r--r--tmk_core/protocol/lufa.mk12
-rw-r--r--tmk_core/protocol/lufa/bluetooth.c38
-rw-r--r--tmk_core/protocol/lufa/bluetooth.h96
-rw-r--r--tmk_core/protocol/lufa/lufa.c105
5 files changed, 64 insertions, 193 deletions
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index a6c439f5c..3c9de33c9 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -132,12 +132,6 @@ ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
132 TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK 132 TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
133endif 133endif
134 134
135ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey)
136 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
137 TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_EZKEY
138 TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
139endif
140
141ifeq ($(strip $(BLUETOOTH)), RN42) 135ifeq ($(strip $(BLUETOOTH)), RN42)
142 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE 136 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
143 TMK_COMMON_DEFS += -DMODULE_RN42 137 TMK_COMMON_DEFS += -DMODULE_RN42
diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk
index 9bc972c26..1cc1fa04e 100644
--- a/tmk_core/protocol/lufa.mk
+++ b/tmk_core/protocol/lufa.mk
@@ -23,8 +23,7 @@ ifeq ($(strip $(MIDI_ENABLE)), yes)
23endif 23endif
24 24
25ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) 25ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
26 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ 26 LUFA_SRC += outputselect.c \
27 outputselect.c \
28 $(TMK_DIR)/protocol/serial_uart.c 27 $(TMK_DIR)/protocol/serial_uart.c
29endif 28endif
30 29
@@ -35,15 +34,8 @@ ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
35 $(LUFA_DIR)/adafruit_ble.cpp 34 $(LUFA_DIR)/adafruit_ble.cpp
36endif 35endif
37 36
38ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey)
39 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
40 outputselect.c \
41 $(TMK_DIR)/protocol/serial_uart.c
42endif
43
44ifeq ($(strip $(BLUETOOTH)), RN42) 37ifeq ($(strip $(BLUETOOTH)), RN42)
45 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ 38 LUFA_SRC += outputselect.c \
46 outputselect.c \
47 $(TMK_DIR)/protocol/serial_uart.c 39 $(TMK_DIR)/protocol/serial_uart.c
48endif 40endif
49 41
diff --git a/tmk_core/protocol/lufa/bluetooth.c b/tmk_core/protocol/lufa/bluetooth.c
deleted file mode 100644
index 5eb52860b..000000000
--- a/tmk_core/protocol/lufa/bluetooth.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2Bluefruit Protocol for TMK firmware
3Author: Benjamin Gould, 2013
4 Jack Humbert, 2015
5Based on code Copyright 2011 Jun Wako <wakojun@gmail.com>
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 2 of the License, or
9(at your option) any later version.
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include "report.h"
20#include "print.h"
21#include "debug.h"
22#include "bluetooth.h"
23
24void bluefruit_keyboard_print_report(report_keyboard_t *report) {
25 if (!debug_keyboard) return;
26 dprintf("keys: ");
27 for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
28 debug_hex8(report->keys[i]);
29 dprintf(" ");
30 }
31 dprintf(" mods: ");
32 debug_hex8(report->mods);
33 dprintf(" reserved: ");
34 debug_hex8(report->reserved);
35 dprintf("\n");
36}
37
38void bluefruit_serial_send(uint8_t data) { serial_send(data); } \ No newline at end of file
diff --git a/tmk_core/protocol/lufa/bluetooth.h b/tmk_core/protocol/lufa/bluetooth.h
deleted file mode 100644
index 67f031439..000000000
--- a/tmk_core/protocol/lufa/bluetooth.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2Bluefruit Protocol for TMK firmware
3Author: Benjamin Gould, 2013
4 Jack Humbert, 2015
5Based on code Copyright 2011 Jun Wako <wakojun@gmail.com>
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 2 of the License, or
9(at your option) any later version.
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "../serial.h"
21
22void bluefruit_serial_send(uint8_t data);
23
24// https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetooth-hid-keyboard/sending-keys-via-serial#raw-hid-consumer-reports-8-14
25static inline uint16_t CONSUMER2BLUEFRUIT(uint16_t usage) {
26 switch (usage) {
27 case AC_HOME:
28 return 0x0001;
29 case AL_KEYBOARD_LAYOUT:
30 return 0x0002;
31 case AC_SEARCH:
32 return 0x0004;
33 case SNAPSHOT:
34 return 0x0008;
35 case AUDIO_VOL_UP:
36 return 0x0010;
37 case AUDIO_VOL_DOWN:
38 return 0x0020;
39 case TRANSPORT_PLAY_PAUSE:
40 return 0x0040;
41 case TRANSPORT_FAST_FORWARD:
42 return 0x0080;
43 case TRANSPORT_REWIND:
44 return 0x0100;
45 case TRANSPORT_NEXT_TRACK:
46 return 0x0200;
47 case TRANSPORT_PREV_TRACK:
48 return 0x0400;
49 case TRANSPORT_RANDOM_PLAY:
50 return 0x0800;
51 case TRANSPORT_STOP:
52 return 0x1000;
53 default:
54 return 0;
55 }
56}
57
58// https://cdn.sparkfun.com/datasheets/Wireless/Bluetooth/bluetooth_cr_UG-v1.0r.pdf#G7.663734
59static inline uint16_t CONSUMER2RN42(uint16_t usage) {
60 switch (usage) {
61 case AC_HOME:
62 return 0x0001;
63 case AL_EMAIL:
64 return 0x0002;
65 case AC_SEARCH:
66 return 0x0004;
67 case AL_KEYBOARD_LAYOUT:
68 return 0x0008;
69 case AUDIO_VOL_UP:
70 return 0x0010;
71 case AUDIO_VOL_DOWN:
72 return 0x0020;
73 case AUDIO_MUTE:
74 return 0x0040;
75 case TRANSPORT_PLAY_PAUSE:
76 return 0x0080;
77 case TRANSPORT_NEXT_TRACK:
78 return 0x0100;
79 case TRANSPORT_PREV_TRACK:
80 return 0x0200;
81 case TRANSPORT_STOP:
82 return 0x0400;
83 case TRANSPORT_EJECT:
84 return 0x0800;
85 case TRANSPORT_FAST_FORWARD:
86 return 0x1000;
87 case TRANSPORT_REWIND:
88 return 0x2000;
89 case TRANSPORT_STOP_EJECT:
90 return 0x4000;
91 case AL_LOCAL_BROWSER:
92 return 0x8000;
93 default:
94 return 0;
95 }
96}
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 8410eb483..09ba0bacf 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -69,7 +69,7 @@ extern keymap_config_t keymap_config;
69# ifdef MODULE_ADAFRUIT_BLE 69# ifdef MODULE_ADAFRUIT_BLE
70# include "adafruit_ble.h" 70# include "adafruit_ble.h"
71# else 71# else
72# include "bluetooth.h" 72# include "../serial.h"
73# endif 73# endif
74#endif 74#endif
75 75
@@ -89,6 +89,46 @@ extern keymap_config_t keymap_config;
89# include "joystick.h" 89# include "joystick.h"
90#endif 90#endif
91 91
92// https://cdn.sparkfun.com/datasheets/Wireless/Bluetooth/bluetooth_cr_UG-v1.0r.pdf#G7.663734
93static inline uint16_t CONSUMER2RN42(uint16_t usage) {
94 switch (usage) {
95 case AC_HOME:
96 return 0x0001;
97 case AL_EMAIL:
98 return 0x0002;
99 case AC_SEARCH:
100 return 0x0004;
101 case AL_KEYBOARD_LAYOUT:
102 return 0x0008;
103 case AUDIO_VOL_UP:
104 return 0x0010;
105 case AUDIO_VOL_DOWN:
106 return 0x0020;
107 case AUDIO_MUTE:
108 return 0x0040;
109 case TRANSPORT_PLAY_PAUSE:
110 return 0x0080;
111 case TRANSPORT_NEXT_TRACK:
112 return 0x0100;
113 case TRANSPORT_PREV_TRACK:
114 return 0x0200;
115 case TRANSPORT_STOP:
116 return 0x0400;
117 case TRANSPORT_EJECT:
118 return 0x0800;
119 case TRANSPORT_FAST_FORWARD:
120 return 0x1000;
121 case TRANSPORT_REWIND:
122 return 0x2000;
123 case TRANSPORT_STOP_EJECT:
124 return 0x4000;
125 case AL_LOCAL_BROWSER:
126 return 0x8000;
127 default:
128 return 0;
129 }
130}
131
92uint8_t keyboard_idle = 0; 132uint8_t keyboard_idle = 0;
93/* 0: Boot Protocol, 1: Report Protocol(default) */ 133/* 0: Boot Protocol, 1: Report Protocol(default) */
94uint8_t keyboard_protocol = 1; 134uint8_t keyboard_protocol = 1;
@@ -631,20 +671,13 @@ static void send_keyboard(report_keyboard_t *report) {
631# ifdef MODULE_ADAFRUIT_BLE 671# ifdef MODULE_ADAFRUIT_BLE
632 adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys)); 672 adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys));
633# elif MODULE_RN42 673# elif MODULE_RN42
634 bluefruit_serial_send(0xFD); 674 serial_send(0xFD);
635 bluefruit_serial_send(0x09); 675 serial_send(0x09);
636 bluefruit_serial_send(0x01); 676 serial_send(0x01);
637 bluefruit_serial_send(report->mods); 677 serial_send(report->mods);
638 bluefruit_serial_send(report->reserved); 678 serial_send(report->reserved);
639 for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
640 bluefruit_serial_send(report->keys[i]);
641 }
642# else
643 bluefruit_serial_send(0xFD);
644 bluefruit_serial_send(report->mods);
645 bluefruit_serial_send(report->reserved);
646 for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { 679 for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
647 bluefruit_serial_send(report->keys[i]); 680 serial_send(report->keys[i]);
648 } 681 }
649# endif 682# endif
650 } 683 }
@@ -697,15 +730,15 @@ static void send_mouse(report_mouse_t *report) {
697 // FIXME: mouse buttons 730 // FIXME: mouse buttons
698 adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h, report->buttons); 731 adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h, report->buttons);
699# else 732# else
700 bluefruit_serial_send(0xFD); 733 serial_send(0xFD);
701 bluefruit_serial_send(0x00); 734 serial_send(0x00);
702 bluefruit_serial_send(0x03); 735 serial_send(0x03);
703 bluefruit_serial_send(report->buttons); 736 serial_send(report->buttons);
704 bluefruit_serial_send(report->x); 737 serial_send(report->x);
705 bluefruit_serial_send(report->y); 738 serial_send(report->y);
706 bluefruit_serial_send(report->v); // should try sending the wheel v here 739 serial_send(report->v); // should try sending the wheel v here
707 bluefruit_serial_send(report->h); // should try sending the wheel h here 740 serial_send(report->h); // should try sending the wheel h here
708 bluefruit_serial_send(0x00); 741 serial_send(0x00);
709# endif 742# endif
710 } 743 }
711 744
@@ -778,25 +811,11 @@ static void send_consumer(uint16_t data) {
778 if (data == last_data) return; 811 if (data == last_data) return;
779 last_data = data; 812 last_data = data;
780 uint16_t bitmap = CONSUMER2RN42(data); 813 uint16_t bitmap = CONSUMER2RN42(data);
781 bluefruit_serial_send(0xFD); 814 serial_send(0xFD);
782 bluefruit_serial_send(0x03); 815 serial_send(0x03);
783 bluefruit_serial_send(0x03); 816 serial_send(0x03);
784 bluefruit_serial_send(bitmap & 0xFF); 817 serial_send(bitmap & 0xFF);
785 bluefruit_serial_send((bitmap >> 8) & 0xFF); 818 serial_send((bitmap >> 8) & 0xFF);
786# else
787 static uint16_t last_data = 0;
788 if (data == last_data) return;
789 last_data = data;
790 uint16_t bitmap = CONSUMER2BLUEFRUIT(data);
791 bluefruit_serial_send(0xFD);
792 bluefruit_serial_send(0x00);
793 bluefruit_serial_send(0x02);
794 bluefruit_serial_send(bitmap & 0xFF);
795 bluefruit_serial_send((bitmap >> 8) & 0xFF);
796 bluefruit_serial_send(0x00);
797 bluefruit_serial_send(0x00);
798 bluefruit_serial_send(0x00);
799 bluefruit_serial_send(0x00);
800# endif 819# endif
801 } 820 }
802 821
@@ -1018,7 +1037,7 @@ int main(void) {
1018 setup_usb(); 1037 setup_usb();
1019 sei(); 1038 sei();
1020 1039
1021#if defined(MODULE_ADAFRUIT_EZKEY) || defined(MODULE_RN42) 1040#if defined(MODULE_RN42)
1022 serial_init(); 1041 serial_init();
1023#endif 1042#endif
1024 1043