Skip to content

simmsb/inkview-rs

Repository files navigation

Inkview-rs

Rust bindings for pocketbook E-Reader devices (inkview)

Crates.io Version docs.rs Discord

This repo contains bindings for libinkview, which is used by pocketbook devices.

Overview

  • inkview is the core of the project. It dynamically loads libinkview rather than linking it statically, so that users of this crate don't have to setup the pocketbook SDK. Instead, one needs to cross-compile to armv7-unknown-linux-gnueabi.2.23 (cargo zigbuild works well for this) and the binary will run on a pocketbook E-Reader.

  • inkview-eg is an embedded-graphics-core driver for inkview-rs.

  • inkview-slint provides a backend for the slint crate that works with inkview, with a respective demo project under examples/inkview-slint-demo.

The subprojects may contain examples that lay under examples/ subfolders (e.g. inkview/examples)

Prerequisites (Set-up)

  1. Zig must be installed.
  2. 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
  3. Set-up a reproducible build environment for the target armv7-unknown-linux-gnueabi.2.23 (two ways):
    1. (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.
    2. (EITHER) Execute just prerequisites to install the armv7-unknown-linux-gnueabi rustc target and cargo-zigbuild globally
      • NOTE: this way has proved to be problematic in use on macOS when building inkview-slint project

Build

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-slint

NOTE: 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_world

By 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-demo

Deployment

To 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.app

For more information take a look at utils README.md

Bindings generation

See documentation for the generate-bindings just recipe.

New inkview-rs projects templating

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.

About

Rust bindings and a Slint backend for libinkview

Topics

Resources

License

Stars

14 stars

Watchers

4 watching

Forks

Packages

 
 
 

Contributors

Languages