Replies: 4 comments
-
Maybe? It would require someone to put in the time to make |
Beta Was this translation helpful? Give feedback.
-
On small embedded devices, you typically have 2 major limitations:
The interface speed is a bottleneck that limits the accessible frame rate. You either have to throttle the MCU to the bandwidth of the interface or use a framebuffer in RAM that is then transferred via DMA. This approach requires a good amount of RAM, depending on the pixel count. For a 320x240px display, this is 153600 bytes (2 bytes/px) in total - often more than what's acceptable. In practice, typically only parts of the screen area are updated to deal with those limitations. But this is a concept that immediate mode GUIs do not provide. |
Beta Was this translation helpful? Give feedback.
-
I have a UEFI application that runs on bare metal with access to a raw framebuffer that I thought this could be a cool use-case for, so I don't necessarily have the same limitations of a micro-controller. I did some digging around to see what it might take to make egui no_std. Let's just say it's not pretty... but I did manage to get it to compile with the Both of these crates used this pattern for reference The idea is to, depending on if std is an enabled feature or not, re-export the things that are used. So if std then just re-export the used items directly from std, but if no_std then re-export from core and alloc. This is what I ended up with. (it is just pulling from core/alloc. The std exports would have to be conditionally added) see nom or serde for an example. mod std {
pub use alloc::{borrow, boxed, rc, string, sync, vec};
pub mod collections {
pub use alloc::collections::*;
pub use ahash::HashMap;
pub use ahash::HashSet;
pub use hashbrown::hash_map;
}
// ..stub.. don't have this without os support
pub mod path {
#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct PathBuf {
inner: alloc::string::String,
}
}
// ..stub.. don't have this without os support
pub mod time {
pub use core::time::*;
#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct SystemTime {}
}
pub use core::{
cell, cmp, convert, f32, fmt, hash, iter, mem, ops, option, result, slice, str, f64, any
};
pub mod prelude {
pub use core::prelude as v1;
}
} Then all throughout the crate(s) you would reference this module rather than std directly like //use std::{boxed::Box, string::String, sync::Arc, vec::Vec};
use crate::std::{boxed::Box, string::String, sync::Arc, vec::Vec}; Challenges
Usage ChallengesIf I am thinking about this correctly, you would have to write your own drawing routines to draw the triangles or shapes from the DisclaimerI have yet to actually try to use the no_std version in the UEFI app. It was more just to satisfy my curiosity and I wanted to share my findings not knowing when I would get around to playing with it some more. |
Beta Was this translation helpful? Give feedback.
-
embedded_graphics may provide a solid foundation for rendering. There is a very basic |
Beta Was this translation helpful? Give feedback.
-
Would egui be a good choice for building Native UI's on a device like a STM32 with a connected display.. As it would run on bare metal.
Been struggling to find a well maintained option for doing no_std gui
Beta Was this translation helpful? Give feedback.
All reactions