This repo contains bindings for libinkview, which is used by pocketbook devices.
-
inkviewis the core of the project. It dynamically loadslibinkviewrather than linking it statically, so that users of this crate don't have to setup the pocketbook SDK. Instead, one needs to cross-compile toarmv7-unknown-linux-gnueabi.2.23(cargo zigbuildworks well for this) and the binary will run on a pocketbook E-Reader. -
inkview-egis an embedded-graphics-core driver forinkview-rs. -
inkview-slintprovides a backend for the slint crate that works withinkview, with a respective demo project underexamples/inkview-slint-demo.
The subprojects may contain examples that lay under examples/ subfolders (e.g. inkview/examples)
- Zig must be installed.
- just command runner must be installed.
The build and deployment helper commands are defined in the justfile.
Available recipes can be listed with:
just --list
- Set-up a reproducible build environment for the target
armv7-unknown-linux-gnueabi.2.23(two ways):- (EITHER - recommended) one must install NIX +
direnv +
devenv.
- This way Nix installs a sandbox environment with the exact cross-compilation tools required for the e-reader, while direnv automatically injects them into your shell the moment you enter the project directory.
- (EITHER) Execute
just prerequisitesto install thearmv7-unknown-linux-gnueabirustc target andcargo-zigbuildglobally- NOTE: this way has proved to be problematic in use on macOS when building
inkview-slintproject
- NOTE: this way has proved to be problematic in use on macOS when building
- (EITHER - recommended) one must install NIX +
direnv +
devenv.
To build a binary crate located in this repo, run:
just pb_sdk_version=<sdk-version> build-app <name>For example:
just pb_sdk_version=6.8 build-app inkview-slintNOTE: while the demo projects lay in the ./examples/ folder they are still apps,
and therefore should be built with the build-app command
To build an example, run:
just pb_sdk_version=<sdk-version> build-example <crate> <name>For example:
just pb_sdk_version=6.8 build-example inkview hello_worldBy default, any build is going to be done with the debug profile.
Changing the profile to release, one should add the cargo_profile=release argument.
For example:
just pb_sdk_version=6.8 cargo_profile=release build-app inkview-slint-demoTo deploy a built binary to the device over USB, run the following,
assuming the device is connected and appears in path /run/media/$USER/<pb-device>:
The path argument is the relative path from target/armv7-unknown-linux-gnueabi/<cargo-profile>,
so for example: examples/hello_world
just pb_device=<your-device> deploy-usb <path-to-binary> <target-name>For example:
just cargo_profile=release pb_device=PB632 deploy-usb inkview-slint-demo application.appFor more information take a look at utils README.md
See documentation for the generate-bindings just recipe.
Setting up new projects that make use of inkview-rs with properly configured linking, building, and deployment from scratch can be quite tedious.
Often, it would require pretty much the same preconfiguration: devenv.nix config, justfile with the basic build and deploy helper comands, etc.
To simplify this repeated process, one can make use of the adjacent templating project inkview-rs-templates.
It only requires cargo-generate to be installed, and allows you to create preconfigured basic projects for vanilla inkview-rs, inkview-eg, and inkview-slint.