added USB host

Dependencies:   FATFileSystem mbed-rtos

Dependents:   app-board-Speaker

Fork of USBHost by mbed official

Committer:
mbed_official
Date:
Fri Jul 11 10:00:48 2014 +0100
Revision:
25:45dcbf2ba11d
Synchronized with git revision bbf5cbc71510e72033aaacbd76c3f127b70f08b6

Full URL: https://github.com/mbedmicro/mbed/commit/bbf5cbc71510e72033aaacbd76c3f127b70f08b6/

[K20D50M] K20D5M -> K20D50M

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 25:45dcbf2ba11d 1 /* Copyright (c) 2014 mbed.org, MIT License
mbed_official 25:45dcbf2ba11d 2 *
mbed_official 25:45dcbf2ba11d 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
mbed_official 25:45dcbf2ba11d 4 * and associated documentation files (the "Software"), to deal in the Software without
mbed_official 25:45dcbf2ba11d 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
mbed_official 25:45dcbf2ba11d 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
mbed_official 25:45dcbf2ba11d 7 * Software is furnished to do so, subject to the following conditions:
mbed_official 25:45dcbf2ba11d 8 *
mbed_official 25:45dcbf2ba11d 9 * The above copyright notice and this permission notice shall be included in all copies or
mbed_official 25:45dcbf2ba11d 10 * substantial portions of the Software.
mbed_official 25:45dcbf2ba11d 11 *
mbed_official 25:45dcbf2ba11d 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
mbed_official 25:45dcbf2ba11d 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
mbed_official 25:45dcbf2ba11d 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
mbed_official 25:45dcbf2ba11d 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mbed_official 25:45dcbf2ba11d 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
mbed_official 25:45dcbf2ba11d 17 */
mbed_official 25:45dcbf2ba11d 18
mbed_official 25:45dcbf2ba11d 19 #ifndef USBHOSTMIDI_H
mbed_official 25:45dcbf2ba11d 20 #define USBHOSTMIDI_H
mbed_official 25:45dcbf2ba11d 21
mbed_official 25:45dcbf2ba11d 22 #include "USBHostConf.h"
mbed_official 25:45dcbf2ba11d 23
mbed_official 25:45dcbf2ba11d 24 #if USBHOST_MIDI
mbed_official 25:45dcbf2ba11d 25
mbed_official 25:45dcbf2ba11d 26 #include "USBHost.h"
mbed_official 25:45dcbf2ba11d 27
mbed_official 25:45dcbf2ba11d 28 /**
mbed_official 25:45dcbf2ba11d 29 * A class to communicate a USB MIDI device
mbed_official 25:45dcbf2ba11d 30 */
mbed_official 25:45dcbf2ba11d 31 class USBHostMIDI : public IUSBEnumerator {
mbed_official 25:45dcbf2ba11d 32 public:
mbed_official 25:45dcbf2ba11d 33 /**
mbed_official 25:45dcbf2ba11d 34 * Constructor
mbed_official 25:45dcbf2ba11d 35 */
mbed_official 25:45dcbf2ba11d 36 USBHostMIDI();
mbed_official 25:45dcbf2ba11d 37
mbed_official 25:45dcbf2ba11d 38 /**
mbed_official 25:45dcbf2ba11d 39 * Check if a USB MIDI device is connected
mbed_official 25:45dcbf2ba11d 40 *
mbed_official 25:45dcbf2ba11d 41 * @returns true if a midi device is connected
mbed_official 25:45dcbf2ba11d 42 */
mbed_official 25:45dcbf2ba11d 43 bool connected();
mbed_official 25:45dcbf2ba11d 44
mbed_official 25:45dcbf2ba11d 45 /**
mbed_official 25:45dcbf2ba11d 46 * Try to connect a midi device
mbed_official 25:45dcbf2ba11d 47 *
mbed_official 25:45dcbf2ba11d 48 * @return true if connection was successful
mbed_official 25:45dcbf2ba11d 49 */
mbed_official 25:45dcbf2ba11d 50 bool connect();
mbed_official 25:45dcbf2ba11d 51
mbed_official 25:45dcbf2ba11d 52 /**
mbed_official 25:45dcbf2ba11d 53 * Attach a callback called when miscellaneous function code is received
mbed_official 25:45dcbf2ba11d 54 *
mbed_official 25:45dcbf2ba11d 55 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 56 * prototype: void onMiscellaneousFunctionCode(uint8_t data1, uint8_t data2, uint8_t data3);
mbed_official 25:45dcbf2ba11d 57 */
mbed_official 25:45dcbf2ba11d 58 inline void attachMiscellaneousFunctionCode(void (*fn)(uint8_t, uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 59 miscellaneousFunctionCode = fn;
mbed_official 25:45dcbf2ba11d 60 }
mbed_official 25:45dcbf2ba11d 61
mbed_official 25:45dcbf2ba11d 62 /**
mbed_official 25:45dcbf2ba11d 63 * Attach a callback called when cable event is received
mbed_official 25:45dcbf2ba11d 64 *
mbed_official 25:45dcbf2ba11d 65 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 66 * prototype: void onCableEvent(uint8_t data1, uint8_t data2, uint8_t data3);
mbed_official 25:45dcbf2ba11d 67 */
mbed_official 25:45dcbf2ba11d 68 inline void attachCableEvent(void (*fn)(uint8_t, uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 69 cableEvent = fn;
mbed_official 25:45dcbf2ba11d 70 }
mbed_official 25:45dcbf2ba11d 71
mbed_official 25:45dcbf2ba11d 72 /**
mbed_official 25:45dcbf2ba11d 73 * Attach a callback called when system exclusive is received
mbed_official 25:45dcbf2ba11d 74 *
mbed_official 25:45dcbf2ba11d 75 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 76 * prototype: void onSystemCommonTwoBytes(uint8_t data1, uint8_t data2);
mbed_official 25:45dcbf2ba11d 77 */
mbed_official 25:45dcbf2ba11d 78 inline void attachSystemCommonTwoBytes(void (*fn)(uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 79 systemCommonTwoBytes = fn;
mbed_official 25:45dcbf2ba11d 80 }
mbed_official 25:45dcbf2ba11d 81
mbed_official 25:45dcbf2ba11d 82 /**
mbed_official 25:45dcbf2ba11d 83 * Attach a callback called when system exclusive is received
mbed_official 25:45dcbf2ba11d 84 *
mbed_official 25:45dcbf2ba11d 85 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 86 * prototype: void onSystemCommonThreeBytes(uint8_t data1, uint8_t data2, uint8_t data3);
mbed_official 25:45dcbf2ba11d 87 */
mbed_official 25:45dcbf2ba11d 88 inline void attachSystemCommonThreeBytes(void (*fn)(uint8_t, uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 89 systemCommonThreeBytes = fn;
mbed_official 25:45dcbf2ba11d 90 }
mbed_official 25:45dcbf2ba11d 91
mbed_official 25:45dcbf2ba11d 92 /**
mbed_official 25:45dcbf2ba11d 93 * Attach a callback called when system exclusive is received
mbed_official 25:45dcbf2ba11d 94 *
mbed_official 25:45dcbf2ba11d 95 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 96 * prototype: void onSystemExclusive(uint8_t *data, uint16_t length, bool hasNextData);
mbed_official 25:45dcbf2ba11d 97 */
mbed_official 25:45dcbf2ba11d 98 inline void attachSystemExclusive(void (*fn)(uint8_t *, uint16_t, bool)) {
mbed_official 25:45dcbf2ba11d 99 systemExclusive = fn;
mbed_official 25:45dcbf2ba11d 100 }
mbed_official 25:45dcbf2ba11d 101
mbed_official 25:45dcbf2ba11d 102 /**
mbed_official 25:45dcbf2ba11d 103 * Attach a callback called when note on is received
mbed_official 25:45dcbf2ba11d 104 *
mbed_official 25:45dcbf2ba11d 105 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 106 * prototype: void onNoteOn(uint8_t channel, uint8_t note, uint8_t velocity);
mbed_official 25:45dcbf2ba11d 107 */
mbed_official 25:45dcbf2ba11d 108 inline void attachNoteOn(void (*fn)(uint8_t, uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 109 noteOn = fn;
mbed_official 25:45dcbf2ba11d 110 }
mbed_official 25:45dcbf2ba11d 111
mbed_official 25:45dcbf2ba11d 112 /**
mbed_official 25:45dcbf2ba11d 113 * Attach a callback called when note off is received
mbed_official 25:45dcbf2ba11d 114 *
mbed_official 25:45dcbf2ba11d 115 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 116 * prototype: void onNoteOff(uint8_t channel, uint8_t note, uint8_t velocity);
mbed_official 25:45dcbf2ba11d 117 */
mbed_official 25:45dcbf2ba11d 118 inline void attachNoteOff(void (*fn)(uint8_t, uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 119 noteOff = fn;
mbed_official 25:45dcbf2ba11d 120 }
mbed_official 25:45dcbf2ba11d 121
mbed_official 25:45dcbf2ba11d 122 /**
mbed_official 25:45dcbf2ba11d 123 * Attach a callback called when poly keypress is received
mbed_official 25:45dcbf2ba11d 124 *
mbed_official 25:45dcbf2ba11d 125 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 126 * prototype: void onPolyKeyPress(uint8_t channel, uint8_t note, uint8_t pressure);
mbed_official 25:45dcbf2ba11d 127 */
mbed_official 25:45dcbf2ba11d 128 inline void attachPolyKeyPress(void (*fn)(uint8_t, uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 129 polyKeyPress = fn;
mbed_official 25:45dcbf2ba11d 130 }
mbed_official 25:45dcbf2ba11d 131
mbed_official 25:45dcbf2ba11d 132 /**
mbed_official 25:45dcbf2ba11d 133 * Attach a callback called when control change is received
mbed_official 25:45dcbf2ba11d 134 *
mbed_official 25:45dcbf2ba11d 135 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 136 * prototype: void onControlChange(uint8_t channel, uint8_t key, uint8_t value);
mbed_official 25:45dcbf2ba11d 137 */
mbed_official 25:45dcbf2ba11d 138 inline void attachControlChange(void (*fn)(uint8_t, uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 139 controlChange = fn;
mbed_official 25:45dcbf2ba11d 140 }
mbed_official 25:45dcbf2ba11d 141
mbed_official 25:45dcbf2ba11d 142 /**
mbed_official 25:45dcbf2ba11d 143 * Attach a callback called when program change is received
mbed_official 25:45dcbf2ba11d 144 *
mbed_official 25:45dcbf2ba11d 145 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 146 * prototype: void onProgramChange(uint8_t channel, uint8_t program);
mbed_official 25:45dcbf2ba11d 147 */
mbed_official 25:45dcbf2ba11d 148 inline void attachProgramChange(void (*fn)(uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 149 programChange = fn;
mbed_official 25:45dcbf2ba11d 150 }
mbed_official 25:45dcbf2ba11d 151
mbed_official 25:45dcbf2ba11d 152 /**
mbed_official 25:45dcbf2ba11d 153 * Attach a callback called when channel pressure is received
mbed_official 25:45dcbf2ba11d 154 *
mbed_official 25:45dcbf2ba11d 155 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 156 * prototype: void onChannelPressure(uint8_t channel, uint8_t pressure);
mbed_official 25:45dcbf2ba11d 157 */
mbed_official 25:45dcbf2ba11d 158 inline void attachChannelPressure(void (*fn)(uint8_t, uint8_t)) {
mbed_official 25:45dcbf2ba11d 159 channelPressure = fn;
mbed_official 25:45dcbf2ba11d 160 }
mbed_official 25:45dcbf2ba11d 161
mbed_official 25:45dcbf2ba11d 162 /**
mbed_official 25:45dcbf2ba11d 163 * Attach a callback called when pitch bend is received
mbed_official 25:45dcbf2ba11d 164 *
mbed_official 25:45dcbf2ba11d 165 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 166 * prototype: void onPitchBend(uint8_t channel, uint16_t value);
mbed_official 25:45dcbf2ba11d 167 */
mbed_official 25:45dcbf2ba11d 168 inline void attachPitchBend(void (*fn)(uint8_t, uint16_t)) {
mbed_official 25:45dcbf2ba11d 169 pitchBend = fn;
mbed_official 25:45dcbf2ba11d 170 }
mbed_official 25:45dcbf2ba11d 171
mbed_official 25:45dcbf2ba11d 172 /**
mbed_official 25:45dcbf2ba11d 173 * Attach a callback called when single byte is received
mbed_official 25:45dcbf2ba11d 174 *
mbed_official 25:45dcbf2ba11d 175 * @param ptr function pointer
mbed_official 25:45dcbf2ba11d 176 * prototype: void onSingleByte(uint8_t value);
mbed_official 25:45dcbf2ba11d 177 */
mbed_official 25:45dcbf2ba11d 178 inline void attachSingleByte(void (*fn)(uint8_t)) {
mbed_official 25:45dcbf2ba11d 179 singleByte = fn;
mbed_official 25:45dcbf2ba11d 180 }
mbed_official 25:45dcbf2ba11d 181
mbed_official 25:45dcbf2ba11d 182 /**
mbed_official 25:45dcbf2ba11d 183 * Send a cable event with 3 bytes event
mbed_official 25:45dcbf2ba11d 184 *
mbed_official 25:45dcbf2ba11d 185 * @param data1 0-255
mbed_official 25:45dcbf2ba11d 186 * @param data2 0-255
mbed_official 25:45dcbf2ba11d 187 * @param data3 0-255
mbed_official 25:45dcbf2ba11d 188 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 189 */
mbed_official 25:45dcbf2ba11d 190 bool sendMiscellaneousFunctionCode(uint8_t data1, uint8_t data2, uint8_t data3);
mbed_official 25:45dcbf2ba11d 191
mbed_official 25:45dcbf2ba11d 192 /**
mbed_official 25:45dcbf2ba11d 193 * Send a cable event with 3 bytes event
mbed_official 25:45dcbf2ba11d 194 *
mbed_official 25:45dcbf2ba11d 195 * @param data1 0-255
mbed_official 25:45dcbf2ba11d 196 * @param data2 0-255
mbed_official 25:45dcbf2ba11d 197 * @param data3 0-255
mbed_official 25:45dcbf2ba11d 198 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 199 */
mbed_official 25:45dcbf2ba11d 200 bool sendCableEvent(uint8_t data1, uint8_t data2, uint8_t data3);
mbed_official 25:45dcbf2ba11d 201
mbed_official 25:45dcbf2ba11d 202 /**
mbed_official 25:45dcbf2ba11d 203 * Send a system common message with 2 bytes event
mbed_official 25:45dcbf2ba11d 204 *
mbed_official 25:45dcbf2ba11d 205 * @param data1 0-255
mbed_official 25:45dcbf2ba11d 206 * @param data2 0-255
mbed_official 25:45dcbf2ba11d 207 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 208 */
mbed_official 25:45dcbf2ba11d 209 bool sendSystemCommmonTwoBytes(uint8_t data1, uint8_t data2);
mbed_official 25:45dcbf2ba11d 210
mbed_official 25:45dcbf2ba11d 211 /**
mbed_official 25:45dcbf2ba11d 212 * Send a system common message with 3 bytes event
mbed_official 25:45dcbf2ba11d 213 *
mbed_official 25:45dcbf2ba11d 214 * @param data1 0-255
mbed_official 25:45dcbf2ba11d 215 * @param data2 0-255
mbed_official 25:45dcbf2ba11d 216 * @param data3 0-255
mbed_official 25:45dcbf2ba11d 217 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 218 */
mbed_official 25:45dcbf2ba11d 219 bool sendSystemCommmonThreeBytes(uint8_t data1, uint8_t data2, uint8_t data3);
mbed_official 25:45dcbf2ba11d 220
mbed_official 25:45dcbf2ba11d 221 /**
mbed_official 25:45dcbf2ba11d 222 * Send a system exclusive event
mbed_official 25:45dcbf2ba11d 223 *
mbed_official 25:45dcbf2ba11d 224 * @param buffer, starts with 0xF0, and end with 0xf7
mbed_official 25:45dcbf2ba11d 225 * @param length
mbed_official 25:45dcbf2ba11d 226 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 227 */
mbed_official 25:45dcbf2ba11d 228 bool sendSystemExclusive(uint8_t *buffer, int length);
mbed_official 25:45dcbf2ba11d 229
mbed_official 25:45dcbf2ba11d 230 /**
mbed_official 25:45dcbf2ba11d 231 * Send a note off event
mbed_official 25:45dcbf2ba11d 232 *
mbed_official 25:45dcbf2ba11d 233 * @param channel 0-15
mbed_official 25:45dcbf2ba11d 234 * @param note 0-127
mbed_official 25:45dcbf2ba11d 235 * @param velocity 0-127
mbed_official 25:45dcbf2ba11d 236 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 237 */
mbed_official 25:45dcbf2ba11d 238 bool sendNoteOff(uint8_t channel, uint8_t note, uint8_t velocity);
mbed_official 25:45dcbf2ba11d 239
mbed_official 25:45dcbf2ba11d 240 /**
mbed_official 25:45dcbf2ba11d 241 * Send a note on event
mbed_official 25:45dcbf2ba11d 242 *
mbed_official 25:45dcbf2ba11d 243 * @param channel 0-15
mbed_official 25:45dcbf2ba11d 244 * @param note 0-127
mbed_official 25:45dcbf2ba11d 245 * @param velocity 0-127 (0 means note off)
mbed_official 25:45dcbf2ba11d 246 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 247 */
mbed_official 25:45dcbf2ba11d 248 bool sendNoteOn(uint8_t channel, uint8_t note, uint8_t velocity);
mbed_official 25:45dcbf2ba11d 249
mbed_official 25:45dcbf2ba11d 250 /**
mbed_official 25:45dcbf2ba11d 251 * Send a poly keypress event
mbed_official 25:45dcbf2ba11d 252 *
mbed_official 25:45dcbf2ba11d 253 * @param channel 0-15
mbed_official 25:45dcbf2ba11d 254 * @param note 0-127
mbed_official 25:45dcbf2ba11d 255 * @param pressure 0-127
mbed_official 25:45dcbf2ba11d 256 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 257 */
mbed_official 25:45dcbf2ba11d 258 bool sendPolyKeyPress(uint8_t channel, uint8_t note, uint8_t pressure);
mbed_official 25:45dcbf2ba11d 259
mbed_official 25:45dcbf2ba11d 260 /**
mbed_official 25:45dcbf2ba11d 261 * Send a control change event
mbed_official 25:45dcbf2ba11d 262 *
mbed_official 25:45dcbf2ba11d 263 * @param channel 0-15
mbed_official 25:45dcbf2ba11d 264 * @param key 0-127
mbed_official 25:45dcbf2ba11d 265 * @param value 0-127
mbed_official 25:45dcbf2ba11d 266 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 267 */
mbed_official 25:45dcbf2ba11d 268 bool sendControlChange(uint8_t channel, uint8_t key, uint8_t value);
mbed_official 25:45dcbf2ba11d 269
mbed_official 25:45dcbf2ba11d 270 /**
mbed_official 25:45dcbf2ba11d 271 * Send a program change event
mbed_official 25:45dcbf2ba11d 272 *
mbed_official 25:45dcbf2ba11d 273 * @param channel 0-15
mbed_official 25:45dcbf2ba11d 274 * @param program 0-127
mbed_official 25:45dcbf2ba11d 275 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 276 */
mbed_official 25:45dcbf2ba11d 277 bool sendProgramChange(uint8_t channel, uint8_t program);
mbed_official 25:45dcbf2ba11d 278
mbed_official 25:45dcbf2ba11d 279 /**
mbed_official 25:45dcbf2ba11d 280 * Send a channel pressure event
mbed_official 25:45dcbf2ba11d 281 *
mbed_official 25:45dcbf2ba11d 282 * @param channel 0-15
mbed_official 25:45dcbf2ba11d 283 * @param pressure 0-127
mbed_official 25:45dcbf2ba11d 284 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 285 */
mbed_official 25:45dcbf2ba11d 286 bool sendChannelPressure(uint8_t channel, uint8_t pressure);
mbed_official 25:45dcbf2ba11d 287
mbed_official 25:45dcbf2ba11d 288 /**
mbed_official 25:45dcbf2ba11d 289 * Send a control change event
mbed_official 25:45dcbf2ba11d 290 *
mbed_official 25:45dcbf2ba11d 291 * @param channel 0-15
mbed_official 25:45dcbf2ba11d 292 * @param key 0(lower)-8191(center)-16383(higher)
mbed_official 25:45dcbf2ba11d 293 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 294 */
mbed_official 25:45dcbf2ba11d 295 bool sendPitchBend(uint8_t channel, uint16_t value);
mbed_official 25:45dcbf2ba11d 296
mbed_official 25:45dcbf2ba11d 297 /**
mbed_official 25:45dcbf2ba11d 298 * Send a single byte event
mbed_official 25:45dcbf2ba11d 299 *
mbed_official 25:45dcbf2ba11d 300 * @param data 0-255
mbed_official 25:45dcbf2ba11d 301 * @return true if message sent successfully
mbed_official 25:45dcbf2ba11d 302 */
mbed_official 25:45dcbf2ba11d 303 bool sendSingleByte(uint8_t data);
mbed_official 25:45dcbf2ba11d 304
mbed_official 25:45dcbf2ba11d 305 protected:
mbed_official 25:45dcbf2ba11d 306 //From IUSBEnumerator
mbed_official 25:45dcbf2ba11d 307 virtual void setVidPid(uint16_t vid, uint16_t pid);
mbed_official 25:45dcbf2ba11d 308 virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); //Must return true if the interface should be parsed
mbed_official 25:45dcbf2ba11d 309 virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
mbed_official 25:45dcbf2ba11d 310
mbed_official 25:45dcbf2ba11d 311 private:
mbed_official 25:45dcbf2ba11d 312 USBHost * host;
mbed_official 25:45dcbf2ba11d 313 USBDeviceConnected * dev;
mbed_official 25:45dcbf2ba11d 314 USBEndpoint * bulk_in;
mbed_official 25:45dcbf2ba11d 315 USBEndpoint * bulk_out;
mbed_official 25:45dcbf2ba11d 316 uint32_t size_bulk_in;
mbed_official 25:45dcbf2ba11d 317 uint32_t size_bulk_out;
mbed_official 25:45dcbf2ba11d 318
mbed_official 25:45dcbf2ba11d 319 bool dev_connected;
mbed_official 25:45dcbf2ba11d 320
mbed_official 25:45dcbf2ba11d 321 void init();
mbed_official 25:45dcbf2ba11d 322
mbed_official 25:45dcbf2ba11d 323 uint8_t buf[64];
mbed_official 25:45dcbf2ba11d 324
mbed_official 25:45dcbf2ba11d 325 void rxHandler();
mbed_official 25:45dcbf2ba11d 326
mbed_official 25:45dcbf2ba11d 327 uint16_t sysExBufferPos;
mbed_official 25:45dcbf2ba11d 328 uint8_t sysExBuffer[64];
mbed_official 25:45dcbf2ba11d 329
mbed_official 25:45dcbf2ba11d 330 void (*miscellaneousFunctionCode)(uint8_t, uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 331 void (*cableEvent)(uint8_t, uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 332 void (*systemCommonTwoBytes)(uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 333 void (*systemCommonThreeBytes)(uint8_t, uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 334 void (*systemExclusive)(uint8_t *, uint16_t, bool);
mbed_official 25:45dcbf2ba11d 335 void (*noteOff)(uint8_t, uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 336 void (*noteOn)(uint8_t, uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 337 void (*polyKeyPress)(uint8_t, uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 338 void (*controlChange)(uint8_t, uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 339 void (*programChange)(uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 340 void (*channelPressure)(uint8_t, uint8_t);
mbed_official 25:45dcbf2ba11d 341 void (*pitchBend)(uint8_t, uint16_t);
mbed_official 25:45dcbf2ba11d 342 void (*singleByte)(uint8_t);
mbed_official 25:45dcbf2ba11d 343
mbed_official 25:45dcbf2ba11d 344 bool sendMidiBuffer(uint8_t data0, uint8_t data1, uint8_t data2, uint8_t data3);
mbed_official 25:45dcbf2ba11d 345
mbed_official 25:45dcbf2ba11d 346 int midi_intf;
mbed_official 25:45dcbf2ba11d 347 bool midi_device_found;
mbed_official 25:45dcbf2ba11d 348
mbed_official 25:45dcbf2ba11d 349 };
mbed_official 25:45dcbf2ba11d 350
mbed_official 25:45dcbf2ba11d 351 #endif /* USBHOST_MIDI */
mbed_official 25:45dcbf2ba11d 352
mbed_official 25:45dcbf2ba11d 353 #endif /* USBHOSTMIDI_H */