aboutsummaryrefslogtreecommitdiff
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
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>
-rw-r--r--docs/config_options.md4
-rw-r--r--docs/feature_bluetooth.md7
-rw-r--r--docs/getting_started_make_guide.md4
-rw-r--r--docs/ja/config_options.md4
-rw-r--r--docs/ja/feature_bluetooth.md8
-rw-r--r--docs/ja/getting_started_make_guide.md4
-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
11 files changed, 68 insertions, 220 deletions
diff --git a/docs/config_options.md b/docs/config_options.md
index a323741c2..f9b1cc657 100644
--- a/docs/config_options.md
+++ b/docs/config_options.md
@@ -371,10 +371,8 @@ Use these to enable or disable building certain features. The more you have enab
371 * MIDI controls 371 * MIDI controls
372* `UNICODE_ENABLE` 372* `UNICODE_ENABLE`
373 * Unicode 373 * Unicode
374* `BLUETOOTH_ENABLE`
375 * Legacy option to Enable Bluetooth with the Adafruit EZ-Key HID. See BLUETOOTH
376* `BLUETOOTH` 374* `BLUETOOTH`
377 * Current options are AdafruitEzKey, AdafruitBLE, RN42 375 * Current options are AdafruitBLE, RN42
378* `SPLIT_KEYBOARD` 376* `SPLIT_KEYBOARD`
379 * Enables split keyboard support (dual MCU like the let's split and bakingpy's boards) and includes all necessary files located at quantum/split_common 377 * Enables split keyboard support (dual MCU like the let's split and bakingpy's boards) and includes all necessary files located at quantum/split_common
380* `CUSTOM_MATRIX` 378* `CUSTOM_MATRIX`
diff --git a/docs/feature_bluetooth.md b/docs/feature_bluetooth.md
index 6cd5c3c6c..7b450b1ac 100644
--- a/docs/feature_bluetooth.md
+++ b/docs/feature_bluetooth.md
@@ -2,11 +2,10 @@
2 2
3## Bluetooth Known Supported Hardware 3## Bluetooth Known Supported Hardware
4 4
5Currently Bluetooth support is limited to AVR based chips. For Bluetooth 2.1, QMK has support for RN-42 modules and the Bluefruit EZ-Key, the latter of which is not produced anymore. For more recent BLE protocols, currently only the Adafruit Bluefruit SPI Friend is directly supported. BLE is needed to connect to iOS devices. Note iOS does not support mouse input. 5Currently Bluetooth support is limited to AVR based chips. For Bluetooth 2.1, QMK has support for RN-42 modules. For more recent BLE protocols, currently only the Adafruit Bluefruit SPI Friend is directly supported. BLE is needed to connect to iOS devices. Note iOS does not support mouse input.
6 6
7|Board |Bluetooth Protocol |Connection Type |rules.mk |Bluetooth Chip| 7|Board |Bluetooth Protocol |Connection Type |rules.mk |Bluetooth Chip|
8|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------| 8|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------|
9|[Adafruit EZ-Key HID](https://www.adafruit.com/product/1535) |Bluetooth Classic | UART |`BLUETOOTH = AdafruitEZKey` | |
10|Roving Networks RN-42 (Sparkfun Bluesmirf) |Bluetooth Classic | UART |`BLUETOOTH = RN42` | RN-42 | 9|Roving Networks RN-42 (Sparkfun Bluesmirf) |Bluetooth Classic | UART |`BLUETOOTH = RN42` | RN-42 |
11|[Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633)|Bluetooth Low Energy | SPI |`BLUETOOTH = AdafruitBLE` | nRF51822 | 10|[Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633)|Bluetooth Low Energy | SPI |`BLUETOOTH = AdafruitBLE` | nRF51822 |
12 11
@@ -24,16 +23,12 @@ Currently The only bluetooth chipset supported by QMK is the Adafruit Bluefruit
24 23
25A Bluefruit UART friend can be converted to an SPI friend, however this [requires](https://github.com/qmk/qmk_firmware/issues/2274) some reflashing and soldering directly to the MDBT40 chip. 24A Bluefruit UART friend can be converted to an SPI friend, however this [requires](https://github.com/qmk/qmk_firmware/issues/2274) some reflashing and soldering directly to the MDBT40 chip.
26 25
27## Adafruit EZ-Key hid
28This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will.
29
30 26
31<!-- FIXME: Document bluetooth support more completely. --> 27<!-- FIXME: Document bluetooth support more completely. -->
32## Bluetooth Rules.mk Options 28## Bluetooth Rules.mk Options
33Use only one of these 29Use only one of these
34* BLUETOOTH_ENABLE = yes (Legacy Option) 30* BLUETOOTH_ENABLE = yes (Legacy Option)
35* BLUETOOTH = RN42 31* BLUETOOTH = RN42
36* BLUETOOTH = AdafruitEZKey
37* BLUETOOTH = AdafruitBLE 32* BLUETOOTH = AdafruitBLE
38 33
39## Bluetooth Keycodes 34## Bluetooth Keycodes
diff --git a/docs/getting_started_make_guide.md b/docs/getting_started_make_guide.md
index df82a001f..a89dc73d0 100644
--- a/docs/getting_started_make_guide.md
+++ b/docs/getting_started_make_guide.md
@@ -101,10 +101,6 @@ This allows you to send Unicode characters by inputting a mnemonic corresponding
101 101
102For further details, as well as limitations, see the [Unicode page](feature_unicode.md). 102For further details, as well as limitations, see the [Unicode page](feature_unicode.md).
103 103
104`BLUETOOTH_ENABLE`
105
106This allows you to interface with a Bluefruit EZ-key to send keycodes wirelessly. It uses the D2 and D3 pins.
107
108`AUDIO_ENABLE` 104`AUDIO_ENABLE`
109 105
110This allows you output audio on the C6 pin (needs abstracting). See the [audio page](feature_audio.md) for more information. 106This allows you output audio on the C6 pin (needs abstracting). See the [audio page](feature_audio.md) for more information.
diff --git a/docs/ja/config_options.md b/docs/ja/config_options.md
index 6ba7f6f1f..2a64f2ba2 100644
--- a/docs/ja/config_options.md
+++ b/docs/ja/config_options.md
@@ -369,10 +369,8 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
369 * MIDI 制御 369 * MIDI 制御
370* `UNICODE_ENABLE` 370* `UNICODE_ENABLE`
371 * Unicode 371 * Unicode
372* `BLUETOOTH_ENABLE`
373 * Adafruit EZ-Key HID で Bluetooth を有効にするレガシーオプション。BLUETOOTH を見てください
374* `BLUETOOTH` 372* `BLUETOOTH`
375 * 現在のオプションは、AdafruitEzKey、AdafruitBLE、RN42 373 * 現在のオプションは、AdafruitBLE、RN42
376* `SPLIT_KEYBOARD` 374* `SPLIT_KEYBOARD`
377 * 分割キーボード (let's split や bakingpy のキーボードのようなデュアル MCU) のサポートを有効にし、quantum/split_common にある全ての必要なファイルをインクルードします 375 * 分割キーボード (let's split や bakingpy のキーボードのようなデュアル MCU) のサポートを有効にし、quantum/split_common にある全ての必要なファイルをインクルードします
378* `CUSTOM_MATRIX` 376* `CUSTOM_MATRIX`
diff --git a/docs/ja/feature_bluetooth.md b/docs/ja/feature_bluetooth.md
index 4443a4e3e..f7835dd54 100644
--- a/docs/ja/feature_bluetooth.md
+++ b/docs/ja/feature_bluetooth.md
@@ -7,11 +7,10 @@
7 7
8## Bluetooth の既知のサポートハードウェア 8## Bluetooth の既知のサポートハードウェア
9 9
10現在のところ Bluetooth のサポートは AVR ベースのチップに限られます。Bluetooth 2.1 については、QMK は RN-42 モジュールと、Bluefruit EZ-Key をサポートしますが、後者はもう生産されていません。より最近の BLE プロトコルについては、現在のところ Adafruit Bluefruit SPI Friend のみが直接サポートされています。iOS デバイスに接続するには、BLE が必要です。iOS はマウス入力をサポートしないことに注意してください。 10現在のところ Bluetooth のサポートは AVR ベースのチップに限られます。Bluetooth 2.1 については、QMK は RN-42 モジュールをサポートします。より最近の BLE プロトコルについては、現在のところ Adafruit Bluefruit SPI Friend のみが直接サポートされています。iOS デバイスに接続するには、BLE が必要です。iOS はマウス入力をサポートしないことに注意してください。
11 11
12| ボード | Bluetooth プロトコル | 接続タイプ | rules.mk | Bluetooth チップ | 12| ボード | Bluetooth プロトコル | 接続タイプ | rules.mk | Bluetooth チップ |
13|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------| 13|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------|
14| [Adafruit EZ-Key HID](https://www.adafruit.com/product/1535) | Bluetooth Classic | UART | `BLUETOOTH = AdafruitEZKey` | |
15| Roving Networks RN-42 (Sparkfun Bluesmirf) | Bluetooth Classic | UART | `BLUETOOTH = RN42` | RN-42 | 14| Roving Networks RN-42 (Sparkfun Bluesmirf) | Bluetooth Classic | UART | `BLUETOOTH = RN42` | RN-42 |
16| [Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633) | Bluetooth Low Energy | SPI | `BLUETOOTH = AdafruitBLE` | nRF51822 | 15| [Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633) | Bluetooth Low Energy | SPI | `BLUETOOTH = AdafruitBLE` | nRF51822 |
17 16
@@ -29,16 +28,11 @@
29 28
30Bluefruit UART friend は SPI friend に変換することができますが、これにはMDBT40 チップへの直接の再書き込みとはんだ付けが[必要です](https://github.com/qmk/qmk_firmware/issues/2274)。 29Bluefruit UART friend は SPI friend に変換することができますが、これにはMDBT40 チップへの直接の再書き込みとはんだ付けが[必要です](https://github.com/qmk/qmk_firmware/issues/2274)。
31 30
32## Adafruit EZ-Key hid
33これには[ハードウェアの変更](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts)が必要ですが、Makefile を使って有効にすることができます。ファームウェアは引き続き USB 経由で文字を出力するため、コンピュータ経由で充電する場合は注意してください。任意にオフにするために Bluefruit 上にスイッチを持つことは理にかなっています。
34
35
36<!-- FIXME: Document bluetooth support more completely. --> 31<!-- FIXME: Document bluetooth support more completely. -->
37## Bluetooth の Rules.mk オプション 32## Bluetooth の Rules.mk オプション
38これらのうちの1つだけを使ってください 33これらのうちの1つだけを使ってください
39* BLUETOOTH_ENABLE = yes (レガシーオプション) 34* BLUETOOTH_ENABLE = yes (レガシーオプション)
40* BLUETOOTH = RN42 35* BLUETOOTH = RN42
41* BLUETOOTH = AdafruitEZKey
42* BLUETOOTH = AdafruitBLE 36* BLUETOOTH = AdafruitBLE
43 37
44## Bluetooth キーコード 38## Bluetooth キーコード
diff --git a/docs/ja/getting_started_make_guide.md b/docs/ja/getting_started_make_guide.md
index 0d39583a1..cbc824de8 100644
--- a/docs/ja/getting_started_make_guide.md
+++ b/docs/ja/getting_started_make_guide.md
@@ -106,10 +106,6 @@ make コマンド自体にもいくつかの追加オプションがあります
106 106
107詳細と制限については、[Unicode ページ](ja/feature_unicode.md) を見てください。 107詳細と制限については、[Unicode ページ](ja/feature_unicode.md) を見てください。
108 108
109`BLUETOOTH_ENABLE`
110
111これによりキーコードをワイヤレスで送信するために Bluefruit EZ-key と連動することができます。D2 と D3 ピンを使います。
112
113`AUDIO_ENABLE` 109`AUDIO_ENABLE`
114 110
115C6 ピン(抽象化が必要)でオーディオ出力できます。詳細は[オーディオページ](ja/feature_audio.md)を見てください。 111C6 ピン(抽象化が必要)でオーディオ出力できます。詳細は[オーディオページ](ja/feature_audio.md)を見てください。
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