-
Notifications
You must be signed in to change notification settings - Fork 1
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
SNS - I2C Accelerometer #28
base: main
Are you sure you want to change the base?
Conversation
…laj/hype-28-implement-accelerometers
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.
Correct structure! You'll need to add pub mod accelerometer;
to lib/sensors/src/lib.rs
to include it (this will activate IDE features too)
…laj/hype-28-implement-accelerometers
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.
Looking good, thanks for including a detailed comment. Could you also add a brief description + data sheet link to the PR description and Linear issue?
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.
looks good! there's a couple things i'm unsure on + i'm not too confident on the coding standards yous are using with rust, so ignore what I say as you wish lol
oh also run a format over it
pub fn from_byte(byte: u8) -> Self { | ||
match byte { | ||
LIS2DS12_DATA_NOT_READY => Self::DataNotReady, | ||
_ => Self::Ok, | ||
} | ||
} |
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.
is this correct? the manual seems to say that only the DRDY
bit matters for the data being ready, can there be other flags set in the status register that you don't care about for determining readiness?
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.
Looks good, just fix @TomLonergan03's suggestions. A couple of tests would be good too, like the ones for the temperature sensor (you might need to merge main into your branch again to get MockI2c
)
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.
Very nearly there. Just tests now I think
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.
looks good, see if there's a way to test DRDY
status bit when your in the lab, and do what clippy/rustfmt want
Translate last year's accelerometer code into Rust.
Data sheet: https://www.st.com/resource/en/datasheet/lis2ds12.pdf