1#[macro_export]
2macro_rules! shared_lcd_spi {
3 ($peripherals:ident, $dma_channel:expr, $sck:expr, $mosi:expr, $cs:expr) => {
4 Spi::new_with_config(
5 $peripherals.SPI2,
6 esp_hal::spi::master::Config {
7 frequency: 40u32.MHz(),
8 ..esp_hal::spi::master::Config::default()
9 },
10 )
11 .with_sck($sck)
12 .with_mosi($mosi)
13 .with_cs($cs)
14 .with_dma($dma_channel.configure(false, DmaPriority::Priority0))
15 };
16}
17
18#[macro_export]
19macro_rules! shared_lcd_display_interface {
20 ($peripherals:ident, $memory_size:expr, $spi:expr, $dc_pin:expr) => {{
21 let lcd_dc = Output::new($dc_pin, Level::Low);
22 display_interface_spi_dma::new_no_cs($memory_size, $spi, lcd_dc)
23 }};
24}
25
26#[macro_export]
27macro_rules! shared_lcd_display {
28 ($di:expr, $display_model:expr, $width:expr, $height:expr, $orientation:expr, $color_order:expr, $reset_pin:expr) => {{
29 mipidsi::Builder::new($display_model, $di)
30 .display_size($width, $height)
31 .orientation($orientation)
32 .color_order($color_order)
33 .reset_pin($reset_pin)
34 }};
35}
36
37pub use {
38 shared_lcd_spi, shared_lcd_display_interface, shared_lcd_display
39};