Giter Site home page Giter Site logo

waveshare-rpi's Introduction

waveshare-rpi

This module is currently under heavy development and is written for code porting practice. You should be using epd-waveshare instead, which supports more embedded host devices and Waveshare displays.

waveshare-rpi is a (unpublished) crate for Raspberry Pis to use Waveshare e-paper displays. Currently, it only supports the following displays, though more displays can be easily added.

  • 2.9inch flexible display
  • 5.83inch V2 display
  • 7.5inch E-Paper V2 display
  • More to come? Open an issue on GitHub to request for it!

Installation (cutting-edge)

To use this crate with your project:

cargo add --git https://github.com/Polygonalr/waveshare-rpi.git

Example library usage

use waveshare_rpi::{epd_configs::epd7in5_v2::EPD_CONFIG, Epd};
use waveshare_rpi::converter::{ColorMode, image_to_epd};

// Initialize the interface to interact with the epd7in5_v2 display
let mut my_epd = Epd::new(EPD_CONFIG);

// Initialize the options to be used for converting an image to the epd format
let image_options = EpdImageOptions {
    epd_width: EPD_CONFIG.width,
    epd_height: EPD_CONFIG.height,
    ..Default::default()
};

// Resizes and converts image.png into the format compatible with the epd7in5_v2 display
let img_data = image_to_epd("image.png", image_options).unwrap();

// Transfer the image data to the display for displaying
my_epd.display(&img_data).unwrap();

Compilation for testing

For testing purposes, this project has a main.rs file which can be modified and compiled for testing on a Raspberry Pi.

Cross-compiling from Ubuntu 22.04

Directly compiling for Raspberry Pi OS bullseye (which is the latest version of Raspberry Pi OS as of writing this) is currently not supported due to the version of the libc linker on the Ubuntu machine being too new - bullseye by default does not have the newer libc versions. Therefore, it is a requirement to compile for the target aarch64-unknown-linux-musl to use static linking. However, using gcc may still give some problems, so clang is used instead.

  • Install the required tools with the following commands.
sudo apt-get install musl-tools clang llvm libncurses5 -y
rustup target add aarch64-unknown-linux-musl
  • Compile the project with the following command.
cargo build --release --target aarch64-unknown-linux-musl

The compiled program can be found at target/aarch64-unknown-linux-musl/release and can be transferred over to a Raspberry Pi to be executed.

Usage of the program:

./waveshare-rpi --help
Program to update a Waveshare 7.5" e-ink display

Usage: waveshare-rpi [OPTIONS]

Options:
  -i, --image <IMAGE>  Path of the image to display
  -t, --text <TEXT>    Text to display
  -c, --clear          Clear the display
  -h, --help           Print help
  -V, --version        Print version

waveshare-rpi's People

Contributors

polygonalr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.