pub trait Accelerometer {
    type Error: Debug;

    // Required methods
    fn accel_norm(&mut self) -> Result<F32x3, Error<Self::Error>>;
    fn sample_rate(&mut self) -> Result<f32, Error<Self::Error>>;
}
Expand description

Accelerometer trait which provides g-normalized readings.

Required Associated Types§

source

type Error: Debug

Error type

Required Methods§

source

fn accel_norm(&mut self) -> Result<F32x3, Error<Self::Error>>

Get normalized ±g reading from the accelerometer.

Ex. {0.0, 5.2, 0.0} - 5.2 g of acceleration in the y-axis

source

fn sample_rate(&mut self) -> Result<f32, Error<Self::Error>>

Get sample rate of accelerometer data.

Ex. 125.0 - sample rate of 125hz

Implementations on Foreign Types§

source§

impl<I2C, E> Accelerometer for Lis3dh<I2C>where I2C: WriteRead<u8, Error = E> + Write<u8, Error = E>, E: Debug,

source§

fn accel_norm( &mut self ) -> Result<F32x3, Error<<Lis3dh<I2C> as Accelerometer>::Error>>

Get normalized ±g reading from the accelerometer. You should be reading based on data ready interrupt or if reading in a tight loop you should waiting for is_data_ready.

source§

fn sample_rate( &mut self ) -> Result<f32, Error<<Lis3dh<I2C> as Accelerometer>::Error>>

Get the sample rate of the accelerometer data.

§

type Error = Error<E>

Implementors§