Struct bno055::Bno055

source ·
pub struct Bno055<I> {
    pub mode: BNO055OperationMode,
    /* private fields */
}

Fields§

§mode: BNO055OperationMode

Implementations§

source§

impl<I, E> Bno055<I>
where I: I2c<SevenBitAddress, Error = E>,

source

pub fn new(i2c: I) -> Self

Side-effect-free constructor. Nothing will be read or written before init() call.

source

pub fn destroy(self) -> I

Destroy driver instance, return I2C bus instance.

source

pub fn with_alternative_address(self) -> Self

Enables use of alternative I2C address regs::BNO055_ALTERNATE_ADDR.

source

pub fn init(&mut self, delay: &mut dyn DelayNs) -> Result<(), Error<E>>

Initializes the BNO055 device.

Side-effects:

  • Software reset of BNO055
  • Sets BNO055 to CONFIG mode
  • Sets BNO055’s power mode to NORMAL
  • Clears SYS_TRIGGER register
§Usage Example
// use your_chip_hal::{I2c, Delay}; // <- import your chip's I2c and Delay
use bno055::Bno055;
let mut delay = Delay::new(/* ... */);
let mut i2c = I2c::new(/* ... */);
let mut bno055 = Bno055::new(i2c);
bno055.init(&mut delay)?;
source

pub fn soft_reset(&mut self, delay: &mut dyn DelayNs) -> Result<(), Error<E>>

Resets the BNO055, initializing the register map to default values. More in section 3.2.

source

pub fn set_mode( &mut self, mode: BNO055OperationMode, delay: &mut dyn DelayNs ) -> Result<(), Error<E>>

Sets the operating mode, see BNO055OperationMode. See section 3.3.

source

pub fn set_power_mode(&mut self, mode: BNO055PowerMode) -> Result<(), Error<E>>

Sets the power mode, see BNO055PowerMode See section 3.2

source

pub fn power_mode(&mut self) -> Result<BNO055PowerMode, Error<E>>

Returns BNO055’s power mode.

source

pub fn set_external_crystal( &mut self, ext: bool, delay: &mut dyn DelayNs ) -> Result<(), Error<E>>

Enables/Disables usage of external 32k crystal.

source

pub fn set_axis_remap(&mut self, remap: AxisRemap) -> Result<(), Error<E>>

Configures axis remap of the device.

source

pub fn axis_remap(&mut self) -> Result<AxisRemap, Error<E>>

Returns axis remap of the device.

source

pub fn set_axis_sign(&mut self, sign: BNO055AxisSign) -> Result<(), Error<E>>

Configures device’s axes sign: positive or negative.

source

pub fn axis_sign(&mut self) -> Result<BNO055AxisSign, Error<E>>

Return device’s axes sign.

source

pub fn get_revision(&mut self) -> Result<BNO055Revision, Error<E>>

Gets the revision of software, bootloader, accelerometer, magnetometer, and gyroscope of the BNO055 device.

source

pub fn get_system_status( &mut self, do_selftest: bool, delay: &mut dyn DelayNs ) -> Result<BNO055SystemStatus, Error<E>>

Returns device’s system status.

source

pub fn quaternion(&mut self) -> Result<Quaternion<f32>, Error<E>>

Gets a quaternion (mint::Quaternion<f32>) reading from the BNO055. Available only in sensor fusion modes.

source

pub fn euler_angles(&mut self) -> Result<EulerAngles<f32, ()>, Error<E>>

Get Euler angles representation of heading in degrees. Euler angles is represented as (roll, pitch, yaw/heading). Available only in sensor fusion modes.

source

pub fn get_calibration_status( &mut self ) -> Result<BNO055CalibrationStatus, Error<E>>

Get calibration status

source

pub fn is_fully_calibrated(&mut self) -> Result<bool, Error<E>>

Checks whether device is fully calibrated or not.

source

pub fn calibration_profile( &mut self, delay: &mut dyn DelayNs ) -> Result<BNO055Calibration, Error<E>>

Reads current calibration profile of the device.

source

pub fn set_calibration_profile( &mut self, calib: BNO055Calibration, delay: &mut dyn DelayNs ) -> Result<(), Error<E>>

Sets current calibration profile.

source

pub fn id(&mut self) -> Result<u8, Error<E>>

Returns device’s factory-programmed and constant chip ID. This ID is device model ID and not a BNO055’s unique ID, whic is stored in different register.

source

pub fn get_mode(&mut self) -> Result<BNO055OperationMode, Error<E>>

Returns device’s operation mode.

source

pub fn is_in_fusion_mode(&mut self) -> Result<bool, Error<E>>

Checks whether the device is in Sensor Fusion mode or not.

source

pub fn get_acc_config(&mut self) -> Result<AccConfig, Error<E>>

source

pub fn set_acc_config(&mut self, acc_config: &AccConfig) -> Result<(), Error<E>>

source

pub fn linear_acceleration_fixed(&mut self) -> Result<Vector3<i16>, Error<E>>

Returns linear acceleration vector in cm/s^2 units. Available only in sensor fusion modes.

source

pub fn linear_acceleration(&mut self) -> Result<Vector3<f32>, Error<E>>

Returns linear acceleration vector in m/s^2 units. Available only in sensor fusion modes.

source

pub fn gravity_fixed(&mut self) -> Result<Vector3<i16>, Error<E>>

Returns gravity vector in cm/s^2 units. Available only in sensor fusion modes.

source

pub fn gravity(&mut self) -> Result<Vector3<f32>, Error<E>>

Returns gravity vector in m/s^2 units. Available only in sensor fusion modes.

source

pub fn accel_data_fixed(&mut self) -> Result<Vector3<i16>, Error<E>>

Returns current accelerometer data in cm/s^2 units. Available only in modes in which accelerometer is enabled.

source

pub fn accel_data(&mut self) -> Result<Vector3<f32>, Error<E>>

Returns current accelerometer data in m/s^2 units. Available only in modes in which accelerometer is enabled.

source

pub fn gyro_data_fixed(&mut self) -> Result<Vector3<i16>, Error<E>>

Returns current gyroscope data in 1/16th deg/s units. Available only in modes in which gyroscope is enabled.

source

pub fn gyro_data(&mut self) -> Result<Vector3<f32>, Error<E>>

Returns current gyroscope data in deg/s units. Available only in modes in which gyroscope is enabled.

source

pub fn mag_data_fixed(&mut self) -> Result<Vector3<i16>, Error<E>>

Returns current magnetometer data in 1/16th uT units. Available only in modes in which magnetometer is enabled.

source

pub fn mag_data(&mut self) -> Result<Vector3<f32>, Error<E>>

Returns current magnetometer data in uT units. Available only in modes in which magnetometer is enabled.

source

pub fn temperature(&mut self) -> Result<i8, Error<E>>

Returns current temperature of the chip (in degrees Celsius).

Auto Trait Implementations§

§

impl<I> RefUnwindSafe for Bno055<I>
where I: RefUnwindSafe,

§

impl<I> Send for Bno055<I>
where I: Send,

§

impl<I> Sync for Bno055<I>
where I: Sync,

§

impl<I> Unpin for Bno055<I>
where I: Unpin,

§

impl<I> UnwindSafe for Bno055<I>
where I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.