switch to rp2350

This commit is contained in:
2025-06-24 19:02:30 -06:00
parent 3392dec944
commit f8325a7750
9 changed files with 207 additions and 1213 deletions

47
src/display.rs Normal file
View File

@@ -0,0 +1,47 @@
use embassy_rp::{
gpio::{Level, Output},
peripherals::{PIN_13, PIN_14, PIN_15, SPI1},
spi::{Blocking, Spi},
};
use embassy_time::Delay;
use embedded_graphics::{
Drawable,
pixelcolor::{BinaryColor, Rgb555, Rgb565},
prelude::{Point, Primitive, RgbColor},
primitives::{PrimitiveStyle, Triangle},
};
use embedded_hal_bus::spi::ExclusiveDevice;
use st7365p_lcd::ST7365P;
#[embassy_executor::task]
pub async fn display_task(
spi: Spi<'static, SPI1, Blocking>,
cs: PIN_13,
data: PIN_14,
reset: PIN_15,
) {
let spi_device = ExclusiveDevice::new(spi, Output::new(cs, Level::Low), Delay).unwrap();
let mut display = ST7365P::new(
spi_device,
Output::new(data, Level::Low),
Some(Output::new(reset, Level::High)),
true,
false,
320,
320,
);
let thin_stroke = PrimitiveStyle::with_stroke(Rgb565::RED, 1);
let yoffset = 10;
// Draw a triangle.
Triangle::new(
Point::new(16, 16 + yoffset),
Point::new(16 + 16, 16 + yoffset),
Point::new(16 + 8, yoffset),
)
.into_styled(thin_stroke)
.draw(&mut display)
.unwrap();
}