Skip to content

Commit a4e5834

Browse files
committed
Bump readme for e-g 0.6.0
1 parent d6f67b3 commit a4e5834

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ Load a BMP image of the Rust logo and display it in the center of the display. F
3232
#![no_std]
3333
#![no_main]
3434

35-
use cortex_m_rt::ExceptionFrame;
36-
use cortex_m_rt::{entry, exception};
37-
use embedded_graphics::{geometry::Point, image::ImageBmp, prelude::*};
35+
use cortex_m_rt::{entry, exception, ExceptionFrame};
36+
use embedded_graphics::{geometry::Point, image::Image, pixelcolor::Rgb565, prelude::*};
3837
use panic_semihosting as _;
39-
use ssd1331::{Ssd1331, DisplayRotation::Rotate0};
40-
use stm32f1xx_hal::delay::Delay;
41-
use stm32f1xx_hal::prelude::*;
42-
use stm32f1xx_hal::spi::{Mode, Phase, Polarity, Spi};
43-
use stm32f1xx_hal::stm32;
38+
use ssd1331::{DisplayRotation, Ssd1331};
39+
use stm32f1xx_hal::{
40+
delay::Delay,
41+
prelude::*,
42+
spi::{Mode, Phase, Polarity, Spi},
43+
stm32,
44+
};
45+
use tinybmp::Bmp;
4446

4547
#[entry]
4648
fn main() -> ! {
@@ -82,15 +84,17 @@ fn main() -> ! {
8284

8385
let (w, h) = disp.dimensions();
8486

85-
let im = ImageBmp::new(include_bytes!("./rust-pride.bmp")).unwrap();
87+
let bmp = Bmp::from_slice(include_bytes!("./rust-pride.bmp")).unwrap();
88+
89+
let im: Image<Bmp, Rgb565> = Image::new(&bmp, Point::zero());
8690

8791
// Position image in the center of the display
8892
let moved = im.translate(Point::new(
89-
(w as u32 - im.width()) as i32 / 2,
90-
(h as u32 - im.height()) as i32 / 2,
93+
(w as u32 - bmp.width()) as i32 / 2,
94+
(h as u32 - bmp.height()) as i32 / 2,
9195
));
9296

93-
disp.draw(moved.into_iter());
97+
moved.draw(&mut disp).unwrap();
9498

9599
disp.flush().unwrap();
96100

@@ -143,9 +147,9 @@ disp.rotation();
143147

144148
Licensed under either of
145149

146-
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
147-
http://www.apache.org/licenses/LICENSE-2.0)
148-
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
150+
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
151+
http://www.apache.org/licenses/LICENSE-2.0)
152+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
149153

150154
at your option.
151155

0 commit comments

Comments
 (0)