mstanley:
If I understand you correctly take a look at the DynamicKeypad example.File --> Examples --> Keypad --> DynamicKeypad:
|| @description
|| | This is a demonstration of keypadEvents. It's used to switch between keymaps
|| | while using only one keypad.It's like your phone switching between one keypad with numbers, another with letters, and yet another with symbols.
I have had a look at it and I am not sure that will work because I am actually creating different sizes matrixes an in many cases dual matrix sets instead of one.. I don't actually have a lot of code written for this so Im not sure it can be tested yet..
Anyway what I am trying to do is to that I will have four options for Matrixes using the same input pins. The Main Matrix is a 4r x 7c
Option #1 is a Button Matrix of 4r x 7r
Option #2 is a Dual Button Matrix of 3r x 7r + a 2nd Button Matrix on the last row of the original matrix (1r x 7r)
Option #3 is a Dual Button Matrix of 2r x 7r + a 2nd Button Matrix on the last 2 rows of the original matrix (2r x 7r)
Option #4 is a Dual Button Matrix of 1r x 7r + a 2nd Button Matrix on the last 3 rows of the original matrix (3r x 7r)
This is where I think the Dynamic Keypad example won't work as I am not really changing characters only but I am actually changing the Matrix sizing as well as the reference to the input pins.
So what I am hoping is that there is a way that I can define all 7 different Matrix options, and then depending on certain physical parameters applied to the Teensy changing the keypads that are run through the system. This only will need to be done at startup so the actual determination of the KeyPads to be used would be in Set-up.
So in Practice if I had the modifier set to -
Option 1, then only the 28 button 4x7 matrix would be used and sent through the Keypress system.
so if I could say :
Keypad A = KeypadA Matrix 28 (4r x 7c)
Then
if I have the modifiers set to one of the other options (2-4) then the dual matrixes would be sent to their corresponding Keypress systems.
opt 1
Keypad A = KeypadA 21 (3r x 7c)
Keypad B = KeypadB 7 (1r x 7c)
or
opt 2
Keypad A = KeypadA 14 (2r x 7c)
Keypad B = KeypadB 14 (2r x 7c)
or
opt 3
Keypad A = KeypadA 7 (1r x 7c)
Keypad B = KeypadB 21 (3r x 7c)
Then Keypad A and Keypad B would be sent through the Button Press Decoding loops for the correct Matrix either A or B.
As I mentioned I could do this the long way with a BUNCH of if statements and a New Decoding loop for Each of the 4 combinations but I am hoping there is a more concise way by actually determining the correct Keypads to be used in Set-up and then actually only use those..
Now after I wrote this out One thing that I though of that I haven't just done trial and error on is CAN the actual initialization of the Keypad take place inside the Set-up.
i.e
void setup() {
Serial.begin(38400);
Keypad buttonmatrix = Keypad( makeKeymap(buttons), buttonrowPins, buttoncolPins, BUTTONROWS, BUTTONCOLS);
buttonmatrix.setDebounceTime(20); // Default is 50mS
}
If this can be done then I could use if statements to set-up the correct KeypadA and KeypadB's within the setup and it solves all the issues (I haven't tried that yet - but something is telling me it would fail compiling)