Skip to content

Commit

Permalink
organize and refactor bluetooth support
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Rubin <[email protected]>
  • Loading branch information
joshuarubin committed May 8, 2020
1 parent 6e4e461 commit a42eee7
Show file tree
Hide file tree
Showing 40 changed files with 423 additions and 546 deletions.
1 change: 0 additions & 1 deletion keyboards/bioi/g60ble/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@
#define KEYBOARD_LOCK_ENABLE
#define MAGIC_KEY_LOCK L
#define AdafruitBleBaud 76800
// #define AdafruitBleBattery
#define OUTPUT_AUTO_ENABLE
2 changes: 2 additions & 0 deletions keyboards/bioi/g60ble/g60ble.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#define XXX KC_NO

// clang-format off
#define LAYOUT_all( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K49, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
Expand Down Expand Up @@ -87,3 +88,4 @@
{ K30, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \
{ K40, K41, K42, XXX, XXX, K45, XXX, XXX, XXX, K49, XXX, K4B, K4C, K4D } \
}
// clang-format on
1 change: 1 addition & 0 deletions keyboards/bioi/g60ble/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes
LTO_ENABLE = yes
BLUETOOTH = AdafruitBLEUART
# BLUETOOTH_BATTERY_ENABLE = yes

LAYOUTS = 60_ansi 60_iso 60_hhkb 60_ansi_split_bs_rshift 60_tsangan_hhkb
7 changes: 7 additions & 0 deletions quantum/quantum.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
# include "outputselect.h"
#endif

#ifdef BLUETOOTH_ENABLE
# include "bluetooth.h"
#endif

#ifdef BACKLIGHT_ENABLE
# include "backlight.h"
extern backlight_config_t backlight_config;
Expand Down Expand Up @@ -331,6 +335,9 @@ bool process_record_quantum(keyrecord_t *record) {
case OUT_BT:
set_output(OUTPUT_BLUETOOTH);
return false;
case BT_UNPAIR:
bluetooth_unpair();
return false;
#endif
}
}
Expand Down
4 changes: 4 additions & 0 deletions quantum/quantum.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ extern layer_state_t layer_state;
# include "wpm.h"
#endif

#ifdef BLUETOOTH_BATTERY_ENABLE
# include "bluetooth.h"
#endif

// Function substitutions to ease GPIO manipulation
#if defined(__AVR__)
typedef uint8_t pin_t;
Expand Down
4 changes: 4 additions & 0 deletions quantum/quantum_keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ enum quantum_keycodes {
DYN_MACRO_PLAY1,
DYN_MACRO_PLAY2,

#ifdef BLUETOOTH_ENABLE
BT_UNPAIR,
#endif

// always leave at the end
SAFE_RANGE
};
Expand Down
6 changes: 6 additions & 0 deletions tmk_core/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,14 @@ endif

ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_BLE
TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_BLE_SPI
TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
endif

ifeq ($(strip $(BLUETOOTH)), AdafruitBLEUART)
TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_BLE
TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_BLE_UART
TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
endif
Expand All @@ -142,6 +144,10 @@ ifeq ($(strip $(BLUETOOTH)), RN42)
TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
endif

ifeq ($(strip $(BLUETOOTH_BATTERY_ENABLE)), yes)
TMK_COMMON_DEFS += -DBLUETOOTH_BATTERY_ENABLE
endif

ifeq ($(strip $(ONEHAND_ENABLE)), yes)
SWAP_HANDS_ENABLE = yes # backwards compatibility
endif
Expand Down
11 changes: 0 additions & 11 deletions tmk_core/protocol/bluefruit.mk

This file was deleted.

168 changes: 0 additions & 168 deletions tmk_core/protocol/bluefruit/bluefruit.c

This file was deleted.

24 changes: 0 additions & 24 deletions tmk_core/protocol/bluefruit/bluefruit.h

This file was deleted.

87 changes: 0 additions & 87 deletions tmk_core/protocol/bluefruit/main.c

This file was deleted.

Loading

0 comments on commit a42eee7

Please sign in to comment.