Control Surface
main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
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
Teensy3_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
Teensy3_USBDeviceMIDIBackend::MIDIUSBPacket_t
25
Teensy3_USBDeviceMIDIBackend::read
() {
26
return
u32_to_bytes
(usb_midi_read_message());
27
}
28
29
inline
void
Teensy3_USBDeviceMIDIBackend::write
(
MIDIUSBPacket_t
data) {
30
usb_midi_write_packed(
bytes_to_u32
(data));
31
}
32
33
inline
void
Teensy3_USBDeviceMIDIBackend::sendNow
() { usb_midi_flush_output(); }
34
35
inline
bool
Teensy3_USBDeviceMIDIBackend::preferImmediateSend
() {
36
return
false
;
37
}
38
39
END_CS_NAMESPACE
40
41
#endif
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:14
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:11
TeensyUSBTypes.hpp
USBMIDI.hpp
u32_to_bytes
AH::Array< uint8_t, 4 > u32_to_bytes(uint32_t u)
Definition
USBMIDI.hpp:16
bytes_to_u32
uint32_t bytes_to_u32(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3)
Definition
USBMIDI.hpp:25
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 >
Teensy3_USBDeviceMIDIBackend
Definition
USBMIDI_Teensy3.hpp:7
Teensy3_USBDeviceMIDIBackend::sendNow
void sendNow()
Definition
USBMIDI_Teensy3.hpp:33
Teensy3_USBDeviceMIDIBackend::write
void write(MIDIUSBPacket_t data)
Definition
USBMIDI_Teensy3.hpp:29
Teensy3_USBDeviceMIDIBackend::preferImmediateSend
bool preferImmediateSend()
Definition
USBMIDI_Teensy3.hpp:35
Teensy3_USBDeviceMIDIBackend::read
MIDIUSBPacket_t read()
Definition
USBMIDI_Teensy3.hpp:25
Generated by
1.10.0