Closed work-in-progress-danny closed 1 year ago
Can you try the github master version of the crate? You are using the new embedded-graphics which isn't yet supported by the released version of this crate.
Same code*
[dependencies]
panic-halt = "0.2.0"
ufmt = "0.1.0"
nb = "0.1.2"
embedded-hal = "0.2.3"
ssd1306 = { git = "https://github.com/jamwaffles/ssd1306.git", branch = "master" }
embedded-graphics = "0.8.0"
error[E0271]: type mismatch resolving `<Ssd1306<I2CInterface<avr_hal_generic::i2c::I2c<Atmega, arduino_hal::pac::TWI, avr_hal_generic::port::Pin<Input, PC4>, avr_hal_generic::port::Pin<Input, PC5>, MHz16>>, ssd1306::prelude::DisplaySize128x64, BufferedGraphicsMode<ssd1306::prelude::DisplaySize128x64>> as DrawTarget>::Color == Rgb565`
--> src/main.rs:35:10
|
35 | .draw(&mut display)
| ^^^^ expected struct `Rgb565`, found enum `BinaryColor`
|
note: required by a bound in `embedded_graphics::Drawable::draw`
--> /Users/danny/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-graphics-core-0.4.0/src/drawable.rs:106:23
|
106 | D: DrawTarget<Color = Self::Color>;
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `embedded_graphics::Drawable::draw`
You can't use Rgb565
with this display, you can only use BinaryColor
which has an On
and an Off
option.
Thanks @bugadani it was the embedded_graphics::pixelcolor::Rgb565
, instead using embedded_graphics::pixelcolor::binarycolor
fixed it 🚀
ssd1306
in use: 0.7.1Description of the problem
I'm trying to print "Hello Rust!" on my oled in buffered graphics mode, so I can eventually switch individual characters out and around. But I'm getting an error I don't fully understand and I'm not sure exactly why this is happening. I don't know whether it's an avr-hal problem, a ssd1306 or an embedded graphics issue or it's just me trying to fit a round peg in a square hole. Any help on this would be appreciated
Test case
Code
Error