Merge upstream QMK Firmware at '0.12.52~1'
This commit is contained in:
@@ -782,9 +782,7 @@ static void send_keyboard(report_keyboard_t *report) {
|
||||
uint8_t timeout = 255;
|
||||
|
||||
#ifdef BLUETOOTH_ENABLE
|
||||
uint8_t where = where_to_send();
|
||||
|
||||
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
|
||||
if (where_to_send() == OUTPUT_BLUETOOTH) {
|
||||
# ifdef MODULE_ADAFRUIT_BLE
|
||||
adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys));
|
||||
# elif MODULE_RN42
|
||||
@@ -797,9 +795,6 @@ static void send_keyboard(report_keyboard_t *report) {
|
||||
serial_send(report->keys[i]);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -840,9 +835,7 @@ static void send_mouse(report_mouse_t *report) {
|
||||
uint8_t timeout = 255;
|
||||
|
||||
# ifdef BLUETOOTH_ENABLE
|
||||
uint8_t where = where_to_send();
|
||||
|
||||
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
|
||||
if (where_to_send() == OUTPUT_BLUETOOTH) {
|
||||
# ifdef MODULE_ADAFRUIT_BLE
|
||||
// FIXME: mouse buttons
|
||||
adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h, report->buttons);
|
||||
@@ -857,9 +850,6 @@ static void send_mouse(report_mouse_t *report) {
|
||||
serial_send(report->h); // should try sending the wheel h here
|
||||
serial_send(0x00);
|
||||
# endif
|
||||
}
|
||||
|
||||
if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) {
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
@@ -918,9 +908,13 @@ static void send_system(uint16_t data) {
|
||||
static void send_consumer(uint16_t data) {
|
||||
#ifdef EXTRAKEY_ENABLE
|
||||
# ifdef BLUETOOTH_ENABLE
|
||||
<<<<<<< HEAD
|
||||
uint8_t where = where_to_send();
|
||||
|
||||
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
|
||||
=======
|
||||
if (where_to_send() == OUTPUT_BLUETOOTH) {
|
||||
>>>>>>> 0.12.52~1
|
||||
# ifdef MODULE_ADAFRUIT_BLE
|
||||
adafruit_ble_send_consumer_key(data);
|
||||
# elif MODULE_RN42
|
||||
@@ -934,9 +928,12 @@ static void send_consumer(uint16_t data) {
|
||||
serial_send(bitmap & 0xFF);
|
||||
serial_send((bitmap >> 8) & 0xFF);
|
||||
# endif
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
|
||||
if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) {
|
||||
=======
|
||||
>>>>>>> 0.12.52~1
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
@@ -955,9 +952,14 @@ static void send_consumer(uint16_t data) {
|
||||
* FIXME: Needs doc
|
||||
*/
|
||||
int8_t sendchar(uint8_t c) {
|
||||
<<<<<<< HEAD
|
||||
// Not wait once timeouted.
|
||||
=======
|
||||
// Do not wait if the previous write has timed_out.
|
||||
>>>>>>> 0.12.52~1
|
||||
// Because sendchar() is called so many times, waiting each call causes big lag.
|
||||
static bool timeouted = false;
|
||||
// The `timed_out` state is an approximation of the ideal `is_listener_disconnected?` state.
|
||||
static bool timed_out = false;
|
||||
|
||||
// prevents Console_Task() from running during sendchar() runs.
|
||||
// or char will be lost. These two function is mutually exclusive.
|
||||
@@ -971,11 +973,11 @@ int8_t sendchar(uint8_t c) {
|
||||
goto ERROR_EXIT;
|
||||
}
|
||||
|
||||
if (timeouted && !Endpoint_IsReadWriteAllowed()) {
|
||||
if (timed_out && !Endpoint_IsReadWriteAllowed()) {
|
||||
goto ERROR_EXIT;
|
||||
}
|
||||
|
||||
timeouted = false;
|
||||
timed_out = false;
|
||||
|
||||
uint8_t timeout = SEND_TIMEOUT;
|
||||
while (!Endpoint_IsReadWriteAllowed()) {
|
||||
@@ -986,7 +988,7 @@ int8_t sendchar(uint8_t c) {
|
||||
goto ERROR_EXIT;
|
||||
}
|
||||
if (!(timeout--)) {
|
||||
timeouted = true;
|
||||
timed_out = true;
|
||||
goto ERROR_EXIT;
|
||||
}
|
||||
_delay_ms(1);
|
||||
@@ -1136,7 +1138,6 @@ static void setup_usb(void) {
|
||||
|
||||
// for Console_Task
|
||||
USB_Device_EnableSOFEvents();
|
||||
print_set_sendchar(sendchar);
|
||||
}
|
||||
|
||||
/** \brief Main
|
||||
|
||||
@@ -21,21 +21,11 @@ enum outputs {
|
||||
|
||||
OUTPUT_NONE,
|
||||
OUTPUT_USB,
|
||||
OUTPUT_BLUETOOTH,
|
||||
|
||||
// backward compatibility
|
||||
OUTPUT_USB_AND_BT
|
||||
OUTPUT_BLUETOOTH
|
||||
};
|
||||
|
||||
/**
|
||||
* backward compatibility for BLUETOOTH_ENABLE, send to BT and USB by default
|
||||
*/
|
||||
#ifndef OUTPUT_DEFAULT
|
||||
# ifdef BLUETOOTH_ENABLE
|
||||
# define OUTPUT_DEFAULT OUTPUT_USB_AND_BT
|
||||
# else
|
||||
# define OUTPUT_DEFAULT OUTPUT_AUTO
|
||||
# endif
|
||||
# define OUTPUT_DEFAULT OUTPUT_AUTO
|
||||
#endif
|
||||
|
||||
void set_output(uint8_t output);
|
||||
|
||||
Reference in New Issue
Block a user