Simple mbed 5-pin DIN to USB MIDI Converter library

Dependents:   5-PinMIDIDemo

Committer:
mpetrut
Date:
Thu Oct 22 10:02:00 2015 +0000
Revision:
0:722bbb69c79d
Child:
1:399a3ad230c8
First Commit

Who changed what in which revision?

UserRevisionLine numberNew 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 0:722bbb69c79d 12 // Create a Midi5Pin object with the specified
mpetrut 0:722bbb69c79d 13 // transmit and receive pins
mpetrut 0:722bbb69c79d 14 Midi5Pin(PinName txPin, PinName rxPin);
mpetrut 0:722bbb69c79d 15
mpetrut 0:722bbb69c79d 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 0:722bbb69c79d 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 0:722bbb69c79d 22 // Send a noteOff MIDI message to the 5-pin output
mpetrut 0:722bbb69c79d 23 void noteOff(char note);
mpetrut 0:722bbb69c79d 24
mpetrut 0:722bbb69c79d 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 0:722bbb69c79d 28 // Read from the 5-pin input connection and send
mpetrut 0:722bbb69c79d 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