can drawiter
This commit is contained in:
@@ -4,4 +4,4 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
abi = { path ="../../abi" }
|
||||
abi = { path = "../../abi" }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use abi::{Syscall, call_abi};
|
||||
use abi::{Pixel, Point, Rgb565, RgbColor, Syscall, call_abi};
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[panic_handler]
|
||||
@@ -11,14 +11,23 @@ fn panic(_info: &PanicInfo) -> ! {
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn _start() {
|
||||
for i in 0..300 {
|
||||
for o in 0..300 {
|
||||
let call = Syscall::DrawPixel {
|
||||
x: i,
|
||||
y: o,
|
||||
color: 0,
|
||||
};
|
||||
unsafe { call_abi(&call) };
|
||||
}
|
||||
// Local pixel buffer
|
||||
let mut pixels = [Pixel(Point { x: 50, y: 50 }, Rgb565::RED); 300];
|
||||
for (i, p) in pixels.iter_mut().enumerate() {
|
||||
*p = Pixel(
|
||||
Point {
|
||||
x: i as i32,
|
||||
y: i as i32,
|
||||
},
|
||||
Rgb565::RED,
|
||||
)
|
||||
}
|
||||
|
||||
// Construct syscall with raw pointer + length
|
||||
let call = Syscall::DrawIter {
|
||||
pixels: pixels.as_ptr(), // raw pointer
|
||||
len: pixels.len(), // number of elements
|
||||
};
|
||||
|
||||
unsafe { call_abi(&call) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user