Struct lsm303agr::Lsm303agr[][src]

pub struct Lsm303agr<DI, MODE> { /* fields omitted */ }
Expand description

LSM303AGR device driver

Implementations

Set accelerometer output data rate.

This changes the power mode if the current one is not appropriate. When changing from a low-power-only output data rate setting into a high-resolution or normal power mode, it changes into normal mode.

Set accelerometer power/resolution mode

Returns Error::InvalidInputData if the mode is incompatible with the current accelerometer output data rate.

Get the accelerometer mode

Set accelerometer scaling factor

This changes the scale at which the acceleration is read. AccelScale::G2 for example can return values between -2g and +2g where g is the gravity of the earth (~9.82 m/s²).

Get accelerometer scaling factor

Create new instance of the LSM303AGR device communicating through I2C.

Destroy driver instance, return I2C bus.

Create new instance of the LSM303AGR device communicating through SPI.

Destroy driver instance, return SPI bus instance and chip select pin.

Initialize registers

Accelerometer status

Accelerometer data

Returned in mg (milli-g) where 1g is 9.8m/s².

If you need the raw unscaled measurement see Lsm303agr::accel_data_unscaled.

Unscaled accelerometer data

Magnetometer status

Get accelerometer device ID

Read and verify the accelerometer device ID

Get magnetometer device ID

Read and verify the magnetometer device ID

Change the magnetometer to continuous measurement mode

Change the magnetometer to one-shot mode

After this the magnetometer is in idle mode until a one-shot measurement is started.

Set magnetometer output data rate

Magnetometer data

Returned in nT (nanotesla)

If you need the raw unscaled measurement see Lsm303agr::mag_data_unscaled.

Unscaled magnetometer data

Magnetometer data in nT (nanoteslas)

Unscaled magnetometer data

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.