Files
picocalc-os-rs/kernel/src/abi.rs
sawyer bristol 6dcdd88a0f can run entrypoint on user elf
syscalls via call_abi are still not working
2025-08-03 18:55:26 -06:00

34 lines
869 B
Rust

use abi::Syscall;
use defmt::info;
use embassy_futures::block_on;
use embedded_graphics::{
Drawable,
pixelcolor::Rgb565,
prelude::{Point, RgbColor, Size},
primitives::{PrimitiveStyle, Rectangle, StyledDrawable},
};
use crate::display::FRAMEBUFFER;
#[allow(unused)]
pub fn call_abi(call: *const Syscall) {
info!("called abi");
let call = unsafe { &*call };
match call {
Syscall::DrawPixel { x, y, color } => {
draw_pixel(*x, *y, *color);
}
}
}
fn draw_pixel(x: u32, y: u32, color: u16) {
info!("draw pixel abi called");
let framebuffer = block_on(FRAMEBUFFER.lock());
Rectangle::new(Point::new(x as i32, y as i32), Size::new(1, 1))
.draw_styled(
&PrimitiveStyle::with_fill(Rgb565::RED),
*framebuffer.borrow_mut().as_mut().unwrap(),
)
.unwrap();
}