[][src]Trait adxl345_driver::Adxl345Writer

pub trait Adxl345Writer {
    fn command(&mut self, register: u8, byte: u8) -> Result;
fn init(&mut self) -> Result; fn set_inactivity(&mut self, thresh: u8, time: u8) -> Result { ... }
fn set_free_fall(&mut self, thresh: u8, time: u8) -> Result { ... }
fn set_activity_control<AM>(&mut self, mode: AM) -> Result
    where
        AM: Into<ActivityMode>
, { ... }
fn set_activity_threshold(&mut self, thresh: u8) -> Result { ... }
fn set_bandwidth_rate<BRC>(&mut self, mode: BRC) -> Result
    where
        BRC: TryInto<BandwidthRateControl, Error = AdxlError>
, { ... }
fn set_data_format<DF>(&mut self, mode: DF) -> Result
    where
        DF: TryInto<DataFormat, Error = AdxlError>
, { ... }
fn set_free_fall_threshold(&mut self, thresh: u8) -> Result { ... }
fn set_free_fall_time(&mut self, time: u8) -> Result { ... }
fn set_fifo_control<FC>(&mut self, mode: FC) -> Result
    where
        FC: Into<FifoControl>
, { ... }
fn set_inactivity_threshold(&mut self, thresh: u8) -> Result { ... }
fn set_inactivity_time(&mut self, time: u8) -> Result { ... }
fn set_interrupt_control<IC>(&mut self, mode: IC) -> Result
    where
        IC: Into<IntControlMode>
, { ... }
fn set_interrupt_map<IM>(&mut self, mode: IM) -> Result
    where
        IM: Into<IntMapMode>
, { ... }
fn set_offset_adjustment<X, Y, Z>(&mut self, x: X, y: Y, z: Z) -> Result
    where
        X: Into<Option<i8>>,
        Y: Into<Option<i8>>,
        Z: Into<Option<i8>>
, { ... }
fn set_power_control<PC>(&mut self, mode: PC) -> Result
    where
        PC: TryInto<PowerControl, Error = AdxlError>
, { ... }
fn set_tap<T>(&mut self, tap: T) -> Result
    where
        T: Into<Tap>
, { ... }
fn set_tap_control<TM>(&mut self, mode: TM) -> Result
    where
        TM: Into<TapMode>
, { ... }
fn set_tap_duration(&mut self, duration: u8) -> Result { ... }
fn set_tap_latency(&mut self, latency: u8) -> Result { ... }
fn set_tap_threshold(&mut self, threshold: u8) -> Result { ... }
fn set_tap_window(&mut self, window: u8) -> Result { ... }
fn set_x_offset(&mut self, x: i8) -> Result { ... }
fn set_y_offset(&mut self, y: i8) -> Result { ... }
fn set_z_offset(&mut self, z: i8) -> Result { ... } }

Write register command set for accelerometer.

Required methods

fn command(&mut self, register: u8, byte: u8) -> Result

Provides an interface to send commands through the ADXL345 driver.

This is NOT part of the actual ADXL345 command register set but a necessary method to interface with all drivers.

Provides a place for drivers to do any needed shared command processing.

The implementation of most other methods in the command set will use this trait after doing any per command processing.

Arguments

  • register - Register address to be written.
  • byte - Byte of data to be written into the given register.

fn init(&mut self) -> Result

Used to initialize the accelerometer into a know state.

Typically this will be only be called from a new() method of the implementation but there can be rare times when the library user needs access after instance has been created. Think of it as a soft/warm reset.

Loading content...

Provided methods

fn set_inactivity(&mut self, thresh: u8, time: u8) -> Result

Used to set the threshold for detecting activity.

Arguments

  • thresh - Threshold value for detecting activity. The scale factor is 62.5 mg/LSB. Note: that a value of 0 may result in undesirable behavior if the inactivity interrupt is enabled.
  • time - Time value representing the amount of time that acceleration must be less than the value in thresh for inactivity to be declared. The scale factor is 1 sec/LSB.

fn set_free_fall(&mut self, thresh: u8, time: u8) -> Result

Used to set threshold and time values for free-fall detection.

Arguments

  • thresh - The threshold value for free-fall detection. The scale factor is 62.5 mg/LSB. Recommended values between 300mg and 600mg (0x14 - 0x46). Note: that a value of 0 may result in undesirable behavior if the free-fall interrupt is enabled.
  • time - Time value representing the minimum time that the value of all axes must be less than thresh to generate a free-fall interrupt. The scale factor is 5 ms/LSB. Recommended values between 100ms and 350ms (0x14 - 0x46). Note: that a value of 0 may result in undesirable behavior if the free-fall interrupt is enabled.

fn set_activity_control<AM>(&mut self, mode: AM) -> Result where
    AM: Into<ActivityMode>, 

Set activity/inactivity control mode options.

Arguments

  • mode - Activity mode bit flags. See ActivityMode bit flags for more info.

fn set_activity_threshold(&mut self, thresh: u8) -> Result

Set the activity threshold.

Arguments

  • thresh - Threshold value for detecting activity. The scale factor is 62.5 mg/LSB. Note: that a value of 0 may result in undesirable behavior if the activity interrupt is enabled.

fn set_bandwidth_rate<BRC>(&mut self, mode: BRC) -> Result where
    BRC: TryInto<BandwidthRateControl, Error = AdxlError>, 

Set data rate and power mode control mode options.

Arguments

fn set_data_format<DF>(&mut self, mode: DF) -> Result where
    DF: TryInto<DataFormat, Error = AdxlError>, 

Set data format mode options.

Arguments

  • mode - Data format mode bit flags. See DataFormat bit flags for more info.

