summaryrefslogtreecommitdiff
path: root/src/keypad.c
diff options
context:
space:
mode:
authorLoic Guegan <loic.guegan@mailbox.org>2023-12-26 09:06:40 +0100
committerLoic Guegan <loic.guegan@mailbox.org>2023-12-26 09:06:40 +0100
commit64917e3504c32f09a503675f3e43a362508725de (patch)
tree673fcc99f036d6a96534cf6c3db0a889387a9ad8 /src/keypad.c
parentf1c3a672947a3ba375ff24c3375aa7e87b2a0844 (diff)
Minor changes
Diffstat (limited to 'src/keypad.c')
-rw-r--r--src/keypad.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/keypad.c b/src/keypad.c
index d106642..f26c5e2 100644
--- a/src/keypad.c
+++ b/src/keypad.c
@@ -19,21 +19,19 @@ int map[]={
KEY_V // F
};
-int KeypadIsPressed(unsigned char c){
- if(c<=0xF){
- if(IsKeyPressed(map[c]))
- return 1;
+int KeypadKeycodeValid(int keycode){
+ for(int i=0;i<16;i++){
+ if(map[i]==keycode)
+ return i;
}
- return 0;
+ return -1;
}
+
int KeypadGetPressed(){
int keycode=GetKeyPressed();
if(keycode){
- for(int i=0;i<16;i++){
- if(map[i]==keycode)
- return 1;
- }
+ return KeypadKeycodeValid(keycode);
}
return -1;
}