Comments (4)
Could you please try with embedded-hal-bus = "0.1.0"
instead of trying to use the dependency from github?
from ssd1306.
Changing Cargo.toml so I have
embedded-hal-bus = "0.1.0"
and text_i2c.rs
to what I think I should have:
...
use hal::{
//i2c::I2c,
prelude::*,
pac::{Peripherals, I2C1},
pac,
};
use embedded_hal_bus::i2c::I2c;
...
Then when I compile I get
...
Downloaded embedded-hal-bus v0.1.0
Downloaded 1 crate (11.9 KB) in 0.72s
Compiling embedded-hal-bus v0.1.0
Compiling ssd1306 v0.8.4 (/home/paul/githubClones/ssd1306)
error[E0432]: unresolved import `embedded_hal_bus::i2c::I2c`
--> examples/text_i2c.rs:53:5
|
53 | use embedded_hal_bus::i2c::I2c;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `I2c` in `i2c`
|
help: consider importing one of these items instead
|
53 | use crate::hal::i2c::I2c;
| ~~~~~~~~~~~~~~~~~~~~
53 | use embedded_hal::i2c::I2c;
| ~~~~~~~~~~~~~~~~~~~~~~
53 | use embedded_hal_async::i2c::I2c;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53 | use stm32f1xx_hal::i2c::I2c;
| ~~~~~~~~~~~~~~~~~~~~~~~
and 2 other candidates
For more information about this error, try `rustc --explain E0432`.
error: could not compile `ssd1306` (example "text_i2c") due to 1 previous error
I find it strange that there is "no I2c
in i2c
". It really looks to me like it should be there. I don't see typos or anything simple, but this does not seem right.
Also, when I look at cargo tree, it looks like display-interface-i2c
depends on embedded-hal-async
but not on embedded-hal-bus
.
$ cargo tree
ssd1306 v0.8.4 (/home/paul/githubClones/ssd1306)
├── display-interface v0.5.0 (https://github.com/bugadani/display-interface.git?branch=eh1#e65eaf6d)
├── display-interface-i2c v0.5.0 (https://github.com/bugadani/display-interface.git?branch=eh1#e65eaf6d)
│ ├── display-interface v0.5.0 (https://github.com/bugadani/display-interface.git?branch=eh1#e65eaf6d)
│ ├── embedded-hal v1.0.0
│ └── embedded-hal-async v1.0.0
│ └── embedded-hal v1.0.0
├── display-interface-spi v0.5.0 (https://github.com/bugadani/display-interface.git?branch=eh1#e65eaf6d)
│ ├── byte-slice-cast v1.2.2
│ ├── display-interface v0.5.0 (https://github.com/bugadani/display-interface.git?branch=eh1#e65eaf6d)
│ ├── embedded-hal v1.0.0
│ └── embedded-hal-async v1.0.0 ()
├── embedded-graphics-core v0.4.0
│ ├── az v1.2.1
│ └── byteorder v1.5.0
├── embedded-hal v1.0.0
├── embedded-hal-async v1.0.0 ()
└── embedded-hal-bus v0.1.0
├── critical-section v1.1.2
└── embedded-hal v1.0.0
[dev-dependencies]
...
from ssd1306.
embedded-hal-bus isn't a simple plug-and-play crate, you don't get an I2c struct that "just works". You need to decide on how you share your bus between your devices, and for that you have three options.
Why do you expect display-interface-i2c to depend on embedded-hal-bus? embedded-hal-bus doesn't define any new traits that would require any special handling in display-interface-i2c.
from ssd1306.
Thanks for the hint @bugadani . I guess it is more complicated than I thought. I'll eventually figure it out. Not exactly a simple replacement for shared_bus
, but seems like more control over the mechanism.
My thinking on display-interface-i2c
depending on embedded-hal-bus
was because I mis-read the tree and thought it depended on embedded-hal-spi
. I think the spi
and i2c
similarities are such that one dependency would suggest the other too..
from ssd1306.
Related Issues (20)
- ssd1306 with rtic 1.0.0 HOT 7
- memory.x or probe-run "fix" HOT 6
- [N00b help request] Init fails with Raspberry Pi Pico and Adafruit OLED HOT 3
- Noob Issue: Cant manage to get this building for the stm32f1xx_hal HOT 6
- Newbie: No signs of life from SSD1306 atmega32u4 SPI 128x64 HOT 2
- How to use display with multiple I2C peripherals ([shared-bus] crate?) HOT 3
- Static noise when using crate with embedded_graphics HOT 4
- Using `DrawTarget::clear` is difficult in buffered graphics mode HOT 5
- `DrawTarget` is not implemented for `Ssd1306<I2CInterface<avr_hal_generic::i2c::I2c<.....` HOT 4
- Yet another `DrawTarget` is not implemented for `Ssd1306<SPIInterface<Spi... HOT 6
- Unable to draw circles & lines using embedded graphics crate
- Issues with 128x32 Display on Elegoo Arduino UnoR3
- read or toggle pixel in bufferedMode? HOT 4
- Using terminal mode with 90/270 degree rotation leads to incorrect output and panic HOT 1
- Configurable I2C address HOT 1
- trait `DrawTarget` is not implemented for ... / esp_idf_hal::i2c::*
- Buffered graphics paging issues.
- Custom mode support
- :rotating_light: Finding a new owner for this crate HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ssd1306.