Control Surface
pin-t-adl
MIDI Control Surface library for Arduino
src
MIDI_Interfaces
USBMIDI
USBMIDI_MIDIUSB.hpp
Go to the documentation of this file.
1
#include <
AH/Containers/Array.hpp
>
2
#include <Settings/NamespaceSettings.hpp>
3
4
#include <MIDIUSB.h>
5
6
BEGIN_CS_NAMESPACE
7
8
struct
USBDeviceMIDIBackend
{
9
using
MIDIUSBPacket_t
=
AH::Array<uint8_t, 4>
;
10
MIDIUSBPacket_t
read
() {
11
midiEventPacket_t midipacket = MidiUSB.read();
12
return
{{midipacket.header, midipacket.byte1, midipacket.byte2,
13
midipacket.byte3}};
14
}
15
void
write
(
MIDIUSBPacket_t
d) {
16
midiEventPacket_t msg{d.
data
[0], d.
data
[1], d.
data
[2], d.
data
[3]};
17
MidiUSB.sendMIDI(msg);
18
}
19
void
sendNow
() { MidiUSB.flush(); }
20
bool
preferImmediateSend
() {
return
true
; }
21
};
22
23
END_CS_NAMESPACE
Array.hpp
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition:
Settings/NamespaceSettings.hpp:10
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition:
Settings/NamespaceSettings.hpp:9
AH::Array< uint8_t, 4 >
AH::Array::data
T data[N]
Definition:
Array.hpp:37
USBDeviceMIDIBackend
Definition:
USBMIDI_Adafruit_TinyUSB.hpp:8
USBDeviceMIDIBackend::sendNow
void sendNow()
Definition:
USBMIDI_MIDIUSB.hpp:19
USBDeviceMIDIBackend::read
MIDIUSBPacket_t read()
Definition:
USBMIDI_MIDIUSB.hpp:10
USBDeviceMIDIBackend::write
void write(MIDIUSBPacket_t d)
Definition:
USBMIDI_MIDIUSB.hpp:15
USBDeviceMIDIBackend::preferImmediateSend
bool preferImmediateSend()
Definition:
USBMIDI_MIDIUSB.hpp:20
Generated by
1.9.4