3#include <USBHost_t36.h>
10#include <Settings/NamespaceSettings.hpp>
15template <u
int16_t MaxPacketSize = 512>
18 protected BulkRX<TeensyHostMIDI<MaxPacketSize>, uint32_t, MaxPacketSize>,
19 protected BulkTX<TeensyHostMIDI<MaxPacketSize>, uint32_t, MaxPacketSize> {
53 bool claim(Device_t *device,
int type,
const uint8_t *descriptors,
54 uint32_t
len)
override;
74 bool claim_if_midi(Device_t *device,
int type,
const uint8_t *descriptors,
83 Pipe_t mypipes[3] __attribute__((aligned(32)));
84 Transfer_t mytransfers[7] __attribute__((aligned(32)));
91 void tx_start(
const void *data, uint32_t size);
110 template <
class T,
size_t N>
111 static constexpr size_t len(T (&)[N]) {
118#include "TeensyHostMIDI.ipp"
#define BEGIN_CS_NAMESPACE
Teensy USB Host MIDI driver.
void disconnect() override
uint32_t read_finish(const Transfer_t *transfer)
microseconds write_error_timeout_duration
void read_start(uint8_t *buffer, uint32_t size)
void setErrorTimeout(microseconds timeout)
uint32_t write_finish(const Transfer_t *transfer)
bool claim_if_midi(Device_t *device, int type, const uint8_t *descriptors, uint32_t len)
void rx_start(void *data, uint32_t size)
void timer_event(USBDriverTimer *whichtimer) override
void rx_start_isr(void *data, uint32_t size)
uint32_t read()
Try reading a 4-byte MIDI USB message.
bool claim(Device_t *device, int type, const uint8_t *descriptors, uint32_t len) override
USBDriverTimer write_timeout
void in_callback(const Transfer_t *transfer)
TeensyHostMIDI(USBHost &)
void read_start_isr(uint8_t *buffer, uint32_t size)
void setTimeout(microseconds timeout)
Set the timeout, the number of microseconds to buffer the outgoing MIDI messages.
static constexpr size_t len(T(&)[N])
microseconds write_timeout_duration
void write_start(uint8_t *buffer, uint32_t size)
static void tx_callback(const Transfer_t *transfer)
bool connectedForWrite() const
void out_callback(const Transfer_t *transfer)
void tx_start_isr(const void *data, uint32_t size)
static void rx_callback(const Transfer_t *transfer)
void tx_start_timeout(const void *data, uint32_t size)
std::chrono::microseconds microseconds
strbuf_t mystring_bufs[1]
void tx_start(const void *data, uint32_t size)
void write_start_isr(uint8_t *buffer, uint32_t size)
Receives Bulk packets (OUT for device mode, IN for host mode)
static constexpr uint16_t MaxPacketSize
Sends Bulk packets (IN for device mode, OUT for host mode)
uint32_t write_nonblock(const MessageType *msgs, uint32_t num_msgs)
Send multiple MIDI USB messages without blocking.
void send_now()
Try sending the buffered data now.
uint32_t getWriteError() const
Get the number messages that failed to send.
void write(MessageType msg)
Send a MIDI USB message.
uint32_t clearWriteError()
Get and clear the number messages that failed to send.