|
|
|
@ -67,10 +67,11 @@
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef BLUETOOTH_ENABLE
|
|
|
|
|
#include "bluetooth.h"
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef ADAFRUIT_BLE_ENABLE
|
|
|
|
|
#ifdef MODULE_ADAFRUIT_BLE
|
|
|
|
|
#include "adafruit_ble.h"
|
|
|
|
|
#else
|
|
|
|
|
#include "bluetooth.h"
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef VIRTSER_ENABLE
|
|
|
|
@ -603,16 +604,14 @@ static void send_keyboard(report_keyboard_t *report)
|
|
|
|
|
|
|
|
|
|
#ifdef BLUETOOTH_ENABLE
|
|
|
|
|
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
|
|
|
|
|
#ifdef MODULE_ADAFRUIT_BLE
|
|
|
|
|
adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys));
|
|
|
|
|
#else
|
|
|
|
|
bluefruit_serial_send(0xFD);
|
|
|
|
|
for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) {
|
|
|
|
|
bluefruit_serial_send(report->raw[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ADAFRUIT_BLE_ENABLE
|
|
|
|
|
if (where == OUTPUT_ADAFRUIT_BLE) {
|
|
|
|
|
adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys));
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -661,6 +660,10 @@ static void send_mouse(report_mouse_t *report)
|
|
|
|
|
|
|
|
|
|
#ifdef BLUETOOTH_ENABLE
|
|
|
|
|
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
|
|
|
|
|
#ifdef MODULE_ADAFRUIT_BLE
|
|
|
|
|
// FIXME: mouse buttons
|
|
|
|
|
adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h);
|
|
|
|
|
#else
|
|
|
|
|
bluefruit_serial_send(0xFD);
|
|
|
|
|
bluefruit_serial_send(0x00);
|
|
|
|
|
bluefruit_serial_send(0x03);
|
|
|
|
@ -670,13 +673,7 @@ static void send_mouse(report_mouse_t *report)
|
|
|
|
|
bluefruit_serial_send(report->v); // should try sending the wheel v here
|
|
|
|
|
bluefruit_serial_send(report->h); // should try sending the wheel h here
|
|
|
|
|
bluefruit_serial_send(0x00);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ADAFRUIT_BLE_ENABLE
|
|
|
|
|
if (where == OUTPUT_ADAFRUIT_BLE) {
|
|
|
|
|
// FIXME: mouse buttons
|
|
|
|
|
adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -727,6 +724,9 @@ static void send_consumer(uint16_t data)
|
|
|
|
|
|
|
|
|
|
#ifdef BLUETOOTH_ENABLE
|
|
|
|
|
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
|
|
|
|
|
#ifdef MODULE_ADAFRUIT_BLE
|
|
|
|
|
adafruit_ble_send_consumer_key(data, 0);
|
|
|
|
|
#else
|
|
|
|
|
static uint16_t last_data = 0;
|
|
|
|
|
if (data == last_data) return;
|
|
|
|
|
last_data = data;
|
|
|
|
@ -740,12 +740,7 @@ static void send_consumer(uint16_t data)
|
|
|
|
|
bluefruit_serial_send(0x00);
|
|
|
|
|
bluefruit_serial_send(0x00);
|
|
|
|
|
bluefruit_serial_send(0x00);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ADAFRUIT_BLE_ENABLE
|
|
|
|
|
if (where == OUTPUT_ADAFRUIT_BLE) {
|
|
|
|
|
adafruit_ble_send_consumer_key(data, 0);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -1130,7 +1125,7 @@ int main(void)
|
|
|
|
|
// midi_send_noteoff(&midi_device, 0, 64, 127);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef BLUETOOTH_ENABLE
|
|
|
|
|
#ifdef MODULE_ADAFRUIT_EZKEY
|
|
|
|
|
serial_init();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -1161,7 +1156,7 @@ int main(void)
|
|
|
|
|
|
|
|
|
|
print("Keyboard start.\n");
|
|
|
|
|
while (1) {
|
|
|
|
|
#if !defined(BLUETOOTH_ENABLE) && !defined(ADAFRUIT_BLE_ENABLE)
|
|
|
|
|
#if !defined(BLUETOOTH_ENABLE)
|
|
|
|
|
while (USB_DeviceState == DEVICE_STATE_Suspended) {
|
|
|
|
|
print("[s]");
|
|
|
|
|
suspend_power_down();
|
|
|
|
@ -1182,7 +1177,7 @@ int main(void)
|
|
|
|
|
rgblight_task();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ADAFRUIT_BLE_ENABLE
|
|
|
|
|
#ifdef MODULE_ADAFRUIT_BLE
|
|
|
|
|
adafruit_ble_task();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|