22 #include "USBDescriptor.h" 23 #include "USBDevice_Types.h" 25 #include "USBDevice.h" 26 #include "MIDIMessage.h" 27 #include "EventFlags.h" 31 #define DEFAULT_CONFIGURATION (1) 75 USBMIDI(
bool connect_blocking =
true, uint16_t vendor_id = 0x0700, uint16_t product_id = 0x0101, uint16_t product_release = 0x0001);
93 USBMIDI(
USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
155 virtual void callback_set_configuration(uint8_t configuration);
157 virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
159 virtual const uint8_t *string_iproduct_desc();
161 virtual const uint8_t *string_iinterface_desc();
163 virtual const uint8_t *configuration_desc(uint8_t index);
166 static const uint32_t MaxSize = 64;
168 uint8_t _bulk_buf[MaxSize];
169 uint32_t _bulk_buf_pos;
170 uint32_t _bulk_buf_size;
173 uint8_t _data[MAX_MIDI_MESSAGE_SIZE + 1];
181 uint8_t _config_descriptor[0x65];
187 void _out_callback();
188 bool _next_message();
bool write(MIDIMessage m)
Send a MIDIMessage.
virtual void callback_request_xfer_done(const setup_packet_t *setup, bool aborted)
Called by USBDevice on data stage completion.
The EventFlags class is used to control event flags or wait for event flags other threads control...
USBMIDI(bool connect_blocking=true, uint16_t vendor_id=0x0700, uint16_t product_id=0x0101, uint16_t product_release=0x0001)
Basic constructor.
bool readable()
Check if a message can be read.
void attach(mbed::Callback< void()> callback)
Attach a callback for when a MIDIEvent is received.
bool ready()
Check if this class is ready.
bool read(MIDIMessage *m)
Read a message.
Abstract interface to physical USB hardware.
virtual ~USBMIDI()
Destroy this object.
A MIDI message container.
virtual void callback_request(const setup_packet_t *setup)
Called by USBDevice on Endpoint0 request.
virtual void callback_state_change(DeviceState new_state)
Called when USB changes state.
The Mutex class is used to synchronize the execution of threads.
void wait_ready()
Block until this device is configured.
Callback class based on template specialization.