-
Notifications
You must be signed in to change notification settings - Fork 44
Add pico-de-gallo battery example #676
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
base: v0.2.0
Are you sure you want to change the base?
Add pico-de-gallo battery example #676
Conversation
Cargo Vet Audit Passed
|
24a1cf5 to
4a630c5
Compare
08cc2a3 to
b4db5a7
Compare
7f0f011 to
c925d15
Compare
|
|
||
| /// Platform specific battery controller. | ||
| struct Battery { | ||
| pub driver: Bq40z50R5<pico_de_gallo_hal::I2c, pico_de_gallo_hal::Delay>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you use embedded_hal::i2c::I2c and embedded_hal::delay::DelayNs instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could make this struct generic on those traits but I consider this app level code, so the types should be resolved at this level. We don't want to construct multiple instances of Battery with differing types in this example.
c925d15 to
6ef312a
Compare
Yeah i tried without the unsafe impl but it is still needed. Not sure why because all its fields are Send but ¯\_(ツ)_/¯ |
Not to beat a dead horse but I think actually the reason is because you take a reference. So for |
daba71f to
e2e9b0a
Compare
Nah no dead horse, the horse is still alive and well. Reading more into |
| #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| pub struct Data<'a> { | ||
| contents: &'a dyn Any, | ||
| contents: &'a (dyn Any + Send + Sync), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change, could you make sure to announce it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary now?
| } | ||
| } | ||
|
|
||
| #[tokio::main] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add comment or a README to describe the setup required to run this example.
Add support for examples with the pico-de-gallo development board.
This PR sets up a new workspace for pico-de-gallo examples and adds an example that runs the battery service with the bq40z50-r5 fuel gauge connected to the pico-de-gallo's I2C bus.