Screaming_Rabbit Posted December 6, 2006 Report Posted December 6, 2006 HelloDoes 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 onLogical 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 GreetsRoger
jackchaos Posted December 7, 2006 Report Posted December 7, 2006 screamingAre 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; } }
Screaming_Rabbit Posted December 7, 2006 Author Report Posted December 7, 2006 Are you doing this in assembly or C?I prefer "C"THX for the code-example, Jack!Greets, Roger
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now