implement basic embassy framework
This commit is contained in:
@@ -6,15 +6,15 @@ use embedded_hal_bus::spi::ExclusiveDevice;
|
||||
use esp_hal::delay::Delay;
|
||||
use esp_hal::gpio::{Level, Output, OutputConfig};
|
||||
use esp_hal::peripherals::{GPIO10, GPIO11, GPIO12, GPIO35, GPIO36, GPIO37, SPI2};
|
||||
use esp_hal::spi::{master::{Config, Spi}, Mode};
|
||||
use esp_hal::spi::{
|
||||
Mode,
|
||||
master::{Config, Spi},
|
||||
};
|
||||
use esp_hal::time::Rate;
|
||||
use ili9341::{DisplaySize240x320, Ili9341, Orientation};
|
||||
|
||||
pub type PrimaryLcdDisplay<'a> = Ili9341<
|
||||
SPIInterface<
|
||||
ExclusiveDevice<Spi<'a, esp_hal::Blocking>, Output<'a>, Delay>,
|
||||
Output<'a>,
|
||||
>,
|
||||
SPIInterface<ExclusiveDevice<Spi<'a, esp_hal::Blocking>, Output<'a>, Delay>, Output<'a>>,
|
||||
Output<'a>,
|
||||
>;
|
||||
|
||||
@@ -26,7 +26,6 @@ pub fn init_primary_lcd(
|
||||
cs: GPIO11<'static>,
|
||||
reset: GPIO10<'static>,
|
||||
dc: GPIO12<'static>,
|
||||
delay: &mut Delay,
|
||||
) -> PrimaryLcdDisplay<'static> {
|
||||
let freq = Rate::from_khz(60_000);
|
||||
log::info!("Display freq: {freq}");
|
||||
@@ -40,8 +39,10 @@ pub fn init_primary_lcd(
|
||||
.with_mosi(mosi)
|
||||
.with_miso(miso);
|
||||
|
||||
let mut delay = Delay::new();
|
||||
|
||||
let cs_main = Output::new(cs, Level::High, OutputConfig::default());
|
||||
let spi_dev = ExclusiveDevice::new(spi_bus, cs_main, *delay).unwrap();
|
||||
let spi_dev = ExclusiveDevice::new(spi_bus, cs_main, delay).unwrap();
|
||||
let reset_main = Output::new(reset, Level::High, OutputConfig::default());
|
||||
let spi_dc = Output::new(dc, Level::High, OutputConfig::default());
|
||||
let iface = SPIInterface::new(spi_dev, spi_dc);
|
||||
@@ -49,7 +50,7 @@ pub fn init_primary_lcd(
|
||||
let mut display = Ili9341::new(
|
||||
iface,
|
||||
reset_main,
|
||||
delay,
|
||||
&mut delay,
|
||||
Orientation::Portrait,
|
||||
DisplaySize240x320,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user