Merge remote-tracking branch 'upstream/develop' into xap

This commit is contained in:
Nick Brassel
2025-04-22 14:58:42 +10:00
46 changed files with 642 additions and 273 deletions
+4 -13
View File
@@ -134,8 +134,6 @@ void protocol_setup(void) {
// chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
}
static host_driver_t *driver = NULL;
void protocol_pre_init(void) {
/* Init USB */
usb_event_queue_init();
@@ -146,18 +144,11 @@ void protocol_pre_init(void) {
#endif
/* Wait until USB is active */
while (true) {
#if defined(USB_WAIT_FOR_ENUMERATION)
if (USB_DRIVER.state == USB_ACTIVE) {
driver = &chibios_driver;
break;
}
#else
driver = &chibios_driver;
break;
#endif
#ifdef USB_WAIT_FOR_ENUMERATION
while (USB_DRIVER.state != USB_ACTIVE) {
wait_ms(50);
}
#endif
/* Do need to wait here!
* Otherwise the next print might start a transfer on console EP
@@ -170,7 +161,7 @@ void protocol_pre_init(void) {
}
void protocol_post_init(void) {
host_set_driver(driver);
host_set_driver(&chibios_driver);
}
void protocol_pre_task(void) {
+7 -4
View File
@@ -31,8 +31,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
#ifdef BLUETOOTH_ENABLE
# ifndef CONNECTION_ENABLE
# error CONNECTION_ENABLE required and not enabled
# endif
# include "connection.h"
# include "bluetooth.h"
# include "outputselect.h"
#endif
#ifdef NKRO_ENABLE
@@ -74,7 +77,7 @@ led_t host_keyboard_led_state(void) {
/* send report */
void host_keyboard_send(report_keyboard_t *report) {
#ifdef BLUETOOTH_ENABLE
if (where_to_send() == OUTPUT_BLUETOOTH) {
if (connection_get_host() == CONNECTION_HOST_BLUETOOTH) {
bluetooth_send_keyboard(report);
return;
}
@@ -111,7 +114,7 @@ void host_nkro_send(report_nkro_t *report) {
void host_mouse_send(report_mouse_t *report) {
#ifdef BLUETOOTH_ENABLE
if (where_to_send() == OUTPUT_BLUETOOTH) {
if (connection_get_host() == CONNECTION_HOST_BLUETOOTH) {
bluetooth_send_mouse(report);
return;
}
@@ -147,7 +150,7 @@ void host_consumer_send(uint16_t usage) {
last_consumer_usage = usage;
#ifdef BLUETOOTH_ENABLE
if (where_to_send() == OUTPUT_BLUETOOTH) {
if (connection_get_host() == CONNECTION_HOST_BLUETOOTH) {
bluetooth_send_consumer(usage);
return;
}