Don't compile outputselect.c if Bluetooth is disabled (#9356)

master
Ryan 2020-06-17 21:43:20 +10:00 committed by James Young
parent e7434c874b
commit 3b34858b77
3 changed files with 23 additions and 18 deletions

View File

@ -17,7 +17,7 @@
#include <ctype.h> #include <ctype.h>
#include "quantum.h" #include "quantum.h"
#ifdef PROTOCOL_LUFA #ifdef BLUETOOTH_ENABLE
# include "outputselect.h" # include "outputselect.h"
#endif #endif
@ -618,7 +618,7 @@ void matrix_init_quantum() {
#ifdef HAPTIC_ENABLE #ifdef HAPTIC_ENABLE
haptic_init(); haptic_init();
#endif #endif
#ifdef OUTPUT_AUTO_ENABLE #if defined(BLUETOOTH_ENABLE) && defined(OUTPUT_AUTO_ENABLE)
set_output(OUTPUT_AUTO); set_output(OUTPUT_AUTO);
#endif #endif

View File

@ -15,9 +15,8 @@ else
endif endif
LUFA_SRC = lufa.c \ LUFA_SRC = lufa.c \
usb_descriptor.c \ usb_descriptor.c \
outputselect.c \ $(LUFA_SRC_USB)
$(LUFA_SRC_USB)
ifeq ($(strip $(MIDI_ENABLE)), yes) ifeq ($(strip $(MIDI_ENABLE)), yes)
include $(TMK_PATH)/protocol/midi.mk include $(TMK_PATH)/protocol/midi.mk
@ -25,23 +24,27 @@ endif
ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
$(TMK_DIR)/protocol/serial_uart.c outputselect.c \
$(TMK_DIR)/protocol/serial_uart.c
endif endif
ifeq ($(strip $(BLUETOOTH)), AdafruitBLE) ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
LUFA_SRC += spi_master.c LUFA_SRC += spi_master.c \
LUFA_SRC += analog.c analog.c \
LUFA_SRC += $(LUFA_DIR)/adafruit_ble.cpp outputselect.c \
$(LUFA_DIR)/adafruit_ble.cpp
endif endif
ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey) ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey)
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
$(TMK_DIR)/protocol/serial_uart.c outputselect.c \
$(TMK_DIR)/protocol/serial_uart.c
endif endif
ifeq ($(strip $(BLUETOOTH)), RN42) ifeq ($(strip $(BLUETOOTH)), RN42)
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
$(TMK_DIR)/protocol/serial_uart.c outputselect.c \
$(TMK_DIR)/protocol/serial_uart.c
endif endif
ifeq ($(strip $(VIRTSER_ENABLE)), yes) ifeq ($(strip $(VIRTSER_ENABLE)), yes)

View File

@ -53,7 +53,6 @@
#include "lufa.h" #include "lufa.h"
#include "quantum.h" #include "quantum.h"
#include <util/atomic.h> #include <util/atomic.h>
#include "outputselect.h"
#ifdef NKRO_ENABLE #ifdef NKRO_ENABLE
# include "keycode_config.h" # include "keycode_config.h"
@ -66,6 +65,7 @@ extern keymap_config_t keymap_config;
#endif #endif
#ifdef BLUETOOTH_ENABLE #ifdef BLUETOOTH_ENABLE
# include "outputselect.h"
# ifdef MODULE_ADAFRUIT_BLE # ifdef MODULE_ADAFRUIT_BLE
# include "adafruit_ble.h" # include "adafruit_ble.h"
# else # else
@ -554,9 +554,10 @@ static uint8_t keyboard_leds(void) { return keyboard_led_state; }
*/ */
static void send_keyboard(report_keyboard_t *report) { static void send_keyboard(report_keyboard_t *report) {
uint8_t timeout = 255; uint8_t timeout = 255;
uint8_t where = where_to_send();
#ifdef BLUETOOTH_ENABLE #ifdef BLUETOOTH_ENABLE
uint8_t where = where_to_send();
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
# 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));
@ -578,11 +579,11 @@ static void send_keyboard(report_keyboard_t *report) {
} }
# endif # endif
} }
#endif
if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) { if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) {
return; return;
} }
#endif
/* Select the Keyboard Report Endpoint */ /* Select the Keyboard Report Endpoint */
uint8_t ep = KEYBOARD_IN_EPNUM; uint8_t ep = KEYBOARD_IN_EPNUM;
@ -618,9 +619,10 @@ static void send_keyboard(report_keyboard_t *report) {
static void send_mouse(report_mouse_t *report) { static void send_mouse(report_mouse_t *report) {
#ifdef MOUSE_ENABLE #ifdef MOUSE_ENABLE
uint8_t timeout = 255; uint8_t timeout = 255;
uint8_t where = where_to_send();
# ifdef BLUETOOTH_ENABLE # ifdef BLUETOOTH_ENABLE
uint8_t where = where_to_send();
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
# ifdef MODULE_ADAFRUIT_BLE # ifdef MODULE_ADAFRUIT_BLE
// FIXME: mouse buttons // FIXME: mouse buttons
@ -637,11 +639,11 @@ static void send_mouse(report_mouse_t *report) {
bluefruit_serial_send(0x00); bluefruit_serial_send(0x00);
# endif # endif
} }
# endif
if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) { if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) {
return; return;
} }
# endif
/* Select the Mouse Report Endpoint */ /* Select the Mouse Report Endpoint */
Endpoint_SelectEndpoint(MOUSE_IN_EPNUM); Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
@ -696,9 +698,9 @@ static void send_system(uint16_t data) {
*/ */
static void send_consumer(uint16_t data) { static void send_consumer(uint16_t data) {
#ifdef EXTRAKEY_ENABLE #ifdef EXTRAKEY_ENABLE
# ifdef BLUETOOTH_ENABLE
uint8_t where = where_to_send(); uint8_t where = where_to_send();
# ifdef BLUETOOTH_ENABLE
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
# ifdef MODULE_ADAFRUIT_BLE # ifdef MODULE_ADAFRUIT_BLE
adafruit_ble_send_consumer_key(data, 0); adafruit_ble_send_consumer_key(data, 0);
@ -728,11 +730,11 @@ static void send_consumer(uint16_t data) {
bluefruit_serial_send(0x00); bluefruit_serial_send(0x00);
# endif # endif
} }
# endif
if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) { if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) {
return; return;
} }
# endif
send_extra(REPORT_ID_CONSUMER, data); send_extra(REPORT_ID_CONSUMER, data);
#endif #endif