summaryrefslogtreecommitdiffstats
path: root/tmk_core
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2020-02-04 18:28:47 -0800
committerGitHub <noreply@github.com>2020-02-04 18:28:47 -0800
commit0010d0c45e4aba8225249e230b3d23337e8378f4 (patch)
tree1e948e820ede77f6582fec85dc9195acc0fe270f /tmk_core
parent8a749a7a8e0c47488b19bb92ac5b35bc60f66dd8 (diff)
Add Midi Endpoint task to ChibiOS main (#8071)
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/chibios/main.c6
-rw-r--r--tmk_core/protocol/chibios/usb_main.c12
2 files changed, 17 insertions, 1 deletions
diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c
index 4b66bc5224..a61ffad12d 100644
--- a/tmk_core/protocol/chibios/main.c
+++ b/tmk_core/protocol/chibios/main.c
@@ -81,6 +81,9 @@ void raw_hid_task(void);
#ifdef CONSOLE_ENABLE
void console_task(void);
#endif
+#ifdef MIDI_ENABLE
+void midi_ep_task(void);
+#endif
/* TESTING
* Amber LED blinker thread, times are in milliseconds.
@@ -214,6 +217,9 @@ int main(void) {
#ifdef CONSOLE_ENABLE
console_task();
#endif
+#ifdef MIDI_ENABLE
+ midi_ep_task();
+#endif
#ifdef VIRTSER_ENABLE
virtser_task();
#endif
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index dd701f661e..d5eeffcbe4 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -833,7 +833,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