pub struct Accelerometer;
Expand description

Wrapped Accelerometer API.

Implementations§

source§

impl Accelerometer

source

pub fn enable() -> Option<()>

Enable accelerometer only. By default, the accelerometer is disabled to save (a small amount of) power. To use a peripheral, it must first be enabled via this function. Accelerometer data is not available until the next update cycle after it’s enabled.

Uses setPeripheralsEnabled.

source

pub fn disable() -> Option<()>

Uses setPeripheralsEnabled.

⚠️ Disables all peripherals. Currently it doesn’t matter because there’s just one peripheral - accelerometer.

source

pub fn get() -> Option<(c_float, c_float, c_float)>

Uses getAccelerometer.

Returns (x, y, z) accelerometer data.

source

pub fn get_to( outx: &mut c_float, outy: &mut c_float, outz: &mut c_float ) -> Option<()>

Gets accelerometer data directly to x, y and z.

Auto Trait Implementations§

§

impl RefUnwindSafe for Accelerometer

§

impl Send for Accelerometer

§

impl Sync for Accelerometer

§

impl Unpin for Accelerometer

§

impl UnwindSafe for Accelerometer

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 0 bytes