![]()
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / files-changed (push) Waiting to run
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, 1.85) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
Add License Header and Copyright notice |
||
---|---|---|
.. | ||
boards | ||
src | ||
.gitignore | ||
CMakeLists.txt | ||
prj.conf | ||
README.md | ||
README_NXP.md | ||
VERSION | ||
west.yaml |
Printer Demo with Zephyr
Known Issues
- Unlike the Espressif integration, we don't provide the platform integration as part of the Slint C++ API. In part, this is due to the way Zephyr OS handles device hardware. Zephyr uses the Device Tree to describe the hardware to the device driver model. In order to register an input event call back we need a pointer to a device obtained from a device tree node, and we also need to know how the driver behaves in order to write our callback function. The existing implementation is generic enough to cover the simulator and display shield drivers. A more general solution could be investigated in the future;
- Double buffering is not supported as neither the simulator or the hardware used for testing reported it as supported;
Prerequisites
Before you can run this example, make sure you have done the following:
-
Install Rust, with the nightly channel enabled:
# Install via rustup # See https://www.rust-lang.org/tools/install # Enable the nightly channel rustup toolchain install nightly rustup default nightly
-
Install the Zephyr dependencies;
-
Install West into a virtual environment:
# If Slint source is already checked out: python3 -m venv ../.venv source ../.venv/bin/activate # If you do not have Slint source yet: mkdir slint-zephyr python3 -m venv slint-zephyr/.venv source slint-zephyr/.venv/bin/activate # Install west pip install west
-
Get the Zephyr source code:
# If Slint source is already checked out (this adds the Zephyr source next to the Slint source): cd .. west init -l --mf demos/printerdemo/zephyr/west.yaml ./slint # If you do not have Slint source yet (this checks out Slint and Zephyr source into slint-zephyr): west init -m https://github.com/slint-ui/slint --mr zephyr --mf demos/printerdemo/zephyr/west.yaml slint-zephyr cd slint-zephyr # Checkout the repositories: west update
-
Export a Zephyr CMake package. This allows CMake to automatically load boilerplate code required for building Zephyr applications.
west zephyr-export
-
Zephyr’s scripts/requirements.txt file declares additional Python dependencies. Install them with pip.
pip install -r ~/zephyrproject/zephyr/scripts/requirements.txt
-
Install the Zephyr SDK using version v0.16.8.
Build and Run the Example in the Simulator
Once you have the prerequisites, navigate to this directory and execute the following commands:
# Build
west build -b native_sim/native/64 -p always slint/demos/printerdemo/zephyr
# Run
./build/zephyr/zephyr.exe
The -p always
option of the build command forces a pristine build. The Zephyr documentation recommends this for new users.
Build and Run the Example on a Device
This sample has been tested on the NXP MIMXRT1170-EVKB with a RK055HDMIPI4MA0 MIPI display. The board/debug probe may require configuring as described here.
# Build
west build -b mimxrt1170_evk@B/mimxrt1176/cm7 -p always slint/demos/printerdemo/zephyr -- -DSHIELD=rk055hdmipi4ma0 -DCMAKE_BUILD_TYPE=Release
# Flash
west flash