USB device stack, with KL25Z fixes for USB 3.0 hosts and sleep/resume interrupt handling
Dependents: frdm_Slider_Keyboard idd_hw2_figlax_PanType idd_hw2_appachu_finger_chording idd_hw3_AngieWangAntonioDeLimaFernandesDanielLim_BladeSymphony ... more
Fork of USBDevice by
USBMIDI Class Reference
#include <USBMIDI.h>
Inherits USBDevice.
Public Member Functions | |
USBMIDI (uint16_t vendor_id=0x0700, uint16_t product_id=0x0101, uint16_t product_release=0x0001) | |
Constructor. | |
void | write (MIDIMessage m) |
Send a MIDIMessage. | |
void | attach (void(*fptr)(MIDIMessage)) |
Attach a callback for when a MIDIEvent is received. | |
bool | writeTO (uint8_t endpoint, uint8_t *buffer, uint32_t size, uint32_t maxSize, int timeout_ms) |
Write a certain endpoint. |
Detailed Description
USBMIDI example.
#include "mbed.h" #include "USBMIDI.h" USBMIDI midi; int main() { while (1) { for(int i=48; i<83; i++) { // send some messages! midi.write(MIDIMessage::NoteOn(i)); wait(0.25); midi.write(MIDIMessage::NoteOff(i)); wait(0.5); } } }
Definition at line 53 of file USBMIDI.h.
Constructor & Destructor Documentation
USBMIDI | ( | uint16_t | vendor_id = 0x0700 , |
uint16_t | product_id = 0x0101 , |
||
uint16_t | product_release = 0x0001 |
||
) |
Constructor.
- Parameters:
-
vendor_id Your vendor_id product_id Your product_id product_release Your preoduct_release
Definition at line 23 of file USBMIDI.cpp.
Member Function Documentation
void attach | ( | void(*)(MIDIMessage) | fptr ) |
Attach a callback for when a MIDIEvent is received.
- Parameters:
-
fptr function pointer
Definition at line 33 of file USBMIDI.cpp.
void write | ( | MIDIMessage | m ) |
bool writeTO | ( | uint8_t | endpoint, |
uint8_t * | buffer, | ||
uint32_t | size, | ||
uint32_t | maxSize, | ||
int | timeout_ms | ||
) | [inherited] |
Write a certain endpoint.
Blocks until the report has been sent successfully, or until the timeout expires, whichever comes first.
- Parameters:
-
endpoint endpoint to write buffer data contained in buffer will be write size the number of bytes to write maxSize the maximum length that can be written on this endpoint timeout_ms timeout in milliseconds
- Returns:
- true if successful, false on error or timeout
Definition at line 928 of file USBDevice.cpp.
Generated on Tue Jul 12 2022 18:05:22 by 1.7.2