6#include <Settings/NamespaceSettings.hpp>
11template <
class Derived,
class MessageTypeT, u
int16_t MaxPacketSizeV>
75 void tx_start(
const void *data, uint32_t size) =
delete;
82 constexpr static std::memory_order
mo_seq = std::memory_order_seq_cst;
83 constexpr static std::memory_order
mo_rel = std::memory_order_release;
84 constexpr static std::memory_order
mo_acq = std::memory_order_acquire;
85 constexpr static std::memory_order
mo_rlx = std::memory_order_relaxed;
86 constexpr static std::memory_order
mo_acq_rel = std::memory_order_acq_rel;
#define BEGIN_CS_NAMESPACE
Wrapper that provides atomic access to variables shared between the main program and interrupt handle...
T load(std::memory_order o) const
T exchange(T arg, std::memory_order o)
uint8_t buffer[MaxPacketSize]
State for writing outgoing USB-MIDI data.
interrupt_atomic< Buffer * > send_later
interrupt_atomic< Buffer * > active_writebuffer
interrupt_atomic< uint32_t > error
interrupt_atomic< Buffer * > send_now
interrupt_atomic< Buffer * > sending
struct BulkTX::Writing::Buffer buffers[2]
Sends Bulk packets (IN for device mode, OUT for host mode)
void cancel_timeout()=delete
Cancel the timeout started by timeout_callback().
static constexpr std::memory_order mo_seq
uint32_t index_of(wbuffer_t *p) const
static constexpr std::memory_order mo_acq
static constexpr std::memory_order mo_rlx
void start_timeout()=delete
Start a timeout (e.g.
uint32_t write_nonblock(const MessageType *msgs, uint32_t num_msgs)
Send multiple MIDI USB messages without blocking.
void tx_start_isr(const void *data, uint32_t size)=delete
Start a USB transfer (from the USB interrupt handler).
void send_now()
Try sending the buffered data now.
static constexpr std::memory_order mo_acq_rel
wbuffer_t * other_buf(wbuffer_t *p)
uint32_t getWriteError() const
Get the number messages that failed to send.
bool is_done() const
Check if all transfers have completed.
void write(const MessageType(&msgs)[N])
Send multiple MIDI USB messages. May block.
struct BulkTX::Writing writing
static constexpr uint16_t MaxPacketSize
void reset(uint16_t packet_size=MaxPacketSize)
typename Writing::Buffer wbuffer_t
void tx_start(const void *data, uint32_t size)=delete
Start a USB transfer (from the main program).
static constexpr uint16_t SizeReserved
void write(const MessageType *msgs, uint32_t num_msgs)
Send multiple MIDI USB messages.
void write(MessageType msg)
Send a MIDI USB message.
static constexpr std::memory_order mo_rel
void tx_start_timeout(const void *data, uint32_t size)=delete
Start a USB transfer (from the timeout callback).
uint32_t write_impl(const MessageType *msgs, uint32_t num_msgs)
uint32_t clearWriteError()
Get and clear the number messages that failed to send.