Simple mbed 5-pin DIN to USB MIDI Converter library
Midi5Pin.h@1:399a3ad230c8, 2015-10-22 (annotated)
- Committer:
- mpetrut
- Date:
- Thu Oct 22 16:09:13 2015 +0000
- Revision:
- 1:399a3ad230c8
- Parent:
- 0:722bbb69c79d
- Child:
- 2:b36bd99c6755
update;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mpetrut | 0:722bbb69c79d | 1 | /* Simple mbed 5-pin DIN to USB MIDI Converter library |
mpetrut | 0:722bbb69c79d | 2 | Marius Petrut, 2015 |
mpetrut | 0:722bbb69c79d | 3 | */ |
mpetrut | 0:722bbb69c79d | 4 | |
mpetrut | 0:722bbb69c79d | 5 | #ifndef MBED_MIDI5PIN_H |
mpetrut | 0:722bbb69c79d | 6 | #define MBED_MIDI5PIN_H |
mpetrut | 0:722bbb69c79d | 7 | |
mpetrut | 0:722bbb69c79d | 8 | #include "mbed.h" |
mpetrut | 0:722bbb69c79d | 9 | |
mpetrut | 0:722bbb69c79d | 10 | class Midi5Pin { |
mpetrut | 0:722bbb69c79d | 11 | public: |
mpetrut | 1:399a3ad230c8 | 12 | /// Create a Midi5Pin object with the specified |
mpetrut | 1:399a3ad230c8 | 13 | /// transmit and receive pins |
mpetrut | 0:722bbb69c79d | 14 | Midi5Pin(PinName txPin, PinName rxPin); |
mpetrut | 0:722bbb69c79d | 15 | |
mpetrut | 1:399a3ad230c8 | 16 | /// Send a command to the 5-pin output port |
mpetrut | 0:722bbb69c79d | 17 | void write(char command, char param1, char param2); |
mpetrut | 0:722bbb69c79d | 18 | |
mpetrut | 1:399a3ad230c8 | 19 | /// Send a noteOn MIDI message to the 5-pin output |
mpetrut | 0:722bbb69c79d | 20 | void noteOn(char note, char velocity); |
mpetrut | 0:722bbb69c79d | 21 | |
mpetrut | 1:399a3ad230c8 | 22 | /// Send a noteOff MIDI message to the 5-pin output |
mpetrut | 0:722bbb69c79d | 23 | void noteOff(char note); |
mpetrut | 0:722bbb69c79d | 24 | |
mpetrut | 1:399a3ad230c8 | 25 | /// Send a continuous control message to the 5-pin output |
mpetrut | 0:722bbb69c79d | 26 | void contCtrl(char ccNumber, char value); |
mpetrut | 0:722bbb69c79d | 27 | |
mpetrut | 1:399a3ad230c8 | 28 | /// Read from the 5-pin input connection and send |
mpetrut | 1:399a3ad230c8 | 29 | /// it to the PC through the USB virtual com port |
mpetrut | 0:722bbb69c79d | 30 | void read(); |
mpetrut | 0:722bbb69c79d | 31 | |
mpetrut | 0:722bbb69c79d | 32 | private: |
mpetrut | 0:722bbb69c79d | 33 | Serial _pc; |
mpetrut | 0:722bbb69c79d | 34 | Serial _uart5pin; |
mpetrut | 0:722bbb69c79d | 35 | }; |
mpetrut | 0:722bbb69c79d | 36 | |
mpetrut | 0:722bbb69c79d | 37 | #endif |
mpetrut | 0:722bbb69c79d | 38 |