Skip to content

Instantly share code, notes, and snippets.

@bofh
Created August 7, 2018 20:42
Show Gist options
  • Save bofh/e6ec117ec6f11f1bcf57e9fa257a2707 to your computer and use it in GitHub Desktop.
Save bofh/e6ec117ec6f11f1bcf57e9fa257a2707 to your computer and use it in GitHub Desktop.
diff --git a/src/lib.rs b/src/lib.rs
index ecabc08..84e5233 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -257,6 +257,13 @@ where
})
}
+ /// Self test for gyroscope and accelerometer
+ pub fn self_test(&mut self) -> Result<(), E> {
+ self.write(Register::SMPLRT_DIV, 0x00)?;
+
+ Ok(())
+ }
+
/// Applies a digital low pass filter to the accelerometer data
pub fn a_filter(&mut self, dlpf: Dlpf) -> Result<(), E> {
self.write(Register::ACCEL_CONFIG_2, dlpf as u8)?;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment