summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/chibios/usb_main.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2020-02-04 18:28:47 -0800
committerFlorian Didron <fdidron@users.noreply.github.com>2020-02-26 10:15:12 +0900
commitf67c942c49a7f46d52e8ea51704fba17a9372055 (patch)
tree0af89ec394cebac5dcc6c0cc6ad1e6e208c6f915 /tmk_core/protocol/chibios/usb_main.c
parent0c4d319e8dfa4f134d074eeb259830298589abc2 (diff)
Add Midi Endpoint task to ChibiOS main (#8071)
Diffstat (limited to 'tmk_core/protocol/chibios/usb_main.c')
-rw-r--r--tmk_core/protocol/chibios/usb_main.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 3d4dd59873..e3a8489011 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -902,7 +902,17 @@ bool recv_midi_packet(MIDI_EventPacket_t *const event) {
size_t size = chnReadTimeout(&drivers.midi_driver.driver, (uint8_t *)event, sizeof(MIDI_EventPacket_t), TIME_IMMEDIATE);
return size == sizeof(MIDI_EventPacket_t);
}
-
+void midi_ep_task(void) {
+ uint8_t buffer[MIDI_STREAM_EPSIZE];
+ size_t size = 0;
+ do {
+ size_t size = chnReadTimeout(&drivers.midi_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
+ if (size > 0) {
+ MIDI_EventPacket_t event;
+ recv_midi_packet(&event);
+ }
+ } while (size > 0);
+}
#endif
#ifdef VIRTSER_ENABLE