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) 69 USBMIDI(
bool connect_blocking =
true, uint16_t vendor_id = 0x0700, uint16_t product_id = 0x0101, uint16_t product_release = 0x0001);
87 USBMIDI(
USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
149 virtual void callback_set_configuration(uint8_t configuration);
151 virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
153 virtual const uint8_t *string_iproduct_desc();
155 virtual const uint8_t *string_iinterface_desc();
157 virtual const uint8_t *configuration_desc(uint8_t index);
160 static const uint32_t MaxSize = 64;
162 uint8_t _bulk_buf[MaxSize];
163 uint32_t _bulk_buf_pos;
164 uint32_t _bulk_buf_size;
167 uint8_t _data[MAX_MIDI_MESSAGE_SIZE + 1];
175 uint8_t _config_descriptor[0x65];
181 void _out_callback();
182 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.