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

lib: Fix lib style #18

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/linux-i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() {
}
println!("Test 5 measurement, without set single measurement(no updates)");
for _n in 1..=5 {
let (x, y, z) = sensor.read_unchecked().unwrap();
let (x, y, z) = sensor.read_raw_unchecked().unwrap();
println!("Magnetometer: x={}, y={}, z={}", x, y, z);
}
println!("Test 5 measurement, using continuous mode");
Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ where
// - HX[15:0] bits: -200 ≤ HX ≤ +200
// - HY[15:0] bits: -200 ≤ HY ≤ +200
// - HZ[15:0] bits: -800 ≤ HZ ≤ -200

pub fn self_test(&mut self) -> Result<bool, Error<E>> {
self.set_mode(Mode::SelfTest)?;
std::thread::sleep(std::time::Duration::from_micros(4000));
Expand Down Expand Up @@ -210,7 +209,6 @@ where
// Stored measurement data is protected during data reading and data is not updated.
// By reading ST2 register, this protection is released. It is required to read
// ST2 register after data reading.

pub fn read_raw(&mut self) -> Result<(i16, i16, i16), Error<E>> {
self.check_data_ready()?;

Expand All @@ -230,7 +228,7 @@ where
Ok((x, y, z))
}

pub fn read_unchecked(&mut self) -> Result<(i16, i16, i16), Error<E>> {
pub fn read_raw_unchecked(&mut self) -> Result<(i16, i16, i16), Error<E>> {
let mut buffer: [u8; 6] = [0u8; 6];
self.i2c
.write_read(self.address, &[Register::HXL.into()], &mut buffer)
Expand Down
Loading