Control Surface
main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
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
MIDIUSB_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:14
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:11
AH::SPIShiftRegisterOut
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
Definition
SPIShiftRegisterOut.hpp:28
AH::Array< uint8_t, 4 >
AH::Array::data
T data[N]
Definition
Array.hpp:33
MIDIUSB_USBDeviceMIDIBackend
Definition
USBMIDI_MIDIUSB.hpp:8
MIDIUSB_USBDeviceMIDIBackend::sendNow
void sendNow()
Definition
USBMIDI_MIDIUSB.hpp:19
MIDIUSB_USBDeviceMIDIBackend::read
MIDIUSBPacket_t read()
Definition
USBMIDI_MIDIUSB.hpp:10
MIDIUSB_USBDeviceMIDIBackend::write
void write(MIDIUSBPacket_t d)
Definition
USBMIDI_MIDIUSB.hpp:15
MIDIUSB_USBDeviceMIDIBackend::preferImmediateSend
bool preferImmediateSend()
Definition
USBMIDI_MIDIUSB.hpp:20
Generated by
1.10.0