#include <MIDI_Interfaces/USBMIDI/LowLevel/BulkTX.hpp>
Sends Bulk packets (IN for device mode, OUT for host mode)
Definition at line 12 of file BulkTX.hpp.
Classes | |
struct | Writing |
State for writing outgoing USB-MIDI data. More... | |
Public Types | |
using | MessageType = MessageTypeT |
Public Member Functions | |
void | write (MessageType msg) |
Send a MIDI USB message. | |
void | write (const MessageType *msgs, uint32_t num_msgs) |
Send multiple MIDI USB messages. | |
template<size_t N> | |
void | write (const MessageType(&msgs)[N]) |
Send multiple MIDI USB messages. May block. | |
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. | |
bool | is_done () const |
Check if all transfers have completed. | |
uint32_t | getWriteError () const |
Get the number messages that failed to send. | |
uint32_t | clearWriteError () |
Get and clear the number messages that failed to send. | |
Protected Member Functions | |
void | reset (uint16_t packet_size=MaxPacketSize) |
bool | wait_connect () |
void | start_timeout ()=delete |
Start a timeout (e.g. | |
void | cancel_timeout ()=delete |
Cancel the timeout started by timeout_callback(). | |
void | tx_start (const void *data, uint32_t size)=delete |
Start a USB transfer (from the main program). | |
void | tx_start_timeout (const void *data, uint32_t size)=delete |
Start a USB transfer (from the timeout callback). | |
void | tx_start_isr (const void *data, uint32_t size)=delete |
Start a USB transfer (from the USB interrupt handler). | |
void | timeout_callback () |
void | tx_callback () |
Private Types | |
using | wbuffer_t = typename Writing::Buffer |
Private Member Functions | |
uint32_t | index_of (wbuffer_t *p) const |
wbuffer_t * | other_buf (wbuffer_t *p) |
uint32_t | write_impl (const MessageType *msgs, uint32_t num_msgs) |
Private Attributes | |
struct BulkTX::Writing | writing |
bool | disconnected = false |
Static Private Attributes | |
static constexpr uint16_t | MaxPacketSize = MaxPacketSizeV |
static constexpr uint16_t | SizeReserved = MaxPacketSize + 1 |
static constexpr std::memory_order | mo_seq = std::memory_order_seq_cst |
static constexpr std::memory_order | mo_rel = std::memory_order_release |
static constexpr std::memory_order | mo_acq = std::memory_order_acquire |
static constexpr std::memory_order | mo_rlx = std::memory_order_relaxed |
static constexpr std::memory_order | mo_acq_rel = std::memory_order_acq_rel |
using MessageType = MessageTypeT |
Definition at line 14 of file BulkTX.hpp.
|
private |
Definition at line 101 of file BulkTX.hpp.
void write | ( | MessageType | msg | ) |
Send a MIDI USB message.
May block.
msg | The 4-byte MIDI USB message to send. |
void write | ( | const MessageType * | msgs, |
uint32_t | num_msgs ) |
Send multiple MIDI USB messages.
May block.
msgs | An array of 4-byte MIDI USB messages to send. |
num_msgs | The number of messages in the array. |
|
inline |
Send multiple MIDI USB messages. May block.
Definition at line 32 of file BulkTX.hpp.
uint32_t write_nonblock | ( | const MessageType * | msgs, |
uint32_t | num_msgs ) |
Send multiple MIDI USB messages without blocking.
msgs | An array of 4-byte MIDI USB messages to send. |
num_msgs | The number of messages in the array. |
void send_now | ( | ) |
Try sending the buffered data now.
Start transmitting the latest packet if possible, even if it isn't full yet. If the latest packet is empty, this function has no effect.
bool is_done | ( | ) | const |
Check if all transfers have completed.
|
inline |
Get the number messages that failed to send.
Definition at line 54 of file BulkTX.hpp.
|
inline |
Get and clear the number messages that failed to send.
Definition at line 56 of file BulkTX.hpp.
|
protected |
|
protected |
|
protecteddelete |
Start a timeout (e.g.
using a timer interrupt) that later calls timeout_callback().
|
protecteddelete |
Cancel the timeout started by timeout_callback().
|
protecteddelete |
Start a USB transfer (from the main program).
|
protecteddelete |
Start a USB transfer (from the timeout callback).
|
protecteddelete |
Start a USB transfer (from the USB interrupt handler).
|
inlineprivate |
Definition at line 104 of file BulkTX.hpp.
|
inlineprivate |
Definition at line 105 of file BulkTX.hpp.
|
private |
|
protected |
|
protected |
|
staticconstexprprivate |
Definition at line 63 of file BulkTX.hpp.
|
staticconstexprprivate |
Definition at line 64 of file BulkTX.hpp.
|
staticconstexprprivate |
Definition at line 82 of file BulkTX.hpp.
|
staticconstexprprivate |
Definition at line 83 of file BulkTX.hpp.
|
staticconstexprprivate |
Definition at line 84 of file BulkTX.hpp.
|
staticconstexprprivate |
Definition at line 85 of file BulkTX.hpp.
|
staticconstexprprivate |
Definition at line 86 of file BulkTX.hpp.
|
private |
|
private |
Definition at line 102 of file BulkTX.hpp.