Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
USBMIDI_Adafruit_TinyUSB.hpp
Go to the documentation of this file.
2#include <Settings/NamespaceSettings.hpp>
3
4#include <Adafruit_TinyUSB.h>
5
7
10 void begin() {
11 // Manual begin() is required on core without built-in support e.g. mbed rp2040
12 if (!TinyUSBDevice.isInitialized())
13 TinyUSBDevice.begin(0);
14 backend.begin();
15 // If already enumerated, additional class driver begin() e.g msc, hid, midi won't take effect until re-enumeration
16 if (TinyUSBDevice.mounted()) {
17 TinyUSBDevice.detach();
18 delay(10);
19 TinyUSBDevice.attach();
20 }
21 }
23#ifdef TINYUSB_NEED_POLLING_TASK
24 TinyUSBDevice.task();
25#endif
26 MIDIUSBPacket_t packet {};
27 if (TinyUSBDevice.mounted())
28 backend.readPacket(packet.data);
29 return packet;
30 }
31 void write(MIDIUSBPacket_t packet) {
32 if (TinyUSBDevice.mounted())
33 backend.writePacket(packet.data);
34 }
35 void sendNow() {
36 if (TinyUSBDevice.mounted())
37 backend.flush();
38 }
39 bool preferImmediateSend() { return false; }
40
41 Adafruit_USBD_MIDI backend;
42};
43
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
T data[N]
Definition Array.hpp:33