[−][src]Struct mma8452q::MMA8452q
MMA8452q
driver
Methods
impl<I2C, E> MMA8452q<I2C> where
I2C: WriteRead<Error = E> + Write<Error = E>,
E: Debug,
[src]
I2C: WriteRead<Error = E> + Write<Error = E>,
E: Debug,
pub fn new(i2c: I2C, addr: SlaveAddr) -> Result<Self, Error<E>>
[src]
Create a new MMA84
driver from the given I2C
peripheral
pub fn destroy(self) -> I2C
[src]
Destroy driver instance, return I2C
bus instance
pub fn get_device_id(&mut self) -> Result<u8, Error<E>>
[src]
WHO_AM_I
register
pub fn set_mode(&mut self, mode: Mode) -> Result<(), Error<E>>
[src]
Operating mode selection,
CTRL_REG2
: MODS
bit,
pub fn set_odr(&mut self, odr: Odr) -> Result<(), Error<E>>
[src]
Data rate selection,
CTRL_REG1
: ODR
pub fn standby(&mut self) -> Result<(), Error<E>>
[src]
Set Standby Mode Sets the MMA8452 to standby mode. It must be in standby to change most register settings
pub fn active(&mut self) -> Result<(), Error<E>>
[src]
Set Active Mode Sets the MMA8452 to active mode. Needs to be in this mode to output data
pub fn is_active(&mut self) -> Result<bool, Error<E>>
[src]
Check State (ACTIVE or STANDBY) Returns true if in Active State, otherwise return false
pub fn set_fs(&mut self, fs: FullScale) -> Result<(), Error<E>>
[src]
Full-scale selection,
XYZ_DATA_CFG
: FS
pub fn reboot(&mut self, reboot: bool) -> Result<(), Error<E>>
[src]
Reboot memory content,
CTRL_REG2
: RST
pub fn get_status(&mut self) -> Result<DataStatus, Error<E>>
[src]
Data status,
STATUS_REG
: as
DataStatus {zyxor: ZYXOR
, xyzor: (XOR
, YOR
, ZOR
), zyxda: ZYXDA
, xyzda: (XDA
, YDA
, ZDA
)}
pub fn dump_regs<W>(&mut self, w: &mut W) -> Result<(), Error<E>> where
W: Write,
[src]
W: Write,
Dump registers
Trait Implementations
impl<I2C, E> RawAccelerometer<I16x3> for MMA8452q<I2C> where
I2C: WriteRead<Error = E> + Write<Error = E>,
E: Debug,
[src]
I2C: WriteRead<Error = E> + Write<Error = E>,
E: Debug,
Auto Trait Implementations
impl<I2C> Send for MMA8452q<I2C> where
I2C: Send,
I2C: Send,
impl<I2C> Sync for MMA8452q<I2C> where
I2C: Sync,
I2C: Sync,
impl<I2C> Unpin for MMA8452q<I2C> where
I2C: Unpin,
I2C: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
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>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,