8#include <USB/PluggableUSBDevice.h>
9#include <drivers/Timeout.h>
10#include <platform/Callback.h>
14#include <Settings/NamespaceSettings.hpp>
19 protected BulkRX<PluggableUSBMIDI, uint32_t, 64>,
20 protected BulkTX<PluggableUSBMIDI, uint32_t, 64> {
41 void tx_start(
const void *data, uint32_t size) {
42 auto data_u8 =
reinterpret_cast<uint8_t *
>(
const_cast<void *
>(data));
50 read_start(
bulk_out_ep,
reinterpret_cast<uint8_t *
>(data), size);
85 void init(EndpointResolver &resolver)
override;
88 USBDevice::RequestResult *result,
89 uint8_t **data)
override;
91 bool aborted)
override;
120 uint32_t num_bytes_read = read_finish(
bulk_out_ep);
#define BEGIN_CS_NAMESPACE
void setErrorTimeout(microseconds timeout)
USBDevice::setup_packet_t setup_packet_t
uint8_t getProductVersion() override
microseconds error_timeout_duration
void rx_start(void *data, uint32_t size)
void rx_start_isr(void *data, uint32_t size)
USBDevice::DeviceState DeviceState
uint32_t read()
Try reading a 4-byte MIDI USB message.
void callback_state_change(DeviceState new_state) override
const uint8_t * configuration_desc(uint8_t index) override
microseconds timeout_duration
void callback_set_interface(uint16_t interface, uint8_t alternate) override
interrupt_atomic< bool > usb_connected
void setTimeout(microseconds timeout)
Set the timeout, the number of microseconds to buffer the outgoing MIDI messages.
bool callback_set_configuration(uint8_t configuration) override
bool connected() const
Check if this class is connected and ready.
void init(EndpointResolver &resolver) override
bool connectedForWrite() const
uint32_t callback_request(const setup_packet_t *setup, USBDevice::RequestResult *result, uint8_t **data) override
void tx_start_isr(const void *data, uint32_t size)
bool callback_request_xfer_done(const setup_packet_t *setup, bool aborted) override
void tx_start_timeout(const void *data, uint32_t size)
uint8_t config_descriptor[0x65]
const uint8_t * string_iinterface_desc() override
std::chrono::microseconds microseconds
static constexpr uint32_t get_packet_size()
void tx_start(const void *data, uint32_t size)
Wrapper that provides atomic access to variables shared between the main program and interrupt handle...
Receives Bulk packets (OUT for device mode, IN for host mode)
void rx_callback(uint32_t num_bytes_read)
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.