fn set_free_fall_threshold(&mut self, thresh: u8) -> Result

Set the free-fall threshold.

Arguments

  • thresh - Threshold value for detecting activity. The scale factor is 62.5 mg/LSB. Values between 300 mg and 600 mg(0x05 to 0x09) are recommended. Note: that a value of 0 may result in undesirable behavior if the free-fall interrupt is enabled.

fn set_free_fall_time(&mut self, time: u8) -> Result

Set the free-fall time.

Arguments

  • time - Time value representing the minimum amount of time that acceleration must be less than the value in the free-fall threshold register for a free-fall interrupt to be generated. The scale factor is 5 ms/LSB. Values between 100 ms and 350 ms (0x14 to 0x46) are recommended. Note: that a value of 0 may result in undesirable behavior if the free-fall interrupt is enabled.

fn set_fifo_control<FC>(&mut self, mode: FC) -> Result where
    FC: Into<FifoControl>, 

Set fifo control mode options.

Arguments

  • mode - Fifo control mode bit flags. See FifoControl bit flags for more info.

fn set_inactivity_threshold(&mut self, thresh: u8) -> Result

Set the inactivity threshold.

Arguments

  • thresh - Threshold value for detecting activity. The scale factor is 62.5 mg/LSB. Note: that a value of 0 may result in undesirable behavior if the inactivity interrupt is enabled.

fn set_inactivity_time(&mut self, time: u8) -> Result

Set the inactivity time.

Arguments

  • time - Time value representing the amount of time that acceleration must be less than the value in the inactivity threshold register for inactivity to be declared. The scale factor is 1 sec/LSB. Note: that a value of 0 results in an interrupt when the output data is less than the threshold.

fn set_interrupt_control<IC>(&mut self, mode: IC) -> Result where
    IC: Into<IntControlMode>, 

Set interrupt control enable options.

Arguments

  • mode - Interrupt control mode bit flags. See IntControlMode bit flags for more info.

fn set_interrupt_map<IM>(&mut self, mode: IM) -> Result where
    IM: Into<IntMapMode>, 

Set interrupt mapping mode options.

Arguments

  • mode - Interrupt mapping mode bit flags. See IntMapMode bit flags for more info.

fn set_offset_adjustment<X, Y, Z>(&mut self, x: X, y: Y, z: Z) -> Result where
    X: Into<Option<i8>>,
    Y: Into<Option<i8>>,
    Z: Into<Option<i8>>, 

Use to set one or more axis offset adjustments.

Arguments

  • x - X-axis offset adjustment value in twos complement format with a scale factor of 15.6 mg/LSB. Automatically added to the acceleration data before storing in the data register. A None value leaves the existing offset adjustment unchanged.
  • y - Y-axis offset adjustment value in twos complement format with a scale factor of 15.6 mg/LSB. Automatically added to the acceleration data before storing in the data register. A None value leaves the existing offset adjustment unchanged.
  • z - Z-axis offset adjustment value in twos complement format with a scale factor of 15.6 mg/LSB. Automatically added to the acceleration data before storing in the data register. A None value leaves the existing offset adjustment unchanged.

fn set_power_control<PC>(&mut self, mode: PC) -> Result where
    PC: TryInto<PowerControl, Error = AdxlError>, 

Set power-saving features control mode options.

Arguments

  • mode - Power-saving features bit flags. See PowerControl bit flags for more info.

fn set_tap<T>(&mut self, tap: T) -> Result where
    T: Into<Tap>, 

Set all non-control tap related values at the same time.

Arguments

  • tap - Containing values for threshold, duration, latency, and window registers.

fn set_tap_control<TM>(&mut self, mode: TM) -> Result where
    TM: Into<TapMode>, 

Set tap control mode options.

Arguments

  • mode - Tab mode bit flags. See TapMode bit flags for more info.

fn set_tap_duration(&mut self, duration: u8) -> Result

Set required duration required to qualify a tap event vs double tap event.

Arguments

duration - Time value representing the maximum time that an event must be above the threshold to qualify as a tap event. The scale factor is 625 μs/LSB. A value of 0 disables the single/double tap functions.

fn set_tap_latency(&mut self, latency: u8) -> Result

Set latency for double tap events.

Arguments

latency - Time value representing the wait time from the detection of a tap event to the start of the time window during which a possible second tap event can be detected.

The scale factor is 1.25 ms/LSB. A value of 0 disables the double tap function.

fn set_tap_threshold(&mut self, threshold: u8) -> Result

Set threshold for tap events.

Note: that a value of 0 may result in undesirable behavior if the single tap/double tap interrupt(s) are enabled.

Arguments

threshold - Threshold value for tap interrupts. The scale factor is 62.5 mg/LSB.

fn set_tap_window(&mut self, window: u8) -> Result

Set window for double tap events.

Arguments

window - Time value representing the amount of time after the expiration of the latency time during which a second valid tap can begin.

The scale factor is 1.25 ms/LSB. A value of 0 disables the double tap function.

fn set_x_offset(&mut self, x: i8) -> Result

Set the x-axis offset adjustment.

Arguments

x - Offset adjustment in two's complement format. The scale factor is 15.6 mg/LSB.

fn set_y_offset(&mut self, y: i8) -> Result

Set the y-axis offset adjustment.

Arguments

y - Offset adjustment in two's complement format. The scale factor is 15.6 mg/LSB.

fn set_z_offset(&mut self, z: i8) -> Result

Set the z-axis offset adjustment.

Arguments

z - Offset adjustment in two's complement format. The scale factor is 15.6 mg/LSB.

Loading content...

Implementors

impl Adxl345Writer for Device[src]

Loading content...