Simple mbed 5-pin DIN to USB MIDI Converter library

Dependents:   5-PinMIDIDemo

Committer:
mpetrut
Date:
Thu Oct 22 16:25:57 2015 +0000
Revision:
3:b258cf76ee4f
Parent:
2:b36bd99c6755
Child:
4:c46801d710fa
doxy again;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mpetrut 3:b258cf76ee4f 1 /** Simple mbed 5-pin DIN to USB MIDI Converter library
mpetrut 3:b258cf76ee4f 2 *Marius Petrut, 2015
mpetrut 3:b258cf76ee4f 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 2:b36bd99c6755 12 /** Create a Midi5Pin object with the specified
mpetrut 2:b36bd99c6755 13 * transmit and receive pins
mpetrut 2:b36bd99c6755 14 *
mpetrut 2:b36bd99c6755 15 * @param txPin Transmit pin
mpetrut 2:b36bd99c6755 16 * @param rxPin Receive pin
mpetrut 2:b36bd99c6755 17 */
mpetrut 0:722bbb69c79d 18 Midi5Pin(PinName txPin, PinName rxPin);
mpetrut 0:722bbb69c79d 19
mpetrut 2:b36bd99c6755 20 /** Send a command to the 5-pin output port
mpetrut 2:b36bd99c6755 21 *
mpetrut 2:b36bd99c6755 22 * @param command The MIDI command byte
mpetrut 2:b36bd99c6755 23 * @param param1 First parameter (depends on command)
mpetrut 2:b36bd99c6755 24 * @param param2 Second parameter (depends on command)
mpetrut 2:b36bd99c6755 25 */
mpetrut 0:722bbb69c79d 26 void write(char command, char param1, char param2);
mpetrut 0:722bbb69c79d 27
mpetrut 2:b36bd99c6755 28 /** Send a noteOn MIDI message to the 5-pin output
mpetrut 2:b36bd99c6755 29 *
mpetrut 2:b36bd99c6755 30 * @param note MIDI note number
mpetrut 2:b36bd99c6755 31 * @param velocity MIDI note velocity (loudness)
mpetrut 2:b36bd99c6755 32 */
mpetrut 0:722bbb69c79d 33 void noteOn(char note, char velocity);
mpetrut 0:722bbb69c79d 34
mpetrut 2:b36bd99c6755 35 /** Send a noteOff MIDI message to the 5-pin output
mpetrut 2:b36bd99c6755 36 *
mpetrut 2:b36bd99c6755 37 * @param note MIDI note number
mpetrut 2:b36bd99c6755 38 */
mpetrut 0:722bbb69c79d 39 void noteOff(char note);
mpetrut 0:722bbb69c79d 40
mpetrut 2:b36bd99c6755 41 /** Send a continuous control message to the 5-pin output
mpetrut 2:b36bd99c6755 42 *
mpetrut 2:b36bd99c6755 43 * @param ccNumber The continuous control message number
mpetrut 2:b36bd99c6755 44 * @param value Value of the continuous control message
mpetrut 2:b36bd99c6755 45 */
mpetrut 0:722bbb69c79d 46 void contCtrl(char ccNumber, char value);
mpetrut 0:722bbb69c79d 47
mpetrut 2:b36bd99c6755 48 /** Read from the 5-pin input connection and send
mpetrut 2:b36bd99c6755 49 * it to the PC through the USB virtual com port
mpetrut 2:b36bd99c6755 50 *
mpetrut 2:b36bd99c6755 51 */
mpetrut 0:722bbb69c79d 52 void read();
mpetrut 0:722bbb69c79d 53
mpetrut 0:722bbb69c79d 54 private:
mpetrut 0:722bbb69c79d 55 Serial _pc;
mpetrut 0:722bbb69c79d 56 Serial _uart5pin;
mpetrut 0:722bbb69c79d 57 };
mpetrut 0:722bbb69c79d 58
mpetrut 0:722bbb69c79d 59 #endif
mpetrut 0:722bbb69c79d 60