Control Surface pin-t-adl
MIDI Control Surface library for Arduino
Classes
mbed/PluggableUSBMIDI.hpp File Reference
#include <AH/Arduino-Wrapper.h>
#include <atomic>
#include <cstdint>
#include <tuple>
#include <USB/PluggableUSBDevice.h>
#include <drivers/Timeout.h>
#include <platform/Callback.h>
#include <AH/Settings/Warnings.hpp>
#include <Settings/NamespaceSettings.hpp>
+ Include dependency graph for mbed/PluggableUSBMIDI.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  PluggableUSBMIDI
 
struct  PluggableUSBMIDI::Reading
 State for reading incoming USB-MIDI data. More...
 
struct  PluggableUSBMIDI::Reading::Buffer
 
struct  PluggableUSBMIDI::Writing
 State for writing outgoing USB-MIDI data. More...
 
struct  PluggableUSBMIDI::Writing::Buffer
 

Class Documentation

◆ PluggableUSBMIDI::Reading

struct PluggableUSBMIDI::Reading
+ Collaboration diagram for PluggableUSBMIDI::Reading:
Class Members
struct Buffer buffers[NumRxPackets]
uint32_t available
uint32_t read_idx
uint32_t write_idx
bool reading
atomic< uint32_t > available
atomic< uint32_t > read_idx
atomic< uint32_t > write_idx
atomic< bool > reading

◆ PluggableUSBMIDI::Reading::Buffer

struct PluggableUSBMIDI::Reading::Buffer
+ Collaboration diagram for PluggableUSBMIDI::Reading::Buffer:
Class Members
uint32_t size
uint32_t index
uint8_t buffer[PacketSize]

◆ PluggableUSBMIDI::Writing

struct PluggableUSBMIDI::Writing
+ Collaboration diagram for PluggableUSBMIDI::Writing:
Class Members
struct Buffer buffers[2]
uint32_t active_writebuffer The index of the buffer that is currently being written to.
Buffer * sending Buffer that is being sent.
Buffer * send_timeout Buffer to be sent in the timeout callback.
microseconds timeout_duration
microseconds error_timeout_duration
Timeout timeout
uint32_t errors
atomic< uint32_t > active_writebuffer
atomic< Buffer * > sending
atomic< Buffer * > send_timeout

◆ PluggableUSBMIDI::Writing::Buffer

struct PluggableUSBMIDI::Writing::Buffer
+ Collaboration diagram for PluggableUSBMIDI::Writing::Buffer:
Class Members
uint32_t size How many bytes are in the buffer.
bool ready_to_send Indicates that this buffer can be sent as soon as the previous one has been sent.

This flag is changed from false to true when the buffer is scheduled to be sent, either because it is full or because the timeout was triggered. If the flag is true, no further efforts should be made to send it. It is cleared in the USB ISR, after the buffer has actually been sent.

uint8_t buffer[PacketSize]
atomic< uint32_t > size
atomic< bool > ready_to_send