mirror of
https://github.com/ayabusa/Numworks-zeta-os.git
synced 2024-11-22 02:53:25 +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;
|
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 */
|
You can find the button struct definition in keyboard.h */
|
||||||
struct button* keyboard_scan();
|
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
|
#endif
|
@ -5,10 +5,10 @@ void main_entry(){
|
|||||||
// init all the peripherals
|
// init all the peripherals
|
||||||
laplace_init();
|
laplace_init();
|
||||||
ms_wait(2000);
|
ms_wait(2000);
|
||||||
set_led_green(true);
|
|
||||||
|
|
||||||
// infinite loop
|
// infinite loop
|
||||||
while (1){
|
while (1){
|
||||||
|
/*
|
||||||
struct button * keyboard_state = keyboard_scan();
|
struct button * keyboard_state = keyboard_scan();
|
||||||
|
|
||||||
for(int i =0; i < 54; i++){
|
for(int i =0; i < 54; i++){
|
||||||
@ -26,13 +26,12 @@ void main_entry(){
|
|||||||
set_led_green(false);
|
set_led_green(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(keyboard_state[i].column == 2 && keyboard_state[i].row == 'H'){
|
}*/
|
||||||
if(keyboard_state[i].state){
|
|
||||||
set_led_red(true);
|
if(get_key('G', 3)){
|
||||||
}else{
|
set_led_red(true);
|
||||||
set_led_red(false);
|
}else{
|
||||||
}
|
set_led_red(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user