gui
This commit is contained in:
parent
c1b1f2106a
commit
227147e411
3060
Cargo.lock
generated
3060
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -3,9 +3,14 @@ name = "pi-frame-server"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
gui = [ "dep:eframe" ]
|
||||
eink = [ "dep:epd-waveshare", "dep:linux-embedded-hal" ]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.86"
|
||||
clap = { version = "4.5.7", features = ["derive"] }
|
||||
eframe = "0.28.0"
|
||||
epd-waveshare = { git = "https://github.com/caemor/epd-waveshare.git" }
|
||||
image = "0.25.1"
|
||||
linux-embedded-hal = { version = "0.4.0" }
|
||||
|
|
4
build.sh
4
build.sh
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
set +x
|
||||
cross build --target aarch64-unknown-linux-gnu
|
||||
rsync -aczP target/aarch64-unknown-linux-gnu/debug/pi-frame-server 192.168.0.186:
|
||||
cross build --target aarch64-unknown-linux-gnu --release
|
||||
rsync -aczP target/aarch64-unknown-linux-gnu/release/pi-frame-server 192.168.0.186:
|
||||
# scp target/aarch64-unknown-linux-gnu/debug/pi-frame-server 192.168.0.186:
|
||||
ssh 192.168.0.186 ./pi-frame-server load
|
||||
|
|
|
@ -1,43 +1,11 @@
|
|||
use epd_waveshare::{epd7in3f::Epd7in3f, prelude::WaveshareDisplay};
|
||||
use linux_embedded_hal::spidev::SpiModeFlags;
|
||||
use linux_embedded_hal::spidev::SpidevOptions;
|
||||
use linux_embedded_hal::{CdevPin, Delay, SpidevBus, SpidevDevice};
|
||||
use linux_embedded_hal::{CdevPin, Delay, SpidevDevice};
|
||||
|
||||
use linux_embedded_hal::gpio_cdev::{Chip, LineRequestFlags};
|
||||
use anyhow::Result;
|
||||
|
||||
pub fn demo() -> Result<()> {
|
||||
let mut spi = SpidevDevice::open("/dev/spidev0.0")?;
|
||||
let spi_options = SpidevOptions::new()
|
||||
.bits_per_word(8)
|
||||
.max_speed_hz(10_000_000)
|
||||
.mode(SpiModeFlags::SPI_MODE_0)
|
||||
.build();
|
||||
spi.configure(&spi_options)?;
|
||||
let mut gpiochip = Chip::new("/dev/gpiochip0")?;
|
||||
let busy_pin = CdevPin::new(gpiochip.get_line(24)?.request(
|
||||
LineRequestFlags::INPUT,
|
||||
0,
|
||||
"frametool",
|
||||
)?)?;
|
||||
let dc_pin = CdevPin::new(gpiochip.get_line(25)?.request(
|
||||
LineRequestFlags::OUTPUT,
|
||||
0,
|
||||
"frametool",
|
||||
)?)?;
|
||||
let rst_pin = CdevPin::new(gpiochip.get_line(17)?.request(
|
||||
LineRequestFlags::OUTPUT,
|
||||
0,
|
||||
"frametool",
|
||||
)?)?;
|
||||
let mut delay = Delay {};
|
||||
|
||||
let mut panel = Epd7in3f::new(&mut spi, busy_pin, dc_pin, rst_pin, &mut delay, None)?;
|
||||
panel.show_7block(&mut spi, &mut delay)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
pub struct DisplayWrapper {
|
||||
spi: SpidevDevice,
|
||||
gpiochip: Chip,
|
||||
|
@ -86,3 +54,4 @@ impl DisplayWrapper {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue