mirror of
https://github.com/ayabusa/Numworks-zeta-os.git
synced 2024-11-21 10:43:26 +00:00
added get_key() function to Laplace
This commit is contained in:
parent
6e5e5ddda6
commit
3a4fa32c93
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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;
|
||||
}
|
@ -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
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user