Jump to content

multi function button handling


Screaming_Rabbit
 Share

Recommended Posts

Hello

Does anybody know about it's possible to implement following multi function button handling by programming?

Description:

I'd like to have 4 or more "shift" buttons (Shift 1-4) to select the functions for Buttons A+B.

Example:

- I press and hold [shift1] the functions the MidiBox sends now would be "CUT" for [buttonA] and "PASTE" for [buttonB]

- I press and hold [shift2] the functions the MidiBox sends now would be "JUMP to Clip Left" for [buttonA] and "JUMP to Clip Right" for [buttonB]

- I press and hold [shift3] the functions the MidiBox sends now would be "JUMP to Marker Left" for [buttonA] and "JUMP to Marker Right" for [buttonB]

... and so on

Logical Shematic:

               

    Button B ___/  _____________________________________________

                                    |                  |                  |                  |

                                    |                  |                  |                  |

                                    |                  |                  |                  |

                                    |                  |                  |                  |

    Button A ___/  _______|____________|____________|________    |

                                |  |              |  |              |  |            |  |

                                |  |              |  |              |  |            |  |

                                |  |              |  |              |  |            |  |

                                |  |              |  |              |  |            |  |

                                |  |              |  |              |  |            |  |

                        Shift1/--/            2/--/              3/--/            4/--/

                                |  |              |  |              |  |            |  |

                                |  |              |  |              |  |            |  |

                                |  |              |  |              |  |            |  |

                                |  |              |  |              |  |            |  |

                              \/  \/            \/  \/              \/  \/            \/  \/

                          ===========================================

                          |    F  F              F  F              F  F            F  F    |

                          |    u  u              u  u              u  u            u  u    |

                          |    n  n              n  n              n  n            n  n    |

                          |    k  k              k  k              k  k            k  k    |

                          |    t  t              t  t              t  t            t  t    |

                          |    i  i                i  i                i  i              i  i    |

                          |    o  o              o  o              o  o            o  o    |

                          |    n  n              n  n              n  n            n  n    |

                          |                                                                          |

                          |    1  1              2  2              3  3            4  4    |

                          |    A  B              A  B              A  B            A  B    |

                          ==========================================

Thanks and Greets

Roger

Link to comment
Share on other sites

screaming

Are you doing this in assembly or C?

I do something like this in my project. It looks something like this.

From DIN_NotifyToggle() I have ButtonHandler(pin)

/* global var */
shiftmode = 0;

/* you simply toggle a shift mode to an ON state.
 * If you want to hold down a shift, then simply check the pin to see if its currently closed.
 *
*/


void ButtonHandler(unsigned char pin) {

	switch(pin) 
	{
		case DIN_A_Button:

		switch(shiftmode) {

			case MODE1:
				DoCut();
				break;

			case MODE2:
				DoJumpLeft();				
				break;

			case MODE3:
				DoJumpMarkerLeft();				
				break;								
			<etc...>		
		}					
			break;

		case DIN_B_Button:

		switch(shiftmode ) {

			case MODE1:
				DoPaste();
				break;

			case MODE2:
				DoJumpRight();				
				break;

			case MODE3:
				DoJumpMarkerRight();				
				break;				

			<etc...>

		}

			break;

		case DIN_Shift1:
			shiftmode = MODE1;
		break;

		case DIN_Shift2:
			shiftmode = MODE2;
		break;

		case DIN_Shift3:
			shiftmode = MODE3;
		break;

		case DIN_Shift4:
			shiftmode = MODE4;
		break;


	}

}

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...
 Share

×
×
  • Create New...