![](/media/cache/profiles/d707329bece455a462b58ce00d1194c9.50x50_q85.jpg)
keypad.cpp
- Committer:
- alex89
- Date:
- 2010-06-04
- Revision:
- 0:74b4b9fc9480
File content as of revision 0:74b4b9fc9480:
#include "main.h" int getKeyNum(){ DigitalIn col1(p18); DigitalIn col2(p20); DigitalIn col3(p16); DigitalOut row1(p19); DigitalOut row2(p14); DigitalOut row3(p15); DigitalOut row4(p17); row1 = 1; row2 = 0; row3 = 0; row4 = 0; if (col1) return 1; else if (col2) return 2; else if (col3) return 3; row1 = 0; row2 = 1; row3 = 0; row4 = 0; if (col1) return 4; else if (col2) return 5; else if (col3) return 6; row1 = 0; row2 = 0; row3 = 1; row4 = 0; if (col1) return 7; else if (col2) return 8; else if (col3) return 9; row1 = 0; row2 = 0; row3 = 0; row4 = 1; if (col1) return -2; else if (col2) return 0; else if (col3) return -3; row1 = 0; row2 = 0; row3 = 0; row4 = 0; return -1; }