Skip to content

Commit

Permalink
Update embedded-graphics requirement from 0.4.7 to 0.8.1 in /examples…
Browse files Browse the repository at this point in the history
…/twi-ssd1306 (#456)

* Update embedded-graphics requirement in /examples/twi-ssd1306

Updates the requirements on [embedded-graphics](https://github.com/embedded-graphics/embedded-graphics) to permit the latest version.
- [Release notes](https://github.com/embedded-graphics/embedded-graphics/releases)
- [Changelog](https://github.com/embedded-graphics/embedded-graphics/blob/master/CHANGELOG.md)
- [Commits](embedded-graphics/embedded-graphics@embedded-graphics-0.4.7...embedded-graphics-v0.8.1)

---
updated-dependencies:
- dependency-name: embedded-graphics
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update ssd1306 driver to match, and fix code.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Walbran <qwandor@google.com>
  • Loading branch information
dependabot[bot] and qwandor authored Apr 18, 2024
1 parent c0b714d commit 6b89b11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions examples/twi-ssd1306/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ publish = false

[dependencies]
cortex-m-rt = "0.7.0"
ssd1306 = "0.2.6"
embedded-graphics = "0.4.7"
ssd1306 = "0.8.4"
embedded-graphics = "0.8.1"
panic-semihosting = "0.6.0"

[dependencies.nrf52832-hal]
Expand Down
22 changes: 10 additions & 12 deletions examples/twi-ssd1306/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
extern crate panic_semihosting;

use cortex_m_rt::entry;

use embedded_graphics::fonts::Font6x8;
use embedded_graphics::prelude::*;
use ssd1306::prelude::*;
use ssd1306::Builder;
use embedded_graphics::{mono_font::ascii::FONT_5X8, text::Text};
use embedded_graphics::{mono_font::MonoTextStyle, pixelcolor::BinaryColor, prelude::*};
use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306};

#[cfg(feature = "52832")]
use nrf52832_hal::{
Expand Down Expand Up @@ -42,17 +40,17 @@ fn main() -> ! {

let i2c = Twim::new(p.TWIM0, pins, twim::Frequency::K100);

let mut disp: GraphicsMode<_> = Builder::new().connect_i2c(i2c).into();
let interface = I2CDisplayInterface::new(i2c);
let mut disp = Ssd1306::new(interface, DisplaySize128x64, DisplayRotation::Rotate0)
.into_buffered_graphics_mode();

disp.init().expect("Display initialization");
disp.flush().expect("Cleans the display");

disp.draw(
Font6x8::render_str("Hello Rust!")
.with_stroke(Some(1u8.into()))
.translate(Coord::new(10, 24))
.into_iter(),
);
let style = MonoTextStyle::new(&FONT_5X8, BinaryColor::On);
Text::new("Hello Rust!", Point::new(10, 24), style)
.draw(&mut disp)
.expect("Drawing text");

disp.flush().expect("Render display");

Expand Down

0 comments on commit 6b89b11

Please sign in to comment.