Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a bit of documenting and refractoring? #2

Closed
Nebdir opened this issue Sep 22, 2024 · 2 comments · Fixed by #3 or #4
Closed

a bit of documenting and refractoring? #2

Nebdir opened this issue Sep 22, 2024 · 2 comments · Fixed by #3 or #4

Comments

@Nebdir
Copy link
Contributor

Nebdir commented Sep 22, 2024

currently im struggeling to find a delay provider that works with your code and my board, a esp32-wroom-32.

I saw that it has to implement at least DelayNs but the default one and the esp_idf_hal::delay::Ets does not have them implemented as async. upon disabeling the async feature gates the MAX31865 code breaks as now the trait embedded_hal_async::spi::SpiDevice is not implemented anymore.

An example would be nice to see if i can align my environment here.

also it would be neat to add feature flags for each driver to filter for what you actually need. Or split the drivers into seperate crates.

maybe i can help a bit on that work, but before i start doing things, i would like to get your opinion on this.

@oddlama
Copy link
Owner

oddlama commented Sep 23, 2024

I saw that it has to implement at least DelayNs but the default one and the esp_idf_hal::delay::Ets does not have them implemented as async. upon disabeling the async feature gates the MAX31865 code breaks as now the trait embedded_hal_async::spi::SpiDevice is not implemented anymore.

Hmm that's not ideal. When you disable async it should depend on embedded_hal::spi::SpiDevice and not embedded_hal_async::spi::SpiDevice. I currently don't see where it would depend on the latter though...

An example would be nice to see if i can align my environment here.

I locally use it with an NRF52840 based board, which of course has its own hal implementation so I'm not sure how well it would translate. I might be able to extract some examples from my repo if you'd like. And if you have an idea how to handle the delay stuff better, please do tell! I did it this way because several other drivers used it like this and I found no better way til today.

also it would be neat to add feature flags for each driver to filter for what you actually need. Or split the drivers into seperate crates.

I definitely want to keep them in one crate for now but introducing feature flags is probably a good call.

maybe i can help a bit on that work, but before i start doing things, i would like to get your opinion on this.

Please do! Help is always welcome!

@Nebdir
Copy link
Contributor Author

Nebdir commented Sep 23, 2024

so after some more research one of the issues is not in reach, at least partial i guess.
esp-rs/esp-hal#1864

as you said you maybe need a example:
i generated a default project from cargo generate esp-rs/esp-template added

embedded-devices = { version = "0.9.9", default-features = false, features = [] }
uom = { version = "0.36.0", features = ["f32", "f64", "si", "u8", "u16", "u32", "u64", "i8", "i16", "i32", "i64", "rational32", "rational64"], default-features = false }

as dependencies (quick copy paste)
and started the build.

i observed the following

disabeling async does not affect the embedded registers crate

i would suspect that the crate embedded registers should have a cargo reference of default-features=false and enable the needed per feature.

as this completes the issue i could add a sample project also for the esp32 board with a bme280.

This was referenced Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants