Juan Angel García
/
Teclado
Teclado por interrupciones
Revision 0:7c2fe73deaa8, committed 2017-03-10
- Comitter:
- jangelgm
- Date:
- Fri Mar 10 09:20:17 2017 +0000
- Commit message:
- Teclado por interrupciones
Changed in this revision
diff -r 000000000000 -r 7c2fe73deaa8 keypad.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/keypad.lib Fri Mar 10 09:20:17 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/yoonghm/code/keypad/#da060f8c03e8
diff -r 000000000000 -r 7c2fe73deaa8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Mar 10 09:20:17 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file
diff -r 000000000000 -r 7c2fe73deaa8 teclado.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/teclado.cpp Fri Mar 10 09:20:17 2017 +0000 @@ -0,0 +1,30 @@ +#include "mbed.h" +#include "Keypad.h" + +// Define your own keypad values +char Keytable[]= {'1','2','3','A',// r0 + '4','5','6','B',// r1 + '7','8','9','C',// r2 + '*','0','#','D' // r3 + }; + // c0 c1 c2 c3 + +uint32_t Index; + +uint32_t cbAfterInput(uint32_t index){ + Index=index; + return 0; +} + +int main() { + // r0 r1 r2 r3 c0 c1 c2 c3 + Keypad keypad(p21,p22,p23,p24,p25,p26,p27,p28); + keypad.attach(&cbAfterInput); + keypad.start(); + // energize the keypad via c0-c3 + while(1){ + __wfi(); + printf("Interrupted\r\n"); + printf("Index: %d => Key: %c\r\n",Index,Keytable[Index]); + } +}