-
Notifications
You must be signed in to change notification settings - Fork 119
Support Embedded Graphics using the screen
system call
#579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
0a1bb6f
to
8bc3eaf
Compare
This library implements the DrawTarget trait for the Tock screen syscall.
8bc3eaf
to
0c1529a
Compare
Ok this is now updated with both demo apps and the Makefiles in each demo, giving examples of out-of-tree builds. |
I don't understand what change is leading to the CI failures. https://github.com/tock/libtock-rs/actions/runs/17407217165/job/49414698382, eg
|
It requires a Tock runtime, so can't be run using normal host test.
pub struct TockMonochromeScreen { | ||
/// The framebuffer for the max supported screen size (128x64). Each pixel | ||
/// is a bit. | ||
framebuffer: [u8; (128 * 64) / 8], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this max screen size coming from?
use libtock::display::Screen; | ||
use libtock_platform::ErrorCode; | ||
|
||
pub struct TockMonochromeScreen { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this monochrome-specific? The Screen
isn't, is it?
let (width, height) = Screen::get_resolution().unwrap_or((0, 0)); | ||
|
||
Self { | ||
framebuffer: [0; 1024], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the C version, this is dynamically allocated. I understand why it might be better to statically allocate, especially with good support in Rust, but a fixed 1024-byte array kinda sucks.
Can it be parameterized by a const
type parameter (perhaps with a default?) instead? At least as far as the kernel is concerned, the framebuffer can be arbitrarily smaller than the screen resolution (or larger technically, it's just a buffer). It would perhaps complicate draw_iter
not to assume framebuffer size == resolution
but...
@@ -0,0 +1,3 @@ | |||
#![no_std] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A module comment. An example of use would be best probably
This uses #568.
It provides basic support for using the embedded graphics library with the Tock screen syscall.
I was able to port the spin demo from libtock-c and verify that it works on the nrf52840dk with the attached monochromatic screen.