]> git.ayabusa.dev Git - numworks-zeta-os.git/commitdiff
added get_key() function to Laplace
authorayabusa <lebgpub@gmail.com>
Mon, 15 Apr 2024 17:03:58 +0000 (19:03 +0200)
committerayabusa <lebgpub@gmail.com>
Mon, 15 Apr 2024 17:03:58 +0000 (19:03 +0200)
numworks_port/build/Laplace/keyboard.o
numworks_port/build/main.bin
numworks_port/build/main.elf
numworks_port/build/main.o
numworks_port/src/Laplace/keyboard.c
numworks_port/src/Laplace/keyboard.h
numworks_port/src/main.c

index 84570ffd4694a6a632a17e4dd4d8e653bdef95e6..7962349cca4579b6435d2b41eaf9f6e47cbaea08 100644 (file)
Binary files a/numworks_port/build/Laplace/keyboard.o and b/numworks_port/build/Laplace/keyboard.o differ
index e7aefdb6bf149dc676765304599d73dc28122c7e..90cc9f1a85de47aa0f9fcdca4a42f73854b3e667 100755 (executable)
Binary files a/numworks_port/build/main.bin and b/numworks_port/build/main.bin differ
index 3051e3e479e8a7f69d3aeaa78006702983b83cc1..b2b547f9d0e96d9cf2bf20ec90f7e1c6c40ef5d7 100755 (executable)
Binary files a/numworks_port/build/main.elf and b/numworks_port/build/main.elf differ
index 1d3f27abf7148116d338a9df95a76981f101dd83..e6051ad8b9f98d5b3cfe510564595d68b3da1454 100644 (file)
Binary files a/numworks_port/build/main.o and b/numworks_port/build/main.o differ
index 5d4563b3e92624771643ac757f2e9f747b4b894c..8d580d1a58e7aea6c27432ef9deb6ee670607203 100644 (file)
@@ -90,3 +90,14 @@ struct button* keyboard_scan(){
     return result_button_list;
 }
 
+/* Scans the specified key and return true if pressed 
+   It's more performant that scanning the whole keyboard */
+bool get_key(char row, uint8_t column){
+    for(int i = 0; i < number_of_rows; i++){
+        if(row==row_list[i]){
+            activate_row(i);
+            return(read_input_pin(GPIO_C, column));
+        }
+    }
+    return false;
+}
\ No newline at end of file
index 35be241c603f945b8a4e0af0eb3eb7203bacd6f4..942c240e7dc43b33de6cc0c2749eee376f3fe2cd 100644 (file)
@@ -23,4 +23,8 @@ void keyboard_init();
    You can find the button struct definition in keyboard.h */
 struct button* keyboard_scan();
 
+/* Scans the specified key and return true if pressed 
+   It's more performant that scanning the whole keyboard */
+bool get_key(char row, uint8_t column);
+
 #endif
\ No newline at end of file
index 9c8401d834e613e383ac6bf10c804a60fb577d62..241d613674d34f8ac8b7e8708aacbaf20aeb0717 100644 (file)
@@ -5,10 +5,10 @@ void main_entry(){
     // init all the peripherals
     laplace_init();
     ms_wait(2000);
-    set_led_green(true);
 
     // infinite loop
     while (1){
+        /*
         struct button * keyboard_state = keyboard_scan();
         
         for(int i =0; i < 54; i++){
@@ -26,13 +26,12 @@ void main_entry(){
                     set_led_green(false);
                 }
             }
-            if(keyboard_state[i].column == 2 && keyboard_state[i].row == 'H'){
-                if(keyboard_state[i].state){
-                    set_led_red(true);
-                }else{
-                    set_led_red(false);
-                }
-            }
+        }*/
+
+        if(get_key('G', 3)){
+            set_led_red(true);
+        }else{
+            set_led_red(false);
         }
     }