@@ -11,6 +11,10 @@ compile_error!("The `ip101` feature can only be built for the `xtensa-esp32-espi
1111#[ cfg( all( feature = "kaluga" , not( esp32s2) ) ) ]
1212compile_error ! ( "The `kaluga` feature can only be built for the `xtensa-esp32s2-espidf` target." ) ;
1313
14+ #[ cfg( all( feature = "aztouchmod" , not( esp32) ) ) ]
15+ compile_error ! ( "The `aztouchmod` feature can only be built for the `xtensa-esp32-espidf` target." ) ;
16+
17+
1418#[ cfg( all( feature = "ttgo" , not( esp32) ) ) ]
1519compile_error ! ( "The `ttgo` feature can only be built for the `xtensa-esp32-espidf` target." ) ;
1620
@@ -88,7 +92,7 @@ use embedded_graphics::prelude::*;
8892use embedded_graphics:: primitives:: * ;
8993use embedded_graphics:: text:: * ;
9094
91- use ili9341;
95+ use ili9341:: { DisplaySize240x320 , Ili9341 , Orientation } ;
9296use ssd1306;
9397use ssd1306:: mode:: DisplayConfig ;
9498use st7789;
@@ -166,6 +170,17 @@ fn main() -> Result<()> {
166170 pins. gpio26 ,
167171 ) ?;
168172
173+ #[ cfg( feature = "aztouchmod" ) ]
174+ aztouchmod_hello_world (
175+ pins. gpio15 ,
176+ pins. gpio4 ,
177+ pins. gpio22 ,
178+ peripherals. spi3 ,
179+ pins. gpio18 ,
180+ pins. gpio23 ,
181+ pins. gpio5 ,
182+ ) ?;
183+
169184 #[ cfg( feature = "kaluga" ) ]
170185 kaluga_hello_world (
171186 pins. gpio6 ,
@@ -873,6 +888,54 @@ fn kaluga_hello_world(
873888 }
874889}
875890
891+ #[ cfg( feature = "aztouchmod" ) ]
892+ fn aztouchmod_hello_world (
893+ backlight : gpio:: Gpio15 < gpio:: Unknown > ,
894+ dc : gpio:: Gpio4 < gpio:: Unknown > ,
895+ rst : gpio:: Gpio22 < gpio:: Unknown > ,
896+ spi : spi:: SPI3 ,
897+ sclk : gpio:: Gpio18 < gpio:: Unknown > ,
898+ sdo : gpio:: Gpio23 < gpio:: Unknown > ,
899+ cs : gpio:: Gpio5 < gpio:: Unknown > ,
900+ ) -> Result < ( ) > {
901+ info ! (
902+ "About to initialize the AZTouchMod ILI9341 SPI LED driver" ,
903+ ) ;
904+
905+ let config = <spi:: config:: Config as Default >:: default ( )
906+ . baudrate ( 40 . MHz ( ) . into ( ) ) ;
907+
908+ let mut backlight = backlight. into_output ( ) ?;
909+ backlight. set_low ( ) ?;
910+
911+ let di = SPIInterfaceNoCS :: new (
912+ spi:: Master :: < spi:: SPI3 , _ , _ , _ , _ > :: new (
913+ spi,
914+ spi:: Pins {
915+ sclk,
916+ sdo,
917+ sdi : Option :: < gpio:: Gpio19 < gpio:: Unknown > > :: None ,
918+ cs : Some ( cs) ,
919+ } ,
920+ config,
921+ ) ?,
922+ dc. into_output ( ) ?,
923+ ) ;
924+
925+ let reset = rst. into_output ( ) ?;
926+
927+ let mut display = ili9341:: Ili9341 :: new (
928+ di,
929+ reset,
930+ & mut delay:: Ets ,
931+ Orientation :: LandscapeFlipped ,
932+ ili9341:: DisplaySize240x320 ,
933+ )
934+ . map_err ( |e| anyhow:: anyhow!( "Display error: {:?}" , e) ) ?;
935+
936+ led_draw ( & mut display) . map_err ( |e| anyhow:: anyhow!( "Display error: {:?}" , e) )
937+ }
938+
876939#[ cfg( feature = "heltec" ) ]
877940fn heltec_hello_world (
878941 rst : gpio:: Gpio16 < gpio:: Unknown > ,
0 commit comments