Skip to content

Commit

Permalink
adafruit_ble: support chibios
Browse files Browse the repository at this point in the history
  • Loading branch information
Gigahawk committed May 5, 2022
1 parent 5a6c271 commit 0781239
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tmk_core/protocol/chibios/chibios.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ void send_digitizer(report_digitizer_t *report);
/* host struct */
host_driver_t chibios_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer, send_programmable_button};

#ifdef BLUETOOTH_ENABLE
# include "outputselect.h"
# ifdef BLUETOOTH_BLUEFRUIT_LE
# include "bluefruit_le.h"
# elif BLUETOOTH_RN42
# include "rn42.h"
# endif
#endif

#ifdef VIRTSER_ENABLE
void virtser_task(void);
#endif
Expand Down Expand Up @@ -209,6 +218,9 @@ void protocol_post_task(void) {
#ifdef CONSOLE_ENABLE
console_task();
#endif
#ifdef BLUETOOTH_BLUEFRUIT_LE
bluefruit_le_task();
#endif
#ifdef MIDI_ENABLE
midi_ep_task();
#endif
Expand Down
20 changes: 20 additions & 0 deletions tmk_core/protocol/chibios/usb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
extern keymap_config_t keymap_config;
#endif

#ifdef BLUETOOTH_ENABLE
# include "outputselect.h"
# ifdef BLUETOOTH_BLUEFRUIT_LE
# include "bluefruit_le.h"
# elif BLUETOOTH_RN42
# include "rn42.h"
# endif
#endif

#ifdef JOYSTICK_ENABLE
# include "joystick.h"
#endif
Expand Down Expand Up @@ -828,6 +837,17 @@ uint8_t keyboard_leds(void) {
/* prepare and start sending a report IN
* not callable from ISR or locked state */
void send_keyboard(report_keyboard_t *report) {
#ifdef BLUETOOTH_ENABLE
if (where_to_send() == OUTPUT_BLUETOOTH) {
# ifdef BLUETOOTH_BLUEFRUIT_LE
bluefruit_le_send_keys(report->mods, report->keys, sizeof(report->keys));
# elif BLUETOOTH_RN42
rn42_send_keyboard(report);
# endif
return;
}
#endif

osalSysLock();
if (usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) {
goto unlock;
Expand Down

0 comments on commit 0781239

Please sign in to comment.