fixes from nes

This commit is contained in:
2025-11-17 08:10:03 -07:00
parent 691ef2b26b
commit 1c1000dfcb
19 changed files with 212 additions and 57 deletions

View File

@@ -6,7 +6,7 @@ use abi::{
display::Display,
get_key,
keyboard::{KeyCode, KeyState},
print,
println,
};
use alloc::{format, string::String, vec, vec::Vec};
use core::panic::PanicInfo;
@@ -28,7 +28,7 @@ use embedded_layout::{
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
print!("user panic: {} @ {:?}", info.message(), info.location(),);
println!("user panic: {} @ {:?}", info.message(), info.location(),);
loop {}
}
@@ -38,7 +38,7 @@ pub extern "Rust" fn _start() {
}
pub fn main() {
print!("Starting Calculator app");
println!("Starting Calculator app");
let mut display = Display::take().unwrap();
let mut input = vec!['e', 'x', 'p', 'r', ':', ' '];
@@ -104,7 +104,7 @@ pub fn main() {
}
let event = get_key();
if event.state != KeyState::Idle {
if event.state == KeyState::Released {
match event.key {
KeyCode::Char(ch) => {
input.push(ch);

View File

@@ -8,7 +8,7 @@ use abi::{
fs::{Entries, list_dir, read_file},
get_key,
keyboard::{KeyCode, KeyState},
print,
println,
};
use alloc::{format, vec};
use core::panic::PanicInfo;
@@ -20,7 +20,7 @@ use tinybmp::Bmp;
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
print!("user panic: {} @ {:?}", info.message(), info.location());
println!("user panic: {} @ {:?}", info.message(), info.location());
loop {}
}
@@ -30,7 +30,7 @@ pub extern "Rust" fn _start() {
}
pub fn main() {
print!("Starting Gallery app");
println!("Starting Gallery app");
let mut bmp_buf = vec![0_u8; 100_000];
let mut display = Display::take().unwrap();
@@ -49,7 +49,7 @@ pub fn main() {
break; // only draw 3x3
}
print!("file: {}", file);
println!("file: {}", file);
if file.extension().unwrap_or("") == "bmp" || file.extension().unwrap_or("") == "BMP" {
let file_path = format!("/images/{}", file);

View File

@@ -5,6 +5,6 @@ edition = "2024"
[dependencies]
abi = { path = "../../abi" }
embedded-graphics = "0.8.1"
selection_ui = { path = "../../selection_ui" }
embedded-graphics = "0.8.1"
tinygif = { git = "https://github.com/LegitCamper/tinygif" }

View File

@@ -7,7 +7,7 @@ use abi::{
fs::{Entries, file_len, list_dir, read_file},
get_key, get_ms,
keyboard::{KeyCode, KeyState},
print, sleep,
println, sleep,
};
use alloc::{format, vec, vec::Vec};
use core::panic::PanicInfo;
@@ -23,7 +23,7 @@ use tinygif::Gif;
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
print!("user panic: {} @ {:?}", info.message(), info.location(),);
println!("user panic: {} @ {:?}", info.message(), info.location(),);
loop {}
}
@@ -33,7 +33,7 @@ pub extern "Rust" fn _start() {
}
pub fn main() {
print!("Starting Gif app");
println!("Starting Gif app");
let mut display = Display::take().unwrap();
let mut entries = Entries::new();
@@ -41,9 +41,10 @@ pub fn main() {
let mut files = entries.entries();
files.retain(|e| e.extension().unwrap_or("") == "gif");
let gifs = &files.iter().map(|e| e.full_name()).collect::<Vec<&str>>();
let mut gifs = files.iter().map(|e| e.full_name()).collect::<Vec<&str>>();
gifs.sort();
let mut selection_ui = SelectionUi::new(&gifs);
let mut selection_ui = SelectionUi::new(&mut gifs);
let selection = match selection_ui.run_selection_ui(&mut display) {
Ok(maybe_sel) => maybe_sel,
Err(e) => match e {
@@ -66,7 +67,7 @@ pub fn main() {
let size = file_len(&file_name);
let mut buf = vec![0_u8; size];
let read = read_file(&file_name, 0, &mut buf);
print!("read: {}, file size: {}", read, size);
println!("read: {}, file size: {}", read, size);
assert!(read == size);
let gif = Gif::<Rgb565>::from_slice(&buf).expect("Failed to parse gif");

View File

@@ -7,7 +7,7 @@ use abi::{
display::{Display, SCREEN_HEIGHT, SCREEN_WIDTH},
get_key,
keyboard::{KeyCode, KeyState},
print, sleep,
println, sleep,
};
use core::panic::PanicInfo;
use embedded_graphics::{pixelcolor::Rgb565, prelude::RgbColor};
@@ -15,7 +15,7 @@ use embedded_snake::{Direction, SnakeGame};
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
print!("user panic: {} @ {:?}", info.message(), info.location(),);
println!("user panic: {} @ {:?}", info.message(), info.location(),);
loop {}
}
@@ -27,7 +27,7 @@ pub extern "Rust" fn _start() {
const CELL_SIZE: usize = 8;
pub fn main() {
print!("Starting Snake app");
println!("Starting Snake app");
let mut display = Display::take().unwrap();
let mut game = SnakeGame::<100, Rgb565, Rng>::new(