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>
This commit is contained in:
parent
15df82cdf3
commit
0f596881b3
11 changed files with 68 additions and 220 deletions
|
@ -371,10 +371,8 @@ Use these to enable or disable building certain features. The more you have enab
|
||||||
* MIDI controls
|
* MIDI controls
|
||||||
* `UNICODE_ENABLE`
|
* `UNICODE_ENABLE`
|
||||||
* Unicode
|
* Unicode
|
||||||
* `BLUETOOTH_ENABLE`
|
|
||||||
* Legacy option to Enable Bluetooth with the Adafruit EZ-Key HID. See BLUETOOTH
|
|
||||||
* `BLUETOOTH`
|
* `BLUETOOTH`
|
||||||
* Current options are AdafruitEzKey, AdafruitBLE, RN42
|
* Current options are AdafruitBLE, RN42
|
||||||
* `SPLIT_KEYBOARD`
|
* `SPLIT_KEYBOARD`
|
||||||
* 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
|
* 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
|
||||||
* `CUSTOM_MATRIX`
|
* `CUSTOM_MATRIX`
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
|
|
||||||
## Bluetooth Known Supported Hardware
|
## Bluetooth Known Supported Hardware
|
||||||
|
|
||||||
Currently 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.
|
Currently 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.
|
||||||
|
|
||||||
|Board |Bluetooth Protocol |Connection Type |rules.mk |Bluetooth Chip|
|
|Board |Bluetooth Protocol |Connection Type |rules.mk |Bluetooth Chip|
|
||||||
|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------|
|
|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------|
|
||||||
|[Adafruit EZ-Key HID](https://www.adafruit.com/product/1535) |Bluetooth Classic | UART |`BLUETOOTH = AdafruitEZKey` | |
|
|
||||||
|Roving Networks RN-42 (Sparkfun Bluesmirf) |Bluetooth Classic | UART |`BLUETOOTH = RN42` | RN-42 |
|
|Roving Networks RN-42 (Sparkfun Bluesmirf) |Bluetooth Classic | UART |`BLUETOOTH = RN42` | RN-42 |
|
||||||
|[Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633)|Bluetooth Low Energy | SPI |`BLUETOOTH = AdafruitBLE` | nRF51822 |
|
|[Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633)|Bluetooth Low Energy | SPI |`BLUETOOTH = AdafruitBLE` | nRF51822 |
|
||||||
|
|
||||||
|
@ -24,16 +23,12 @@ Currently The only bluetooth chipset supported by QMK is the Adafruit Bluefruit
|
||||||
|
|
||||||
A 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.
|
A 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.
|
||||||
|
|
||||||
## Adafruit EZ-Key hid
|
|
||||||
This 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.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- FIXME: Document bluetooth support more completely. -->
|
<!-- FIXME: Document bluetooth support more completely. -->
|
||||||
## Bluetooth Rules.mk Options
|
## Bluetooth Rules.mk Options
|
||||||
Use only one of these
|
Use only one of these
|
||||||
* BLUETOOTH_ENABLE = yes (Legacy Option)
|
* BLUETOOTH_ENABLE = yes (Legacy Option)
|
||||||
* BLUETOOTH = RN42
|
* BLUETOOTH = RN42
|
||||||
* BLUETOOTH = AdafruitEZKey
|
|
||||||
* BLUETOOTH = AdafruitBLE
|
* BLUETOOTH = AdafruitBLE
|
||||||
|
|
||||||
## Bluetooth Keycodes
|
## Bluetooth Keycodes
|
||||||
|
|
|
@ -101,10 +101,6 @@ This allows you to send Unicode characters by inputting a mnemonic corresponding
|
||||||
|
|
||||||
For further details, as well as limitations, see the [Unicode page](feature_unicode.md).
|
For further details, as well as limitations, see the [Unicode page](feature_unicode.md).
|
||||||
|
|
||||||
`BLUETOOTH_ENABLE`
|
|
||||||
|
|
||||||
This allows you to interface with a Bluefruit EZ-key to send keycodes wirelessly. It uses the D2 and D3 pins.
|
|
||||||
|
|
||||||
`AUDIO_ENABLE`
|
`AUDIO_ENABLE`
|
||||||
|
|
||||||
This allows you output audio on the C6 pin (needs abstracting). See the [audio page](feature_audio.md) for more information.
|
This allows you output audio on the C6 pin (needs abstracting). See the [audio page](feature_audio.md) for more information.
|
||||||
|
|
|
@ -369,10 +369,8 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||||
* MIDI 制御
|
* MIDI 制御
|
||||||
* `UNICODE_ENABLE`
|
* `UNICODE_ENABLE`
|
||||||
* Unicode
|
* Unicode
|
||||||
* `BLUETOOTH_ENABLE`
|
|
||||||
* Adafruit EZ-Key HID で Bluetooth を有効にするレガシーオプション。BLUETOOTH を見てください
|
|
||||||
* `BLUETOOTH`
|
* `BLUETOOTH`
|
||||||
* 現在のオプションは、AdafruitEzKey、AdafruitBLE、RN42
|
* 現在のオプションは、AdafruitBLE、RN42
|
||||||
* `SPLIT_KEYBOARD`
|
* `SPLIT_KEYBOARD`
|
||||||
* 分割キーボード (let's split や bakingpy のキーボードのようなデュアル MCU) のサポートを有効にし、quantum/split_common にある全ての必要なファイルをインクルードします
|
* 分割キーボード (let's split や bakingpy のキーボードのようなデュアル MCU) のサポートを有効にし、quantum/split_common にある全ての必要なファイルをインクルードします
|
||||||
* `CUSTOM_MATRIX`
|
* `CUSTOM_MATRIX`
|
||||||
|
|
|
@ -7,11 +7,10 @@
|
||||||
|
|
||||||
## Bluetooth の既知のサポートハードウェア
|
## Bluetooth の既知のサポートハードウェア
|
||||||
|
|
||||||
現在のところ Bluetooth のサポートは AVR ベースのチップに限られます。Bluetooth 2.1 については、QMK は RN-42 モジュールと、Bluefruit EZ-Key をサポートしますが、後者はもう生産されていません。より最近の BLE プロトコルについては、現在のところ Adafruit Bluefruit SPI Friend のみが直接サポートされています。iOS デバイスに接続するには、BLE が必要です。iOS はマウス入力をサポートしないことに注意してください。
|
現在のところ Bluetooth のサポートは AVR ベースのチップに限られます。Bluetooth 2.1 については、QMK は RN-42 モジュールをサポートします。より最近の BLE プロトコルについては、現在のところ Adafruit Bluefruit SPI Friend のみが直接サポートされています。iOS デバイスに接続するには、BLE が必要です。iOS はマウス入力をサポートしないことに注意してください。
|
||||||
|
|
||||||
| ボード | Bluetooth プロトコル | 接続タイプ | rules.mk | Bluetooth チップ |
|
| ボード | Bluetooth プロトコル | 接続タイプ | rules.mk | Bluetooth チップ |
|
||||||
|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------|
|
|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------|
|
||||||
| [Adafruit EZ-Key HID](https://www.adafruit.com/product/1535) | Bluetooth Classic | UART | `BLUETOOTH = AdafruitEZKey` | |
|
|
||||||
| Roving Networks RN-42 (Sparkfun Bluesmirf) | Bluetooth Classic | UART | `BLUETOOTH = RN42` | RN-42 |
|
| Roving Networks RN-42 (Sparkfun Bluesmirf) | Bluetooth Classic | UART | `BLUETOOTH = RN42` | RN-42 |
|
||||||
| [Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633) | Bluetooth Low Energy | SPI | `BLUETOOTH = AdafruitBLE` | nRF51822 |
|
| [Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633) | Bluetooth Low Energy | SPI | `BLUETOOTH = AdafruitBLE` | nRF51822 |
|
||||||
|
|
||||||
|
@ -29,16 +28,11 @@
|
||||||
|
|
||||||
Bluefruit UART friend は SPI friend に変換することができますが、これにはMDBT40 チップへの直接の再書き込みとはんだ付けが[必要です](https://github.com/qmk/qmk_firmware/issues/2274)。
|
Bluefruit UART friend は SPI friend に変換することができますが、これにはMDBT40 チップへの直接の再書き込みとはんだ付けが[必要です](https://github.com/qmk/qmk_firmware/issues/2274)。
|
||||||
|
|
||||||
## Adafruit EZ-Key hid
|
|
||||||
これには[ハードウェアの変更](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts)が必要ですが、Makefile を使って有効にすることができます。ファームウェアは引き続き USB 経由で文字を出力するため、コンピュータ経由で充電する場合は注意してください。任意にオフにするために Bluefruit 上にスイッチを持つことは理にかなっています。
|
|
||||||
|
|
||||||
|
|
||||||
<!-- FIXME: Document bluetooth support more completely. -->
|
<!-- FIXME: Document bluetooth support more completely. -->
|
||||||
## Bluetooth の Rules.mk オプション
|
## Bluetooth の Rules.mk オプション
|
||||||
これらのうちの1つだけを使ってください
|
これらのうちの1つだけを使ってください
|
||||||
* BLUETOOTH_ENABLE = yes (レガシーオプション)
|
* BLUETOOTH_ENABLE = yes (レガシーオプション)
|
||||||
* BLUETOOTH = RN42
|
* BLUETOOTH = RN42
|
||||||
* BLUETOOTH = AdafruitEZKey
|
|
||||||
* BLUETOOTH = AdafruitBLE
|
* BLUETOOTH = AdafruitBLE
|
||||||
|
|
||||||
## Bluetooth キーコード
|
## Bluetooth キーコード
|
||||||
|
|
|
@ -106,10 +106,6 @@ make コマンド自体にもいくつかの追加オプションがあります
|
||||||
|
|
||||||
詳細と制限については、[Unicode ページ](ja/feature_unicode.md) を見てください。
|
詳細と制限については、[Unicode ページ](ja/feature_unicode.md) を見てください。
|
||||||
|
|
||||||
`BLUETOOTH_ENABLE`
|
|
||||||
|
|
||||||
これによりキーコードをワイヤレスで送信するために Bluefruit EZ-key と連動することができます。D2 と D3 ピンを使います。
|
|
||||||
|
|
||||||
`AUDIO_ENABLE`
|
`AUDIO_ENABLE`
|
||||||
|
|
||||||
C6 ピン(抽象化が必要)でオーディオ出力できます。詳細は[オーディオページ](ja/feature_audio.md)を見てください。
|
C6 ピン(抽象化が必要)でオーディオ出力できます。詳細は[オーディオページ](ja/feature_audio.md)を見てください。
|
||||||
|
|
|
@ -132,12 +132,6 @@ ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
|
||||||
TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
|
TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey)
|
|
||||||
TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
|
|
||||||
TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_EZKEY
|
|
||||||
TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(strip $(BLUETOOTH)), RN42)
|
ifeq ($(strip $(BLUETOOTH)), RN42)
|
||||||
TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
|
TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
|
||||||
TMK_COMMON_DEFS += -DMODULE_RN42
|
TMK_COMMON_DEFS += -DMODULE_RN42
|
||||||
|
|
|
@ -23,8 +23,7 @@ ifeq ($(strip $(MIDI_ENABLE)), yes)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
|
ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
|
||||||
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
|
LUFA_SRC += outputselect.c \
|
||||||
outputselect.c \
|
|
||||||
$(TMK_DIR)/protocol/serial_uart.c
|
$(TMK_DIR)/protocol/serial_uart.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -35,15 +34,8 @@ ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
|
||||||
$(LUFA_DIR)/adafruit_ble.cpp
|
$(LUFA_DIR)/adafruit_ble.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey)
|
|
||||||
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
|
|
||||||
outputselect.c \
|
|
||||||
$(TMK_DIR)/protocol/serial_uart.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(strip $(BLUETOOTH)), RN42)
|
ifeq ($(strip $(BLUETOOTH)), RN42)
|
||||||
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
|
LUFA_SRC += outputselect.c \
|
||||||
outputselect.c \
|
|
||||||
$(TMK_DIR)/protocol/serial_uart.c
|
$(TMK_DIR)/protocol/serial_uart.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
Bluefruit Protocol for TMK firmware
|
|
||||||
Author: Benjamin Gould, 2013
|
|
||||||
Jack Humbert, 2015
|
|
||||||
Based on code Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "report.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "bluetooth.h"
|
|
||||||
|
|
||||||
void bluefruit_keyboard_print_report(report_keyboard_t *report) {
|
|
||||||
if (!debug_keyboard) return;
|
|
||||||
dprintf("keys: ");
|
|
||||||
for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
|
||||||
debug_hex8(report->keys[i]);
|
|
||||||
dprintf(" ");
|
|
||||||
}
|
|
||||||
dprintf(" mods: ");
|
|
||||||
debug_hex8(report->mods);
|
|
||||||
dprintf(" reserved: ");
|
|
||||||
debug_hex8(report->reserved);
|
|
||||||
dprintf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void bluefruit_serial_send(uint8_t data) { serial_send(data); }
|
|
|
@ -1,96 +0,0 @@
|
||||||
/*
|
|
||||||
Bluefruit Protocol for TMK firmware
|
|
||||||
Author: Benjamin Gould, 2013
|
|
||||||
Jack Humbert, 2015
|
|
||||||
Based on code Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../serial.h"
|
|
||||||
|
|
||||||
void bluefruit_serial_send(uint8_t data);
|
|
||||||
|
|
||||||
// https://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetooth-hid-keyboard/sending-keys-via-serial#raw-hid-consumer-reports-8-14
|
|
||||||
static inline uint16_t CONSUMER2BLUEFRUIT(uint16_t usage) {
|
|
||||||
switch (usage) {
|
|
||||||
case AC_HOME:
|
|
||||||
return 0x0001;
|
|
||||||
case AL_KEYBOARD_LAYOUT:
|
|
||||||
return 0x0002;
|
|
||||||
case AC_SEARCH:
|
|
||||||
return 0x0004;
|
|
||||||
case SNAPSHOT:
|
|
||||||
return 0x0008;
|
|
||||||
case AUDIO_VOL_UP:
|
|
||||||
return 0x0010;
|
|
||||||
case AUDIO_VOL_DOWN:
|
|
||||||
return 0x0020;
|
|
||||||
case TRANSPORT_PLAY_PAUSE:
|
|
||||||
return 0x0040;
|
|
||||||
case TRANSPORT_FAST_FORWARD:
|
|
||||||
return 0x0080;
|
|
||||||
case TRANSPORT_REWIND:
|
|
||||||
return 0x0100;
|
|
||||||
case TRANSPORT_NEXT_TRACK:
|
|
||||||
return 0x0200;
|
|
||||||
case TRANSPORT_PREV_TRACK:
|
|
||||||
return 0x0400;
|
|
||||||
case TRANSPORT_RANDOM_PLAY:
|
|
||||||
return 0x0800;
|
|
||||||
case TRANSPORT_STOP:
|
|
||||||
return 0x1000;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://cdn.sparkfun.com/datasheets/Wireless/Bluetooth/bluetooth_cr_UG-v1.0r.pdf#G7.663734
|
|
||||||
static inline uint16_t CONSUMER2RN42(uint16_t usage) {
|
|
||||||
switch (usage) {
|
|
||||||
case AC_HOME:
|
|
||||||
return 0x0001;
|
|
||||||
case AL_EMAIL:
|
|
||||||
return 0x0002;
|
|
||||||
case AC_SEARCH:
|
|
||||||
return 0x0004;
|
|
||||||
case AL_KEYBOARD_LAYOUT:
|
|
||||||
return 0x0008;
|
|
||||||
case AUDIO_VOL_UP:
|
|
||||||
return 0x0010;
|
|
||||||
case AUDIO_VOL_DOWN:
|
|
||||||
return 0x0020;
|
|
||||||
case AUDIO_MUTE:
|
|
||||||
return 0x0040;
|
|
||||||
case TRANSPORT_PLAY_PAUSE:
|
|
||||||
return 0x0080;
|
|
||||||
case TRANSPORT_NEXT_TRACK:
|
|
||||||
return 0x0100;
|
|
||||||
case TRANSPORT_PREV_TRACK:
|
|
||||||
return 0x0200;
|
|
||||||
case TRANSPORT_STOP:
|
|
||||||
return 0x0400;
|
|
||||||
case TRANSPORT_EJECT:
|
|
||||||
return 0x0800;
|
|
||||||
case TRANSPORT_FAST_FORWARD:
|
|
||||||
return 0x1000;
|
|
||||||
case TRANSPORT_REWIND:
|
|
||||||
return 0x2000;
|
|
||||||
case TRANSPORT_STOP_EJECT:
|
|
||||||
return 0x4000;
|
|
||||||
case AL_LOCAL_BROWSER:
|
|
||||||
return 0x8000;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -69,7 +69,7 @@ extern keymap_config_t keymap_config;
|
||||||
# ifdef MODULE_ADAFRUIT_BLE
|
# ifdef MODULE_ADAFRUIT_BLE
|
||||||
# include "adafruit_ble.h"
|
# include "adafruit_ble.h"
|
||||||
# else
|
# else
|
||||||
# include "bluetooth.h"
|
# include "../serial.h"
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -89,6 +89,46 @@ extern keymap_config_t keymap_config;
|
||||||
# include "joystick.h"
|
# include "joystick.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// https://cdn.sparkfun.com/datasheets/Wireless/Bluetooth/bluetooth_cr_UG-v1.0r.pdf#G7.663734
|
||||||
|
static inline uint16_t CONSUMER2RN42(uint16_t usage) {
|
||||||
|
switch (usage) {
|
||||||
|
case AC_HOME:
|
||||||
|
return 0x0001;
|
||||||
|
case AL_EMAIL:
|
||||||
|
return 0x0002;
|
||||||
|
case AC_SEARCH:
|
||||||
|
return 0x0004;
|
||||||
|
case AL_KEYBOARD_LAYOUT:
|
||||||
|
return 0x0008;
|
||||||
|
case AUDIO_VOL_UP:
|
||||||
|
return 0x0010;
|
||||||
|
case AUDIO_VOL_DOWN:
|
||||||
|
return 0x0020;
|
||||||
|
case AUDIO_MUTE:
|
||||||
|
return 0x0040;
|
||||||
|
case TRANSPORT_PLAY_PAUSE:
|
||||||
|
return 0x0080;
|
||||||
|
case TRANSPORT_NEXT_TRACK:
|
||||||
|
return 0x0100;
|
||||||
|
case TRANSPORT_PREV_TRACK:
|
||||||
|
return 0x0200;
|
||||||
|
case TRANSPORT_STOP:
|
||||||
|
return 0x0400;
|
||||||
|
case TRANSPORT_EJECT:
|
||||||
|
return 0x0800;
|
||||||
|
case TRANSPORT_FAST_FORWARD:
|
||||||
|
return 0x1000;
|
||||||
|
case TRANSPORT_REWIND:
|
||||||
|
return 0x2000;
|
||||||
|
case TRANSPORT_STOP_EJECT:
|
||||||
|
return 0x4000;
|
||||||
|
case AL_LOCAL_BROWSER:
|
||||||
|
return 0x8000;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t keyboard_idle = 0;
|
uint8_t keyboard_idle = 0;
|
||||||
/* 0: Boot Protocol, 1: Report Protocol(default) */
|
/* 0: Boot Protocol, 1: Report Protocol(default) */
|
||||||
uint8_t keyboard_protocol = 1;
|
uint8_t keyboard_protocol = 1;
|
||||||
|
@ -631,20 +671,13 @@ static void send_keyboard(report_keyboard_t *report) {
|
||||||
# ifdef MODULE_ADAFRUIT_BLE
|
# ifdef MODULE_ADAFRUIT_BLE
|
||||||
adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys));
|
adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys));
|
||||||
# elif MODULE_RN42
|
# elif MODULE_RN42
|
||||||
bluefruit_serial_send(0xFD);
|
serial_send(0xFD);
|
||||||
bluefruit_serial_send(0x09);
|
serial_send(0x09);
|
||||||
bluefruit_serial_send(0x01);
|
serial_send(0x01);
|
||||||
bluefruit_serial_send(report->mods);
|
serial_send(report->mods);
|
||||||
bluefruit_serial_send(report->reserved);
|
serial_send(report->reserved);
|
||||||
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
||||||
bluefruit_serial_send(report->keys[i]);
|
serial_send(report->keys[i]);
|
||||||
}
|
|
||||||
# else
|
|
||||||
bluefruit_serial_send(0xFD);
|
|
||||||
bluefruit_serial_send(report->mods);
|
|
||||||
bluefruit_serial_send(report->reserved);
|
|
||||||
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
|
||||||
bluefruit_serial_send(report->keys[i]);
|
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
@ -697,15 +730,15 @@ static void send_mouse(report_mouse_t *report) {
|
||||||
// FIXME: mouse buttons
|
// FIXME: mouse buttons
|
||||||
adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h, report->buttons);
|
adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h, report->buttons);
|
||||||
# else
|
# else
|
||||||
bluefruit_serial_send(0xFD);
|
serial_send(0xFD);
|
||||||
bluefruit_serial_send(0x00);
|
serial_send(0x00);
|
||||||
bluefruit_serial_send(0x03);
|
serial_send(0x03);
|
||||||
bluefruit_serial_send(report->buttons);
|
serial_send(report->buttons);
|
||||||
bluefruit_serial_send(report->x);
|
serial_send(report->x);
|
||||||
bluefruit_serial_send(report->y);
|
serial_send(report->y);
|
||||||
bluefruit_serial_send(report->v); // should try sending the wheel v here
|
serial_send(report->v); // should try sending the wheel v here
|
||||||
bluefruit_serial_send(report->h); // should try sending the wheel h here
|
serial_send(report->h); // should try sending the wheel h here
|
||||||
bluefruit_serial_send(0x00);
|
serial_send(0x00);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,25 +811,11 @@ static void send_consumer(uint16_t data) {
|
||||||
if (data == last_data) return;
|
if (data == last_data) return;
|
||||||
last_data = data;
|
last_data = data;
|
||||||
uint16_t bitmap = CONSUMER2RN42(data);
|
uint16_t bitmap = CONSUMER2RN42(data);
|
||||||
bluefruit_serial_send(0xFD);
|
serial_send(0xFD);
|
||||||
bluefruit_serial_send(0x03);
|
serial_send(0x03);
|
||||||
bluefruit_serial_send(0x03);
|
serial_send(0x03);
|
||||||
bluefruit_serial_send(bitmap & 0xFF);
|
serial_send(bitmap & 0xFF);
|
||||||
bluefruit_serial_send((bitmap >> 8) & 0xFF);
|
serial_send((bitmap >> 8) & 0xFF);
|
||||||
# else
|
|
||||||
static uint16_t last_data = 0;
|
|
||||||
if (data == last_data) return;
|
|
||||||
last_data = data;
|
|
||||||
uint16_t bitmap = CONSUMER2BLUEFRUIT(data);
|
|
||||||
bluefruit_serial_send(0xFD);
|
|
||||||
bluefruit_serial_send(0x00);
|
|
||||||
bluefruit_serial_send(0x02);
|
|
||||||
bluefruit_serial_send(bitmap & 0xFF);
|
|
||||||
bluefruit_serial_send((bitmap >> 8) & 0xFF);
|
|
||||||
bluefruit_serial_send(0x00);
|
|
||||||
bluefruit_serial_send(0x00);
|
|
||||||
bluefruit_serial_send(0x00);
|
|
||||||
bluefruit_serial_send(0x00);
|
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,7 +1037,7 @@ int main(void) {
|
||||||
setup_usb();
|
setup_usb();
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
#if defined(MODULE_ADAFRUIT_EZKEY) || defined(MODULE_RN42)
|
#if defined(MODULE_RN42)
|
||||||
serial_init();
|
serial_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue