Jump to content

Button shift layer for Midibox64E


neomorph

Recommended Posts

Hello everyone,

I'm new to this board (although reading for quite some time), and I want to equip my little box (MB64E) with an additional layer for the buttons, accessible by holding down a dedicated shift button. So far, so simple  ;)

I already had a deep look at the various examples here and in the SEQ/LC applications for getting an idea on how this could work.

For my needs, a complete second layer is not required (in this case, also the MB64E SYSEX format would have to be changed, right?).

My box only has 8 buttons I plan to use for the "shift job", so my (maybe too simple) idea was to check the status of the shift button during each toggle event and then just adding an offset of 32 to the current button number in case it is held.

I'm not exactly a PIC assembler guru, so I failed in implementing this correctly so far.

My questions:

a) Is it possible to implement the "tiny" shift layer idea as stated above?

b) If yes, how could I do this best within the MB64E application? I understand that an additional handler in USER_DIN_NotifyToggle is the solution for switching complete layers using additional button tables (like in the SEQ/LC applications). For my case, couldn't I just modify the MB64E_BUTTON_Handler for checking for the shift button status and then branching to a simple offset addition to the button number (e.g. 1+32=33)? The MB64E_MIDI_SendButtonEvent routine should do the rest by itself, or am I totally wrong?

I really appreciate any help or further ideas. Or even a small code example ...?

Thank you!

All the best, neomorph

Link to comment
Share on other sites

Hello,

I experimented a little bit more and got success! :D This is how my modification to the MB64E_BUTTON_Handler looks like:

MB64E_BUTTON_GP

      ;; save current button number in MB64E_CURRENT_BUTTON
      SET_BSR MB64E_BASE
      movf      MIOS_PARAMETER1, W
      movwf      MB64E_CURRENT_BUTTON, BANKED
      
      ;; check for shift button status
      movlw   0x10 
         call    MIOS_DIN_PinGet 
    bnz       MB64E_BUTTON_GP_NoShift
    goto      MB64E_BUTTON_GP_Shift

MB64E_BUTTON_GP_Shift

      ;; add offset for second layer
      movlw       32
      addwf      MB64E_CURRENT_BUTTON,1  

MB64E_BUTTON_GP_NoShift
      
      ;; branch to SFB handler if button has been assigned to 0xff
      call      MB64E_FSR_ButtonEvnt0
      incf      INDF0, W
      bnz            MB64E_BUTTON_GP_NoSFB
MB64E_BUTTON_GP_SFB

It seems to work perfectly, the only problem is that the shift button still sends out data by itself (of course).  For now, I just have assigned a F0 00 00 Meta Event which is ok, but I want to have a "clean" solution. How can I "filter" or suppress the events sent by the button?

Thanks for any help!

Link to comment
Share on other sites

Hi,

very nice solution! It doesn't take care for the LEDs, but if this doesn't matter I think you are happy :)

Filtering the shift button - you could add:

   ;; exit on event from button ID = 0x10
   movf MIOS_PARAMETER1, W
   xorlw 0x10
   skpnz
   return

at the beginning of the MB64E_BUTTON_GP function

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...