Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: F401RE-USBHostMIDI_RecieveExample
Fork of F401RE-USBHost by
Revision 27:23fa4e04b1db, committed 2014-10-13
- Comitter:
- hsgw
- Date:
- Mon Oct 13 19:33:40 2014 +0000
- Parent:
- 26:077ab26227c6
- Commit message:
- Fix freeze bug on F401RE.; callback functions are initialized by dummy functions.
Changed in this revision
| USBHostMIDI/USBHostMIDI.cpp | Show annotated file Show diff for this revision Revisions of this file |
| USBHostMIDI/USBHostMIDI.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/USBHostMIDI/USBHostMIDI.cpp Thu Sep 18 12:32:33 2014 +0000
+++ b/USBHostMIDI/USBHostMIDI.cpp Mon Oct 13 19:33:40 2014 +0000
@@ -42,6 +42,23 @@
midi_intf = -1;
midi_device_found = false;
sysExBufferPos = 0;
+
+ // init callback functions
+
+ miscellaneousFunctionCode = &callbackDummy3Bytes;
+ cableEvent = callbackDummy3Bytes;
+ systemCommonTwoBytes = &callbackDummy2Bytes;
+ systemCommonThreeBytes = &callbackDummy3Bytes;
+ systemExclusive = &callbackDummysystemExclusive;
+ noteOff = &callbackDummy3Bytes;
+ noteOn = &callbackDummy3Bytes;
+ polyKeyPress = &callbackDummy3Bytes;
+ controlChange = &callbackDummy3Bytes;
+ programChange = &callbackDummy2Bytes;
+ channelPressure = &callbackDummy2Bytes;
+ pitchBend = &callbackDummypitchBend;
+ singleByte = &callbackDummysingleByte;
+
}
bool USBHostMIDI::connected()
@@ -333,6 +350,10 @@
return sendMidiBuffer(15, data, 0, 0);
}
+void callback_dummy(uint8_t firstArg, ...){
+ USB_DBG("Not attached command comming! %d\n", firstArg);
+}
+
/*virtual*/ void USBHostMIDI::setVidPid(uint16_t vid, uint16_t pid)
{
// we don't check VID/PID for this driver
--- a/USBHostMIDI/USBHostMIDI.h Thu Sep 18 12:32:33 2014 +0000
+++ b/USBHostMIDI/USBHostMIDI.h Mon Oct 13 19:33:40 2014 +0000
@@ -347,6 +347,27 @@
void (*singleByte)(uint8_t);
bool sendMidiBuffer(uint8_t data0, uint8_t data1, uint8_t data2, uint8_t data3);
+
+ // dummy callback function
+ static void callbackDummysingleByte(uint8_t a) {
+ USB_INFO("Not attached command comming! First byte %d\n", a);
+ return;
+ }
+
+ static void callbackDummy2Bytes(uint8_t a, uint8_t b){
+ callbackDummysingleByte(a);
+ }
+
+ static void callbackDummy3Bytes(uint8_t a, uint8_t b, uint8_t c){
+ callbackDummysingleByte(a);
+ }
+
+ static void callbackDummysystemExclusive(uint8_t *a, uint16_t b, bool c){
+ callbackDummysingleByte(a[0]);
+ }
+ static void callbackDummypitchBend(uint8_t a, uint16_t b){
+ callbackDummysingleByte(a);
+ }
int midi_intf;
bool midi_device_found;
