pub struct Magnetometer {
    pub raw_data: Data,
    pub data: ScaledData,
    pub scaled_data: ScaledData,
    /* private fields */
}
Expand description

Magnetometer sensor

This sensor is used to measure the magnetic field around the device. The sensor is connected to the I2C bus and is configured with defaults values. Within this structure you have access to raw data and converted data.

Fields

raw_data: Data

Raw data from the magnetometer sensor.

data: ScaledData

Data from the magnetometer sensor converted to uT but without corrections.

scaled_data: ScaledData

Scaled data from the magnetometer sensor in µT with corrections.

Implementations

Creates a new magnetometer sensor.
Arguments
  • sensor_id - The sensor id to name the device (usually 0x8700B as reference to the sensor’s model).
Returns basics information about the sensor.

This field is not yet updated through the initialization.

Set hard iron offset to the magnetometer sensor on all axis.

This function is used for calibration purposes. Data must be in µT. Offset only affects the scaled data. If you don’t want to set the soft iron, put an identity matrix.

Get Raw data from the magnetometer sensor on the all axis.

Returns a Data structure with signed 16-bit integers.

Get Scaled data from the magnetometer sensor on the all axis with correction.

Returns a ScaledData structure with the magnetic field in µT as a f32.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

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.