mirror of
https://github.com/Feliix42/ssd1675.git
synced 2024-11-21 18:36:30 +00:00
Update example after bump of dependencies
The recent bump of linux-embedded-hal and embedded-graphics broke the example. This change fixes the compile time errors. Tested on a Raspberry Pi Zero W with inky phat display.
This commit is contained in:
parent
f46fcbd677
commit
bf7cb30c38
1 changed files with 12 additions and 12 deletions
|
@ -1,5 +1,5 @@
|
||||||
extern crate linux_embedded_hal;
|
extern crate linux_embedded_hal;
|
||||||
use linux_embedded_hal::spidev::{self, SpidevOptions};
|
use linux_embedded_hal::spidev::{SpiModeFlags, SpidevOptions};
|
||||||
use linux_embedded_hal::sysfs_gpio::Direction;
|
use linux_embedded_hal::sysfs_gpio::Direction;
|
||||||
use linux_embedded_hal::Delay;
|
use linux_embedded_hal::Delay;
|
||||||
use linux_embedded_hal::{Pin, Spidev};
|
use linux_embedded_hal::{Pin, Spidev};
|
||||||
|
@ -56,7 +56,7 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
let options = SpidevOptions::new()
|
let options = SpidevOptions::new()
|
||||||
.bits_per_word(8)
|
.bits_per_word(8)
|
||||||
.max_speed_hz(4_000_000)
|
.max_speed_hz(4_000_000)
|
||||||
.mode(spidev::SPI_MODE_0)
|
.mode(SpiModeFlags::SPI_MODE_0)
|
||||||
.build();
|
.build();
|
||||||
spi.configure(&options).expect("SPI configuration");
|
spi.configure(&options).expect("SPI configuration");
|
||||||
|
|
||||||
|
@ -119,8 +119,8 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
|
|
||||||
display.draw(
|
display.draw(
|
||||||
ProFont24Point::render_str("Raspberry Pi")
|
ProFont24Point::render_str("Raspberry Pi")
|
||||||
.with_stroke(Some(Color::Red))
|
.stroke(Some(Color::Red))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(1, -4))
|
.translate(Coord::new(1, -4))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
@ -128,15 +128,15 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
if let Ok(cpu_temp) = read_cpu_temp() {
|
if let Ok(cpu_temp) = read_cpu_temp() {
|
||||||
display.draw(
|
display.draw(
|
||||||
ProFont14Point::render_str("CPU Temp:")
|
ProFont14Point::render_str("CPU Temp:")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(1, 30))
|
.translate(Coord::new(1, 30))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
display.draw(
|
display.draw(
|
||||||
ProFont12Point::render_str(&format!("{:.1}°C", cpu_temp))
|
ProFont12Point::render_str(&format!("{:.1}°C", cpu_temp))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(95, 34))
|
.translate(Coord::new(95, 34))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
@ -145,8 +145,8 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
if let Some(uptime) = read_uptime() {
|
if let Some(uptime) = read_uptime() {
|
||||||
display.draw(
|
display.draw(
|
||||||
ProFont9Point::render_str(uptime.trim())
|
ProFont9Point::render_str(uptime.trim())
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(1, 93))
|
.translate(Coord::new(1, 93))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
@ -155,8 +155,8 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
if let Some(uname) = read_uname() {
|
if let Some(uname) = read_uname() {
|
||||||
display.draw(
|
display.draw(
|
||||||
ProFont9Point::render_str(uname.trim())
|
ProFont9Point::render_str(uname.trim())
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(1, 84))
|
.translate(Coord::new(1, 84))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue