caemor / epd-waveshare

Drivers for various EPDs from Waveshare
ISC License
207 stars 128 forks source link

Add example 7in5 v2 program #192

Open blamster19 opened 4 months ago

blamster19 commented 4 months ago

The program tests rotations and draws analog clock (based on example code for different models from the repository), tests default fonts of embedded-graphics crate and displays an image of Ferris from examples/assets/ directory.

I thought it would be nice to show how to display an image file, because I myself spent too much time fiddling with wrong types (I found solution to this problem in #130).

The program has been tested on hardware and works as expected.

CRT-HAO commented 4 months ago

Tested on Raspberry Pi 4b with hardware and confirmed to work.

My environment:

hao@raspberrypi:~ $ neofetch
       _,met$$$$$gg.          hao@raspberrypi
    ,g$$$$$$$$$$$$$$$P.       ---------------
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 12 (bookworm) aarch64
 ,$$P'              `$$$.     Host: Raspberry Pi 4 Model B Rev 1.4
',$$P       ,ggs.     `$$b:   Kernel: 6.1.0-rpi7-rpi-v8
`d$$'     ,$P"'   .    $$$    Uptime: 35 mins
 $$P      d$'     ,    $$P    Packages: 1537 (dpkg)
 $$:      $$.   -    ,d$$'    Shell: bash 5.2.15
 $$;      Y$b._   _,d$P'      Terminal: /dev/pts/0
 Y$$.    `.`"Y$$$$P"'         CPU: (4) @ 1.800GHz
 `$$b      "-.__              Memory: 975MiB / 3793MiB
  `Y$$
   `Y$$.
     `$$b.
       `Y$$b.
          `"Y$b._
              `"""

hao@raspberrypi:~ $ rustup show
Default host: aarch64-unknown-linux-gnu
rustup home:  /home/hao/.rustup

stable-aarch64-unknown-linux-gnu (default)
rustc 1.76.0 (07dca489a 2024-02-04)
hao@raspberrypi:~ $ cat ~/Playground/epd-test/Cargo.toml
[package]
name = "epd-test"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
epd-waveshare = { git = "https://github.com/caemor/epd-waveshare.git", rev = "a083583", features = [
  "graphics",
] }
embedded-graphics = "0.8"
embedded-hal = "1.0.0"
linux-embedded-hal = "0.4.0"
embedded-graphics-core = "0.4