Keypad .kstate question

mstanley:
If I understand you then what you are saying is that you would like to create several key maps and allow each one to call the same copy of code underlying the mechanism for scanning pressed buttons/keys?

I need to think about this for a bit but the first thing that comes to mind is <> NO WAY!!! YOU CAN'T DO THAT!!! :wink:

First off let me know if my assumption is right. I don't want to head down a rabbit hole just for the fun of it. But I'm already starting to get some ideas.

Yes, But not at the same time..

I right now I basically call an encoder Matrix and a corresponding Button Matrix under certain conditions. No matrixes overlap in process but if they were to all run together they of course would.

This is why I was asking if I can set-up essentially a common loop where under each of these situations I can point the appropriate matrix to the appropriate state code. however if the condition changes it would change the Keypad arrays that are presented to the loop .

ie

Say I have Keypad A, Keypad B, KeyPad C, and Keypad D
Keypad A is a 2x7 matrix and keypad B is a 2x7 matrix and go together over the same 4x7 space and
Keypad C is a 1x7 matrix and keypad D is a 3x7 matrix and go together over the same 4x7 space and
Both sets use the same pins..

So

If Condition A exists then I would like to know if I can do

KeypadAruntime = Keypad A
KeypadBruntime = Keypad B

and if the Condition changed from A To Condition B then

KeypadAruntime = Keypad C
KeypadBruntime = Keypad D

This way KeypadAruntime and KeypadBruntime are the pointers to the keypads that I want to use and then there is only one set of state loops for the KeypadAruntime and KeypadBruntime instead of 4 separate state loops one for each Keypad A, Keypad B, KeyPad C, and Keypad D

If it cannot be done then I guess I have things as streamlined as I can get.. though I am hoping it can be done..