Control Surface
pin-t-adl
MIDI Control Surface library for Arduino
src
MIDI_Interfaces
USBMIDI
USBMIDI_Teensy3.hpp
Go to the documentation of this file.
1
#include "
USBMIDI.hpp
"
2
3
#include <
AH/Teensy/TeensyUSBTypes.hpp
>
4
5
BEGIN_CS_NAMESPACE
6
7
struct
USBDeviceMIDIBackend
{
8
using
MIDIUSBPacket_t
=
AH::Array<uint8_t, 4>
;
9
MIDIUSBPacket_t
read
();
10
void
write
(
MIDIUSBPacket_t
data);
11
void
sendNow
();
12
bool
preferImmediateSend
();
13
};
14
15
END_CS_NAMESPACE
16
17
#ifdef TEENSY_MIDIUSB_ENABLED
18
19
#include <string.h>
20
#include <usb_midi.h>
21
22
BEGIN_CS_NAMESPACE
23
24
inline
USBDeviceMIDIBackend::MIDIUSBPacket_t
USBDeviceMIDIBackend::read
() {
25
return
u32_to_bytes
(usb_midi_read_message());
26
}
27
28
inline
void
USBDeviceMIDIBackend::write
(MIDIUSBPacket_t data) {
29
usb_midi_write_packed(
bytes_to_u32
(data));
30
}
31
32
inline
void
USBDeviceMIDIBackend::sendNow
() { usb_midi_flush_output(); }
33
34
inline
bool
USBDeviceMIDIBackend::preferImmediateSend
() {
return
false
; }
35
36
END_CS_NAMESPACE
37
38
#endif
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition:
Settings/NamespaceSettings.hpp:10
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition:
Settings/NamespaceSettings.hpp:9
TeensyUSBTypes.hpp
USBMIDI.hpp
u32_to_bytes
AH::Array< uint8_t, 4 > u32_to_bytes(uint32_t u)
Definition:
USBMIDI.hpp:9
bytes_to_u32
uint32_t bytes_to_u32(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3)
Definition:
USBMIDI.hpp:18
AH::Array< uint8_t, 4 >
USBDeviceMIDIBackend
Definition:
USBMIDI_Adafruit_TinyUSB.hpp:8
USBDeviceMIDIBackend::sendNow
void sendNow()
USBDeviceMIDIBackend::read
MIDIUSBPacket_t read()
USBDeviceMIDIBackend::write
void write(MIDIUSBPacket_t data)
USBDeviceMIDIBackend::preferImmediateSend
bool preferImmediateSend()
USBDeviceMIDIBackend::write
void write(MIDIUSBPacket_t packet)
Definition:
USBMIDI_Adafruit_TinyUSB.hpp:22
USBDeviceMIDIBackend::read
MIDIUSBPacket_t read()
Definition:
USBMIDI_Adafruit_TinyUSB.hpp:17
Generated by
1.9.4