uint8_t usb_midi_msg_data1; | uint8_t usb_midi_msg_data1; | ||||
uint8_t usb_midi_msg_data2; | uint8_t usb_midi_msg_data2; | ||||
uint8_t usb_midi_msg_sysex[USB_MIDI_SYSEX_MAX]; | uint8_t usb_midi_msg_sysex[USB_MIDI_SYSEX_MAX]; | ||||
uint8_t usb_midi_msg_sysex_len; | |||||
uint16_t usb_midi_msg_sysex_len; | |||||
void (*usb_midi_handleNoteOff)(uint8_t ch, uint8_t note, uint8_t vel) = NULL; | void (*usb_midi_handleNoteOff)(uint8_t ch, uint8_t note, uint8_t vel) = NULL; | ||||
void (*usb_midi_handleNoteOn)(uint8_t ch, uint8_t note, uint8_t vel) = NULL; | void (*usb_midi_handleNoteOn)(uint8_t ch, uint8_t note, uint8_t vel) = NULL; | ||||
void (*usb_midi_handleVelocityChange)(uint8_t ch, uint8_t note, uint8_t vel) = NULL; | void (*usb_midi_handleVelocityChange)(uint8_t ch, uint8_t note, uint8_t vel) = NULL; | ||||
if (type1 >= 0x06) sysex_byte(n >> 16); | if (type1 >= 0x06) sysex_byte(n >> 16); | ||||
if (type1 == 0x07) sysex_byte(n >> 24); | if (type1 == 0x07) sysex_byte(n >> 24); | ||||
usb_midi_msg_data1 = usb_midi_msg_sysex_len; | usb_midi_msg_data1 = usb_midi_msg_sysex_len; | ||||
usb_midi_msg_data2 = usb_midi_msg_sysex_len >> 8; | |||||
usb_midi_msg_sysex_len = 0; | usb_midi_msg_sysex_len = 0; | ||||
usb_midi_msg_type = 7; // 7 = Sys Ex | usb_midi_msg_type = 7; // 7 = Sys Ex | ||||
if (usb_midi_handleSysEx) | if (usb_midi_handleSysEx) |
#define SystemExclusive 7 | #define SystemExclusive 7 | ||||
*/ | */ | ||||
#define USB_MIDI_SYSEX_MAX 60 // maximum sysex length we can receive | |||||
// maximum sysex length we can receive | |||||
#if defined(__MKL26Z64__) || defined(__MK20DX128__) | |||||
#define USB_MIDI_SYSEX_MAX 60 | |||||
#else | |||||
#define USB_MIDI_SYSEX_MAX 290 | |||||
#endif | |||||
// C language implementation | // C language implementation | ||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
extern uint8_t usb_midi_msg_data1; | extern uint8_t usb_midi_msg_data1; | ||||
extern uint8_t usb_midi_msg_data2; | extern uint8_t usb_midi_msg_data2; | ||||
extern uint8_t usb_midi_msg_sysex[USB_MIDI_SYSEX_MAX]; | extern uint8_t usb_midi_msg_sysex[USB_MIDI_SYSEX_MAX]; | ||||
extern uint8_t usb_midi_msg_sysex_len; | |||||
extern uint16_t usb_midi_msg_sysex_len; | |||||
extern void (*usb_midi_handleNoteOff)(uint8_t ch, uint8_t note, uint8_t vel); | extern void (*usb_midi_handleNoteOff)(uint8_t ch, uint8_t note, uint8_t vel); | ||||
extern void (*usb_midi_handleNoteOn)(uint8_t ch, uint8_t note, uint8_t vel); | extern void (*usb_midi_handleNoteOn)(uint8_t ch, uint8_t note, uint8_t vel); | ||||
extern void (*usb_midi_handleVelocityChange)(uint8_t ch, uint8_t note, uint8_t vel); | extern void (*usb_midi_handleVelocityChange)(uint8_t ch, uint8_t note, uint8_t vel); |