I can help you out, I’ve thought to the same device for a Matrix 1000 programmer 
exemple :
/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when an button has been toggled
// pin_value is 1 when button released, and 0 when button pressed
/////////////////////////////////////////////////////////////////////////////
void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparam
{
#if 1
// only for debugging - remove this (or change “#if 1” to “#if 0”) in a common application!
DEBUG_MSG_SendHeader();
DEBUG_MSG_SendCString("Button: ");
DEBUG_MSG_SendBCD3(pin);
DEBUG_MSG_SendChar(’ ');
DEBUG_MSG_SendCString(pin_value ? “depressed” : “pressed”);
DEBUG_MSG_SendFooter();
#endif
// a button has been pressed, send Note at channel 1
MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1
MIOS_MIDI_TxBufferPut(pin); // pin number corresponds to note number
MIOS_MIDI_TxBufferPut(pin_value ? 0x00 : 0x7f); // buttons are high-active
MIOS_MIDI_EndStream();
case 0 :
if (pin-value = 0){
MIOS_MIDI_TxBufferPut(message SysEx);
// et allumage de Led :
MIOS_DOUT_PinSet(unsigned char pin, unsigned char value);
}else{
faire une truc}
}
case 1 :
etc ..
/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when an encoder has been moved
// incrementer is positive when encoder has been turned clockwise, else
// it is negative
/////////////////////////////////////////////////////////////////////////////
void ENC_NotifyChange(unsigned char encoder, char incrementer) __wparam
{
}
/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when a pot has been moved
/////////////////////////////////////////////////////////////////////////////
void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam
{
switch (pin) {
MIOS_MIDI_BeginStream();
case 0 : //potard 0, soit AIN1 pin0
// a pot has been moved, send CC# or SySex<pin-number> at channel 1
MIOS_MIDI_TxBufferPut(0xb0); // CC at channel 1
MIOS_MIDI_TxBufferPut(0x00); // pin number corresponds to CC number
MIOS_MIDI_TxBufferPut(pin_value);
or
MIOS_MIDI_TxBufferPut( message sysex + pin_value )); // don’t send 10bit pin_value, but 7bit value
case 1 :
etc …
MIOS_MIDI_EndStream();
// notify display handler in DISPLAY_Tick() that AIN value has changed
last_ain_pin = pin;
app_flags.DISPLAY_UPDATE_REQ = 1;
}