Trait kernel::hil::sensors::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§