Trait NineDof

Source
pub trait NineDof<'a> {
    // Required method
    fn set_client(&self, client: &'a dyn NineDofClient);

    // Provided methods
    fn read_accelerometer(&self) -> Result<(), ErrorCode> { ... }
    fn read_magnetometer(&self) -> Result<(), ErrorCode> { ... }
    fn read_gyroscope(&self) -> Result<(), ErrorCode> { ... }
}
Expand description

A basic interface for a 9-DOF compatible chip.

This trait provides a standard interface for chips that implement some or all of a nine degrees of freedom (accelerometer, magnetometer, gyroscope) sensor. Any interface functions that a chip cannot implement can be ignored by the chip capsule and an error will automatically be returned.

Required Methods§

Source

fn set_client(&self, client: &'a dyn NineDofClient)

Set the client to be notified when the capsule has data ready or has finished some command. This is likely called in a board’s main.rs and is set to the virtual_ninedof.rs driver.

Provided Methods§

Source

fn read_accelerometer(&self) -> Result<(), ErrorCode>

Get a single instantaneous reading of the acceleration in the X,Y,Z directions.

Source

fn read_magnetometer(&self) -> Result<(), ErrorCode>

Get a single instantaneous reading from the magnetometer in all three directions.

Source

fn read_gyroscope(&self) -> Result<(), ErrorCode>

Get a single instantaneous reading from the gyroscope of the rotation around all three axes.

Implementors§

impl<'a> NineDof<'a> for Fxos8700cq<'a>

impl<'a, I: I2CDevice> NineDof<'a> for BMM150<'a, I>

impl<'a, I: I2CDevice> NineDof<'a> for Lsm303agrI2C<'a, I>

impl<'a, I: I2CDevice> NineDof<'a> for Lsm303dlhcI2C<'a, I>

impl<'a, I: I2CDevice> NineDof<'a> for Lsm6dsoxtrI2C<'a, I>

impl<'a, S: SpiMasterDevice<'a>> NineDof<'a> for L3gd20Spi<'a, S>