update display driver
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -1741,6 +1741,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "st7365p-lcd"
|
name = "st7365p-lcd"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
|
source = "git+https://github.com/legitcamper/st7365p-lcd-rs?branch=async#f826038c0c8e4150be8581d30a8c6fe480947f66"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embedded-graphics-core",
|
"embedded-graphics-core",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ defmt-rtt = "0.4.2"
|
|||||||
|
|
||||||
embedded-graphics = { version = "0.8.1" }
|
embedded-graphics = { version = "0.8.1" }
|
||||||
embedded-sdmmc = { git = "https://github.com/Be-ing/embedded-sdmmc-rs", branch = "bisync", default-features = false }
|
embedded-sdmmc = { git = "https://github.com/Be-ing/embedded-sdmmc-rs", branch = "bisync", default-features = false }
|
||||||
# st7365p-lcd = { git = "https://github.com/legitcamper/st7365p-lcd-rs" }
|
st7365p-lcd = { git = "https://github.com/legitcamper/st7365p-lcd-rs", branch = "async" }
|
||||||
st7365p-lcd = { path = "../ST7365P-lcd-rs" }
|
|
||||||
|
|
||||||
static_cell = "2.1.1"
|
static_cell = "2.1.1"
|
||||||
bitflags = "2.9.1"
|
bitflags = "2.9.1"
|
||||||
|
|||||||
@@ -20,42 +20,25 @@ use st7365p_lcd::{FrameBuffer, ST7365P};
|
|||||||
|
|
||||||
type SPI = Spi<'static, SPI1, Async>;
|
type SPI = Spi<'static, SPI1, Async>;
|
||||||
|
|
||||||
type FRAMEBUFFER = FrameBuffer<
|
type FRAMEBUFFER = FrameBuffer<SCREEN_WIDTH, SCREEN_HEIGHT>;
|
||||||
SCREEN_WIDTH,
|
|
||||||
SCREEN_HEIGHT,
|
|
||||||
ExclusiveDevice<Spi<'static, SPI1, Async>, Output<'static>, Delay>,
|
|
||||||
Output<'static>,
|
|
||||||
Output<'static>,
|
|
||||||
>;
|
|
||||||
|
|
||||||
const SCREEN_WIDTH: usize = 320;
|
const SCREEN_WIDTH: usize = 320;
|
||||||
const SCREEN_HEIGHT: usize = 320;
|
const SCREEN_HEIGHT: usize = 320;
|
||||||
const SCREEN_ROWS: usize = 15;
|
|
||||||
const SCREEN_COLS: usize = 31;
|
|
||||||
const FONT: MonoFont = FONT_10X20;
|
|
||||||
const COLOR: Rgb565 = Rgb565::CSS_LAWN_GREEN;
|
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
pub async fn display_task(spi: SPI, cs: PIN_13, data: PIN_14, reset: PIN_15) {
|
pub async fn display_task(spi: SPI, cs: PIN_13, data: PIN_14, reset: PIN_15) {
|
||||||
let spi_device = ExclusiveDevice::new(spi, Output::new(cs, Level::Low), Delay).unwrap();
|
let spi_device = ExclusiveDevice::new(spi, Output::new(cs, Level::Low), Delay).unwrap();
|
||||||
let display = ST7365P::new(
|
let mut display = ST7365P::new(
|
||||||
spi_device,
|
spi_device,
|
||||||
Output::new(data, Level::Low),
|
Output::new(data, Level::Low),
|
||||||
Some(Output::new(reset, Level::High)),
|
Some(Output::new(reset, Level::High)),
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
SCREEN_WIDTH as u32,
|
|
||||||
SCREEN_HEIGHT as u32,
|
|
||||||
);
|
);
|
||||||
let mut framebuffer: FRAMEBUFFER = FrameBuffer::new(display);
|
display.init(&mut Delay).await.unwrap();
|
||||||
|
display.set_custom_orientation(0x60).await.unwrap();
|
||||||
|
|
||||||
framebuffer.init(&mut Delay).await.unwrap();
|
let mut framebuffer: FRAMEBUFFER = FrameBuffer::new();
|
||||||
framebuffer.display.set_offset(0, 0);
|
|
||||||
framebuffer
|
|
||||||
.display
|
|
||||||
.set_custom_orientation(0x60)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
Text::with_alignment(
|
Text::with_alignment(
|
||||||
"Hello!",
|
"Hello!",
|
||||||
@@ -67,7 +50,7 @@ pub async fn display_task(spi: SPI, cs: PIN_13, data: PIN_14, reset: PIN_15) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
framebuffer.draw().await.unwrap();
|
framebuffer.draw(&mut display).await.unwrap();
|
||||||
Timer::after_millis(500).await;
|
Timer::after_millis(500).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user