diff --git a/numworks_port/build/Laplace/keyboard.o b/numworks_port/build/Laplace/keyboard.o index 84570ff..7962349 100644 Binary files a/numworks_port/build/Laplace/keyboard.o and b/numworks_port/build/Laplace/keyboard.o differ diff --git a/numworks_port/build/main.bin b/numworks_port/build/main.bin index e7aefdb..90cc9f1 100755 Binary files a/numworks_port/build/main.bin and b/numworks_port/build/main.bin differ diff --git a/numworks_port/build/main.elf b/numworks_port/build/main.elf index 3051e3e..b2b547f 100755 Binary files a/numworks_port/build/main.elf and b/numworks_port/build/main.elf differ diff --git a/numworks_port/build/main.o b/numworks_port/build/main.o index 1d3f27a..e6051ad 100644 Binary files a/numworks_port/build/main.o and b/numworks_port/build/main.o differ diff --git a/numworks_port/src/Laplace/keyboard.c b/numworks_port/src/Laplace/keyboard.c index 5d4563b..8d580d1 100644 --- a/numworks_port/src/Laplace/keyboard.c +++ b/numworks_port/src/Laplace/keyboard.c @@ -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 diff --git a/numworks_port/src/Laplace/keyboard.h b/numworks_port/src/Laplace/keyboard.h index 35be241..942c240 100644 --- a/numworks_port/src/Laplace/keyboard.h +++ b/numworks_port/src/Laplace/keyboard.h @@ -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 diff --git a/numworks_port/src/main.c b/numworks_port/src/main.c index 9c8401d..241d613 100644 --- a/numworks_port/src/main.c +++ b/numworks_port/src/main.c @@ -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); } }