ryanrightmer / lis3mdl Goto Github PK
View Code? Open in Web Editor NEWA platform agnostic driver to interface with the LIS3MDL (3-axis magnetic sensor)
License: Apache License 2.0
A platform agnostic driver to interface with the LIS3MDL (3-axis magnetic sensor)
License: Apache License 2.0
I have a situation where I need to daisy chain three different sensors on the same I2C channel. With the pattern in this codebase, the driver takes ownership of the I2C device not allowing it to be shared with other device drivers.
I would recommend adding in some way that the driver accepts does not always own the I2C and can be managed by a higher level interface. An example would be to move the i2c
device in the struct to be an Option<I2C>
and then put in a take_i2c(&mut self)
and a set_i2c(&mut self, i2c: I2C)
style methods.
An alternative I have seen with other drivers, is to just pass the I2C device to each call. Sounds cumbersome, but might be proffered based on the time it takes to do the extra function calls and cross-checks postulated above.
Thoughts?
The I2c
trait from embedded-hal-async
would allow this crate's usage with embassy
.
Unfortunately, I can only think of hacky solutions to support both blocking and async:
fn
-> async fn
transformation and sprinkling in some .await
callsand then another question is:
async
using a feature, orI asked in rust-embedded/embedded-hal#356 if there's any best practice here. I think most of the other crates I've seen have gone for some form of duplicate code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.