September 4, 2011 3 Comments
This is a part of my recent design phi-panel. I decide to release it into the “wild” and see what happens. You are free to use it for not-for-profit purposes. In case you want to make money with it, you owe me some favor, so go ahead and buy a few of my phi-panels 😉
This code is totally compatible with the standard keypads library for arduino or my not-yet-released super phi_keypads library.
Multi-tap keypad mapping:
This is a generic phone keypad layout:
This is for my phi-panel with more functions than a generic keypad:
This is a video of me using multi-tap on phi-panel:
How to use:
You may change the definition of the multi-tap keypad, which contains 5 symbols per numerical key for all 10 numerical keys.
To use the function:
1) Call your keypad’s getKey method to receive a key. This key has to be ‘0’ to ‘9’ or other symbols such as ‘#’ or NO_KEY or scan codes for phi_keypads objects.
2) Call multi_tap and pass the received key to it.
3) The returned value indicates what is going on.
If the most significant bit (MSB) is set to 1, then the multi-tap is in process. You should print the return value (with MSB reset to 0) in place.
If MSB is reset to 0, then the multi-tap has concluded and a final character is produced. You should print this character in place and move cursor to the next position.
If the return value is NO-KEY, then nothing is happening.
Pressing the ‘#’ key engages or disengages shift to switch between upper and lower cases.
Calling the multi_tap with RESET_MTP will result in the multi_tap process to reset, useful if you are unsure of the function’s status. Say you didn’t finish a multi-tap process and switch to another piece of code and then later want to use multi-tap, you should reset it before using. The return value for this call is to be discarded.