File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ extern crate stm32f1xx_hal as hal;
33
33
use cortex_m_rt:: ExceptionFrame ;
34
34
use cortex_m_rt:: { entry, exception} ;
35
35
use embedded_graphics:: image:: Image1BPP ;
36
+ use embedded_graphics:: pixelcolor:: PixelColorU16 ;
36
37
use embedded_graphics:: prelude:: * ;
37
38
use hal:: delay:: Delay ;
38
39
use hal:: prelude:: * ;
@@ -95,10 +96,14 @@ fn main() -> ! {
95
96
96
97
let ( w, h) = disp. get_dimensions ( ) ;
97
98
98
- let im = Image1BPP :: new ( include_bytes ! ( "./rust.raw" ) , 64 , 64 )
99
- . translate ( Coord :: new ( w as i32 / 2 - 64 / 2 , h as i32 / 2 - 64 / 2 ) ) ;
99
+ let im = Image1BPP :: new ( include_bytes ! ( "./rust.raw" ) , 64 , 64 ) ;
100
+ // .translate(Coord::new(w as i32 / 2 - 64 / 2, h as i32 / 2 - 64 / 2));
100
101
101
- disp. draw ( im. into_iter ( ) ) ;
102
+ // Map 0x00 or 0x01 to 0x0000 or 0xffff to draw a white Rust logo from a 1BPP image
103
+ disp. draw (
104
+ im. into_iter ( )
105
+ . map ( |p : Pixel < u8 > | Pixel :: < PixelColorU16 > ( p. 0 , ( p. 1 as u16 * 0xffff ) . into ( ) ) ) ,
106
+ ) ;
102
107
103
108
disp. flush ( ) . unwrap ( ) ;
104
109
You can’t perform that action at this time.
0 commit comments