??? 06/20/10 11:47 Read: times |
#176779 - Multi-tap is not too difficult Responding to: ???'s previous message |
Yes, just like a normal scanned 4x3 matrix, you just need to branch out each individual keypress to read from an array to get multi-tap. It has nothing to do with interrupts; you could or couldn't use them depending on your needs.
for example. your lookup table for a 4x3 routine might look like this #define STAR 10 #define HASH 11 const char Keytable[12] = {0,1,2,3,4,5,6,7,8,9,STAR,HASH}; To now make the same keyboard do alphabets is just an extension of this idea char Index; const char * const Keytable[] = {"0 ", "1.", "2ABC", "3DEF", "4GHI", "5JKL", "6MNO","7PQRS", "8TUV", "9WXYZ"}; Now, on decoding the matrix, you just need to read the pointed array at its index like this Key = Keytable[scankey][Index]; if (Index < strlen(KeyTable[scankey])) Index++; else Index = 0; The second and third line are used to move to the next letter in the array and depends on the size of the array. CAUTION : This code is untested and may not be syntactically right. I hope I've been able to convey the concept clearly. |
Topic | Author | Date |
Ideas for Multi-tap keyboard routine | 01/01/70 00:00 | |
just follow | 01/01/70 00:00 | |
Multi-tap is not too difficult | 01/01/70 00:00 | |
Two-step operation. Keyboard input + post-processing | 01/01/70 00:00 | |
State Machine! | 01/01/70 00:00 | |
Agree 100% | 01/01/70 00:00 | |
Time to code | 01/01/70 00:00 | |
Software Timers! | 01/01/70 00:00 | |
Practical Limits | 01/01/70 00:00 | |
Don't lock up in infinite loops everywhere | 01/01/70 00:00 | |
In the pseudo code... | 01/01/70 00:00 | |
State Machine | 01/01/70 00:00 | |
Divide by 5 | 01/01/70 00:00 | |
Timer resolution | 01/01/70 00:00 | |
State Machine | 01/01/70 00:00 | |
Looks not bad programming practice | 01/01/70 00:00 | |
Using Timer May Still be Possible | 01/01/70 00:00 | |
Done ! | 01/01/70 00:00 | |
Very Cool!!! | 01/01/70 00:00 | |
Compare with zero is better | 01/01/70 00:00 | |
Avoid ISR jitter using timer T1 | 01/01/70 00:00 | |
Code! | 01/01/70 00:00 | |
Thanks Munish...![]() | 01/01/70 00:00 |