aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common.mk19
-rw-r--r--tmk_core/common/action_tapping.c11
-rw-r--r--tmk_core/common/eeconfig.h1
-rw-r--r--tmk_core/protocol/lufa.mk17
-rw-r--r--tmk_core/protocol/lufa/adafruit_ble.h4
-rw-r--r--tmk_core/protocol/lufa/bluetooth.h16
-rw-r--r--tmk_core/protocol/lufa/lufa.c109
-rw-r--r--tmk_core/protocol/lufa/lufa.h2
-rw-r--r--tmk_core/protocol/lufa/outputselect.c6
-rw-r--r--tmk_core/protocol/lufa/outputselect.h1
10 files changed, 122 insertions, 64 deletions
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index a86dccc61..3e0bd7dbc 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -93,14 +93,25 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
93 TMK_COMMON_DEFS += -DBACKLIGHT_ENABLE 93 TMK_COMMON_DEFS += -DBACKLIGHT_ENABLE
94endif 94endif
95 95
96ifeq ($(strip $(ADAFRUIT_BLE_ENABLE)), yes)
97 TMK_COMMON_DEFS += -DADAFRUIT_BLE_ENABLE
98endif
99
100ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) 96ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
101 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE 97 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
102endif 98endif
103 99
100ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
101 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
102 TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_BLE
103endif
104
105ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey)
106 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
107 TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_EZKEY
108endif
109
110ifeq ($(strip $(BLUETOOTH)), RN42)
111 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
112 TMK_COMMON_DEFS += -DMODULE_RN42
113endif
114
104ifeq ($(strip $(ONEHAND_ENABLE)), yes) 115ifeq ($(strip $(ONEHAND_ENABLE)), yes)
105 TMK_COMMON_DEFS += -DONEHAND_ENABLE 116 TMK_COMMON_DEFS += -DONEHAND_ENABLE
106endif 117endif
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c
index e16e11be7..bd9a69ae0 100644
--- a/tmk_core/common/action_tapping.c
+++ b/tmk_core/common/action_tapping.c
@@ -228,6 +228,7 @@ bool process_tapping(keyrecord_t *keyp)
228 if (WITHIN_TAPPING_TERM(event)) { 228 if (WITHIN_TAPPING_TERM(event)) {
229 if (event.pressed) { 229 if (event.pressed) {
230 if (IS_TAPPING_KEY(event.key)) { 230 if (IS_TAPPING_KEY(event.key)) {
231#ifndef TAPPING_FORCE_HOLD
231 if (!tapping_key.tap.interrupted && tapping_key.tap.count > 0) { 232 if (!tapping_key.tap.interrupted && tapping_key.tap.count > 0) {
232 // sequential tap. 233 // sequential tap.
233 keyp->tap = tapping_key.tap; 234 keyp->tap = tapping_key.tap;
@@ -237,11 +238,11 @@ bool process_tapping(keyrecord_t *keyp)
237 tapping_key = *keyp; 238 tapping_key = *keyp;
238 debug_tapping_key(); 239 debug_tapping_key();
239 return true; 240 return true;
240 } else {
241 // FIX: start new tap again
242 tapping_key = *keyp;
243 return true;
244 } 241 }
242#endif
243 // FIX: start new tap again
244 tapping_key = *keyp;
245 return true;
245 } else if (is_tap_key(event.key)) { 246 } else if (is_tap_key(event.key)) {
246 // Sequential tap can be interfered with other tap key. 247 // Sequential tap can be interfered with other tap key.
247 debug("Tapping: Start with interfering other tap.\n"); 248 debug("Tapping: Start with interfering other tap.\n");
@@ -257,7 +258,7 @@ bool process_tapping(keyrecord_t *keyp)
257 return true; 258 return true;
258 } 259 }
259 } else { 260 } else {
260 if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n") {}; 261 if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n");
261 process_record(keyp); 262 process_record(keyp);
262 return true; 263 return true;
263 } 264 }
diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h
index d8caa346f..280dc7ab6 100644
--- a/tmk_core/common/eeconfig.h
+++ b/tmk_core/common/eeconfig.h
@@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
33#define EECONFIG_BACKLIGHT (uint8_t *)6 33#define EECONFIG_BACKLIGHT (uint8_t *)6
34#define EECONFIG_AUDIO (uint8_t *)7 34#define EECONFIG_AUDIO (uint8_t *)7
35#define EECONFIG_RGBLIGHT (uint32_t *)8 35#define EECONFIG_RGBLIGHT (uint32_t *)8
36#define EECONFIG_UNICODEMODE (uint8_t *)12
36 37
37 38
38/* debug bit */ 39/* debug bit */
diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk
index de0cc795f..7ce727dab 100644
--- a/tmk_core/protocol/lufa.mk
+++ b/tmk_core/protocol/lufa.mk
@@ -22,11 +22,21 @@ ifeq ($(strip $(MIDI_ENABLE)), yes)
22 include $(TMK_PATH)/protocol/midi.mk 22 include $(TMK_PATH)/protocol/midi.mk
23endif 23endif
24 24
25ifeq ($(strip $(ADAFRUIT_BLE_ENABLE)), yes) 25ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
26 LUFA_SRC += $(LUFA_DIR)/adafruit_ble.cpp 26 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
27 $(TMK_DIR)/protocol/serial_uart.c
27endif 28endif
28 29
29ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) 30ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
31 LUFA_SRC += $(LUFA_DIR)/adafruit_ble.cpp
32endif
33
34ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey)
35 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
36 $(TMK_DIR)/protocol/serial_uart.c
37endif
38
39ifeq ($(strip $(BLUETOOTH)), RN42)
30 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ 40 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
31 $(TMK_DIR)/protocol/serial_uart.c 41 $(TMK_DIR)/protocol/serial_uart.c
32endif 42endif
@@ -54,6 +64,7 @@ LUFA_OPTS += -DUSE_FLASH_DESCRIPTORS
54LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" 64LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
55#LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT 65#LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT
56LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 66LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8
67LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8
57LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1 68LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1
58 69
59# Remote wakeup fix for ATmega32U2 https://github.com/tmk/tmk_keyboard/issues/361 70# Remote wakeup fix for ATmega32U2 https://github.com/tmk/tmk_keyboard/issues/361
diff --git a/tmk_core/protocol/lufa/adafruit_ble.h b/tmk_core/protocol/lufa/adafruit_ble.h
index 351fd55ae..b3bab3ca0 100644
--- a/tmk_core/protocol/lufa/adafruit_ble.h
+++ b/tmk_core/protocol/lufa/adafruit_ble.h
@@ -3,7 +3,7 @@
3 * Supports the Adafruit BLE board built around the nRF51822 chip. 3 * Supports the Adafruit BLE board built around the nRF51822 chip.
4 */ 4 */
5#pragma once 5#pragma once
6#ifdef ADAFRUIT_BLE_ENABLE 6#ifdef MODULE_ADAFRUIT_BLE
7#include <stdbool.h> 7#include <stdbool.h>
8#include <stdint.h> 8#include <stdint.h>
9#include <string.h> 9#include <string.h>
@@ -57,4 +57,4 @@ extern bool adafruit_ble_set_power_level(int8_t level);
57} 57}
58#endif 58#endif
59 59
60#endif // ADAFRUIT_BLE_ENABLE 60#endif // MODULE_ADAFRUIT_BLE
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 ba49284c9..ae6129d1a 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -67,10 +67,11 @@
67#endif 67#endif
68 68
69#ifdef BLUETOOTH_ENABLE 69#ifdef BLUETOOTH_ENABLE
70 #include "bluetooth.h" 70 #ifdef MODULE_ADAFRUIT_BLE
71#endif
72#ifdef ADAFRUIT_BLE_ENABLE
73 #include "adafruit_ble.h" 71 #include "adafruit_ble.h"
72 #else
73 #include "bluetooth.h"
74 #endif
74#endif 75#endif
75 76
76#ifdef VIRTSER_ENABLE 77#ifdef VIRTSER_ENABLE
@@ -602,18 +603,23 @@ static void send_keyboard(report_keyboard_t *report)
602 uint8_t where = where_to_send(); 603 uint8_t where = where_to_send();
603 604
604#ifdef BLUETOOTH_ENABLE 605#ifdef BLUETOOTH_ENABLE
605 if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { 606 if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
606 bluefruit_serial_send(0xFD); 607 #ifdef MODULE_ADAFRUIT_BLE
607 for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) {
608 bluefruit_serial_send(report->raw[i]);
609 }
610 }
611#endif
612
613#ifdef ADAFRUIT_BLE_ENABLE
614 if (where == OUTPUT_ADAFRUIT_BLE) {
615 adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys)); 608 adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys));
616 } 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 }
616 #else
617 bluefruit_serial_send(0xFD);
618 for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) {
619 bluefruit_serial_send(report->raw[i]);
620 }
621 #endif
622 }
617#endif 623#endif
618 624
619 if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) { 625 if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) {
@@ -660,24 +666,22 @@ static void send_mouse(report_mouse_t *report)
660 uint8_t where = where_to_send(); 666 uint8_t where = where_to_send();
661 667
662#ifdef BLUETOOTH_ENABLE 668#ifdef BLUETOOTH_ENABLE
663 if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { 669 if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
664 bluefruit_serial_send(0xFD); 670 #ifdef MODULE_ADAFRUIT_BLE
665 bluefruit_serial_send(0x00);
666 bluefruit_serial_send(0x03);
667 bluefruit_serial_send(report->buttons);
668 bluefruit_serial_send(report->x);
669 bluefruit_serial_send(report->y);
670 bluefruit_serial_send(report->v); // should try sending the wheel v here
671 bluefruit_serial_send(report->h); // should try sending the wheel h here
672 bluefruit_serial_send(0x00);
673 }
674#endif
675
676#ifdef ADAFRUIT_BLE_ENABLE
677 if (where == OUTPUT_ADAFRUIT_BLE) {
678 // FIXME: mouse buttons 671 // FIXME: mouse buttons
679 adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h); 672 adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h);
680 } 673 #else
674 bluefruit_serial_send(0xFD);
675 bluefruit_serial_send(0x00);
676 bluefruit_serial_send(0x03);
677 bluefruit_serial_send(report->buttons);
678 bluefruit_serial_send(report->x);
679 bluefruit_serial_send(report->y);
680 bluefruit_serial_send(report->v); // should try sending the wheel v here
681 bluefruit_serial_send(report->h); // should try sending the wheel h here
682 bluefruit_serial_send(0x00);
683 #endif
684 }
681#endif 685#endif
682 686
683 if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) { 687 if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) {
@@ -727,6 +731,19 @@ static void send_consumer(uint16_t data)
727 731
728#ifdef BLUETOOTH_ENABLE 732#ifdef BLUETOOTH_ENABLE
729 if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { 733 if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
734 #ifdef MODULE_ADAFRUIT_BLE
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);
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;
732 last_data = data; 749 last_data = data;
@@ -740,12 +757,7 @@ static void send_consumer(uint16_t data)
740 bluefruit_serial_send(0x00); 757 bluefruit_serial_send(0x00);
741 bluefruit_serial_send(0x00); 758 bluefruit_serial_send(0x00);
742 bluefruit_serial_send(0x00); 759 bluefruit_serial_send(0x00);
743 } 760 #endif
744#endif
745
746#ifdef ADAFRUIT_BLE_ENABLE
747 if (where == OUTPUT_ADAFRUIT_BLE) {
748 adafruit_ble_send_consumer_key(data, 0);
749 } 761 }
750#endif 762#endif
751 763
@@ -1101,16 +1113,23 @@ void cc_callback(MidiDevice * device,
1101 uint8_t chan, uint8_t num, uint8_t val); 1113 uint8_t chan, uint8_t num, uint8_t val);
1102void sysex_callback(MidiDevice * device, 1114void sysex_callback(MidiDevice * device,
1103 uint16_t start, uint8_t length, uint8_t * data); 1115 uint16_t start, uint8_t length, uint8_t * data);
1116
1117void setup_midi(void)
1118{
1119#ifdef MIDI_ADVANCED
1120 midi_init();
1121#endif
1122 midi_device_init(&midi_device);
1123 midi_device_set_send_func(&midi_device, usb_send_func);
1124 midi_device_set_pre_input_process_func(&midi_device, usb_get_midi);
1125}
1104#endif 1126#endif
1105 1127
1106int main(void) __attribute__ ((weak)); 1128int main(void) __attribute__ ((weak));
1107int main(void) 1129int main(void)
1108{ 1130{
1109
1110#ifdef MIDI_ENABLE 1131#ifdef MIDI_ENABLE
1111 midi_device_init(&midi_device); 1132 setup_midi();
1112 midi_device_set_send_func(&midi_device, usb_send_func);
1113 midi_device_set_pre_input_process_func(&midi_device, usb_get_midi);
1114#endif 1133#endif
1115 1134
1116 setup_mcu(); 1135 setup_mcu();
@@ -1130,7 +1149,7 @@ int main(void)
1130 // midi_send_noteoff(&midi_device, 0, 64, 127); 1149 // midi_send_noteoff(&midi_device, 0, 64, 127);
1131#endif 1150#endif
1132 1151
1133#ifdef BLUETOOTH_ENABLE 1152#if defined(MODULE_ADAFRUIT_EZKEY) || defined(MODULE_RN42)
1134 serial_init(); 1153 serial_init();
1135#endif 1154#endif
1136 1155
@@ -1161,7 +1180,7 @@ int main(void)
1161 1180
1162 print("Keyboard start.\n"); 1181 print("Keyboard start.\n");
1163 while (1) { 1182 while (1) {
1164 #if !defined(BLUETOOTH_ENABLE) && !defined(ADAFRUIT_BLE_ENABLE) 1183 #if !defined(BLUETOOTH_ENABLE)
1165 while (USB_DeviceState == DEVICE_STATE_Suspended) { 1184 while (USB_DeviceState == DEVICE_STATE_Suspended) {
1166 print("[s]"); 1185 print("[s]");
1167 suspend_power_down(); 1186 suspend_power_down();
@@ -1175,14 +1194,16 @@ int main(void)
1175 1194
1176#ifdef MIDI_ENABLE 1195#ifdef MIDI_ENABLE
1177 midi_device_process(&midi_device); 1196 midi_device_process(&midi_device);
1178 // MIDI_Task(); 1197#ifdef MIDI_ADVANCED
1198 midi_task();
1199#endif
1179#endif 1200#endif
1180 1201
1181#if defined(RGBLIGHT_ANIMATIONS) & defined(RGBLIGHT_ENABLE) 1202#if defined(RGBLIGHT_ANIMATIONS) & defined(RGBLIGHT_ENABLE)
1182 rgblight_task(); 1203 rgblight_task();
1183#endif 1204#endif
1184 1205
1185#ifdef ADAFRUIT_BLE_ENABLE 1206#ifdef MODULE_ADAFRUIT_BLE
1186 adafruit_ble_task(); 1207 adafruit_ble_task();
1187#endif 1208#endif
1188 1209
diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h
index a049fd43c..a51573786 100644
--- a/tmk_core/protocol/lufa/lufa.h
+++ b/tmk_core/protocol/lufa/lufa.h
@@ -49,7 +49,7 @@
49#include <LUFA/Drivers/USB/USB.h> 49#include <LUFA/Drivers/USB/USB.h>
50#include "host.h" 50#include "host.h"
51#ifdef MIDI_ENABLE 51#ifdef MIDI_ENABLE
52 #include "midi.h" 52 #include "process_midi.h"
53#endif 53#endif
54#ifdef __cplusplus 54#ifdef __cplusplus
55extern "C" { 55extern "C" {
diff --git a/tmk_core/protocol/lufa/outputselect.c b/tmk_core/protocol/lufa/outputselect.c
index 5d2457bff..0df5d3b75 100644
--- a/tmk_core/protocol/lufa/outputselect.c
+++ b/tmk_core/protocol/lufa/outputselect.c
@@ -14,7 +14,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
14 14
15#include "lufa.h" 15#include "lufa.h"
16#include "outputselect.h" 16#include "outputselect.h"
17#ifdef ADAFRUIT_BLE_ENABLE 17#ifdef MODULE_ADAFRUIT_BLE
18 #include "adafruit_ble.h" 18 #include "adafruit_ble.h"
19#endif 19#endif
20 20
@@ -34,9 +34,9 @@ uint8_t auto_detect_output(void) {
34 return OUTPUT_USB; 34 return OUTPUT_USB;
35 } 35 }
36 36
37#ifdef ADAFRUIT_BLE_ENABLE 37#ifdef MODULE_ADAFRUIT_BLE
38 if (adafruit_ble_is_connected()) { 38 if (adafruit_ble_is_connected()) {
39 return OUTPUT_ADAFRUIT_BLE; 39 return OUTPUT_BLUETOOTH;
40 } 40 }
41#endif 41#endif
42 42
diff --git a/tmk_core/protocol/lufa/outputselect.h b/tmk_core/protocol/lufa/outputselect.h
index 79b4dd35d..28cc3298e 100644
--- a/tmk_core/protocol/lufa/outputselect.h
+++ b/tmk_core/protocol/lufa/outputselect.h
@@ -18,7 +18,6 @@ enum outputs {
18 OUTPUT_NONE, 18 OUTPUT_NONE,
19 OUTPUT_USB, 19 OUTPUT_USB,
20 OUTPUT_BLUETOOTH, 20 OUTPUT_BLUETOOTH,
21 OUTPUT_ADAFRUIT_BLE,
22 21
23 // backward compatibility 22 // backward compatibility
24 OUTPUT_USB_AND_BT 23 OUTPUT_USB_AND_BT