slint/internal/backends/mcu
Olivier Goffart b54b9bae61 MCU partial renderer: Actually do not draw items that are not in the dirty region
We computed the clip, but still generated span and even rendered the full
line for items that were meant to be clipped
2022-03-15 09:42:17 +01:00
..
LICENSES Fix LICENSES symlinks 2022-02-09 17:05:47 +01:00
pico_st7789 Add MCU board config setup (#1006) 2022-03-03 13:31:40 +01:00
renderer MCU: Allow to use RGB565 for the draw buffer 2022-03-14 15:52:09 +01:00
simulator [reorg]: Move the rendering backends into internal 2022-01-31 16:00:50 +01:00
build.rs Add MCU board config setup (#1006) 2022-03-03 13:31:40 +01:00
Cargo.toml Janitor: bump rp-pico dependency 2022-03-14 11:50:05 +01:00
fonts.rs Adapt to the TextShaper API changes in the mcu font backend 2022-03-10 10:51:32 +01:00
lengths.rs Fix scaling of glyphs and improve type safety in the MCU backend 2022-02-17 15:07:57 +01:00
lib.rs MCU: Allow to use RGB565 for the draw buffer 2022-03-14 15:52:09 +01:00
pico_st7789.rs MCU: Allow to use RGB565 for the draw buffer 2022-03-14 15:52:09 +01:00
profiler.rs cargo fmt 2022-03-03 14:00:13 +01:00
README.md MCU cleanup 2022-03-09 20:49:46 +01:00
renderer.rs MCU partial renderer: Actually do not draw items that are not in the dirty region 2022-03-15 09:42:17 +01:00
simulator.rs MCU: Allow to use RGB565 for the draw buffer 2022-03-14 15:52:09 +01:00

NOTE: This library is an internal crate of the Slint project. This crate should not be used directly by applications using Slint. You should use the slint crate instead.

WARNING: This crate does not follow the semver convention for versioning and can only be used with version = "=x.y.z" in Cargo.toml.

Slint MCU backend

The MCU backend is still a work in progress.

We are currently working on getting demo running with the Raspberry Pi Pico and ST7789 based screen. The Raspberry Pi Pico uses a RP2040 micro-controller which has 264KB of RAM and 2MB of flash memory.

The other backend is the simulator which is a way to test the software rendering backend on desktop.

How to use

In order to use this backend, the final program must depend on both slint and i_slint_backend_mcu. The main.rs will look something like this

#![no_std]
#![cfg_attr(not(feature = "simulator"), no_main)]
slint::include_modules!();

#[i_slint_backend_mcu::entry]
fn main() -> ! {
    i_slint_backend_mcu::init();
    MainWindow::new().run();
    panic!("The event loop should not return");
}

Some environment variable must be set so the Slint compiler knows to embedd the images and font into the binary

Run the demo:

The simulator

SLINT_SCALE_FACTOR=0.5 WINIT_X11_SCALE_FACTOR=1 SLINT_EMBED_GLYPHS=1 SLINT_FONT_SIZES=8,11,10,12,13,14,15,16,18,20,22,24,32 SLINT_PROCESS_IMAGES=1 SLINT_STYLE=ugly cargo run -p printerdemo_mcu --features=i-slint-backend-mcu/simulator --release

On the Raspberry Pi Pico

SLINT_FONT_SIZES=8,11,10,12,13,14,15,16,18,20,22,24,32 CARGO_TARGET_THUMBV6M_NONE_EABI_LINKER="flip-link" CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-run --chip RP2040" SLINT_SCALE_FACTOR=0.5 SLINT_STYLE=ugly  SLINT_PROCESS_IMAGES=1 cargo +nightly run -p printerdemo_mcu --features=mcu-pico-st7789 --target=thumbv6m-none-eabi --release