mirror of
https://github.com/LegitCamper/picocalc-os-rs.git
synced 2025-12-27 15:55:25 +00:00
use C abi for syscalls
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#![no_main]
|
||||
|
||||
extern crate alloc;
|
||||
use abi::{KeyCode, display::Display, get_key, lock_display, print};
|
||||
use abi::{KeyCode, KeyState, display::Display, get_key, lock_display, print};
|
||||
use alloc::{format, string::String, vec, vec::Vec};
|
||||
use core::panic::PanicInfo;
|
||||
use embedded_graphics::{
|
||||
@@ -105,7 +105,8 @@ pub fn main() {
|
||||
lock_display(false);
|
||||
}
|
||||
|
||||
if let Some(event) = get_key() {
|
||||
let event = get_key();
|
||||
if event.state != KeyState::Idle {
|
||||
match event.key {
|
||||
KeyCode::Char(ch) => {
|
||||
input.push(ch);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
extern crate alloc;
|
||||
use abi::{
|
||||
KeyCode, Rng,
|
||||
KeyCode, KeyState, Rng,
|
||||
display::{Display, SCREEN_HEIGHT, SCREEN_WIDTH},
|
||||
get_key, lock_display, print, sleep,
|
||||
};
|
||||
@@ -46,7 +46,8 @@ pub fn main() {
|
||||
);
|
||||
|
||||
loop {
|
||||
if let Some(event) = get_key() {
|
||||
let event = get_key();
|
||||
if event.state != KeyState::Idle {
|
||||
let direction = match event.key {
|
||||
KeyCode::Up => Direction::Up,
|
||||
KeyCode::Down => Direction::Down,
|
||||
@@ -56,7 +57,7 @@ pub fn main() {
|
||||
_ => Direction::None,
|
||||
};
|
||||
game.set_direction(direction);
|
||||
}
|
||||
};
|
||||
|
||||
// ensure all draws show up at once
|
||||
lock_display(true);
|
||||
|
||||
Reference in New Issue
Block a user