[−][src]Struct adxl313::Adxl313
ADXL313 driver
Implementations
impl<SPI, CS, SpiError, PinError> Adxl313<SPI, CS> where
SPI: Transfer<u8, Error = SpiError> + Write<u8, Error = SpiError>,
CS: OutputPin<Error = PinError>,
[src]
SPI: Transfer<u8, Error = SpiError> + Write<u8, Error = SpiError>,
CS: OutputPin<Error = PinError>,
pub fn new(spi: SPI, cs: CS) -> Result<Self, Adxl313Error<SpiError, PinError>>
[src]
Create a new Adxl313 instance using the defaults
pub fn xid(&mut self) -> Result<u8, Adxl313Error<SpiError, PinError>>
[src]
The XID register stores a semiunique serial number that is generated from the device trim and calibration process
pub fn soft_reset(&mut self) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
Writing a value of 0x52 to Register 0x18 triggers the soft reset function of the ADXL313. The soft reset returns the ADXL313 to the beginning of its power-on initialization routine, clearing the configuration settings that were written to the memory map, which allows easy reconfiguration of the ADXL313 device.
pub fn offsets(
&mut self,
offset_x: u8,
offset_y: u8,
offset_z: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
offset_x: u8,
offset_y: u8,
offset_z: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
The OFSX, OFSY, and OFSZ registers are each eight bits and offer user set offset adjustments in twos complement format, with a scale factor of 3.9 mg/LSB (that is, 0x7F = 0.5g). The value stored in the offset registers is automatically added to the acceleration data, and the resulting value is stored in the output data registers.
pub fn activity_threshold(
&mut self,
threshold: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
threshold: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
The THRESH_ACT register is eight bits and holds the thresholdvalue for detecting activity. The data format is unsigned; therefore, the magnitude of the activity event is compared with the value in the THRESH_ACT register. The scale factor is 15.625 mg/LSB. A value of 0 may result in undesirable behavior if the activity interrupt is enabled.
pub fn inactivity_threshold(
&mut self,
threshold: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
threshold: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
The THRESH_INACT register is eight bits and holds the thresholdvalue for detecting inactivity. The data format is unsigned; therefore, the magnitude of the inactivity event is compared with the value in the THRESH_INACT register. The scale factor is 15.625 mg/LSB. A value of 0 may result in undesirable behavior if the inactivity interrupt is enabled.
pub fn inactivity_time(
&mut self,
time: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
time: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
The TIME_INACT register is eight bits and contains an unsignedtime value. Acceleration must be less than the value in the THRESH_INACT register for the amount of time represented by TIME_INACT for inactivity to be declared. The scale factor is 1 sec/LSB. Unlike the other interrupt functions, which use unfiltered data (see the Threshold section), the inactivity function uses filtered output data. At least one output sample must be generated for the inactivity interrupt to be triggered. This results in the function appearing unresponsive if the TIME_INACT register is set to a value less than the time constant of the output data rate. A value of 0 results in an interrupt when the output data is less than the value in the THRESH_INACT register.
pub fn activity_inactivity_control(
&mut self,
activity_coupling: AcDcCoupling,
inactivity_coupling: AcDcCoupling,
enable_x_activity: bool,
enable_x_inactivity: bool,
enable_y_activity: bool,
enable_y_inactivity: bool,
enable_z_activity: bool,
enable_z_inactivity: bool
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
activity_coupling: AcDcCoupling,
inactivity_coupling: AcDcCoupling,
enable_x_activity: bool,
enable_x_inactivity: bool,
enable_y_activity: bool,
enable_y_inactivity: bool,
enable_z_activity: bool,
enable_z_inactivity: bool
) -> Result<(), Adxl313Error<SpiError, PinError>>
pub fn output_data_rate_and_low_power(
&mut self,
rate: OutputDataRate,
low_power_enabled: bool
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
rate: OutputDataRate,
low_power_enabled: bool
) -> Result<(), Adxl313Error<SpiError, PinError>>
pub fn power_control(
&mut self,
i2c_disabled: bool,
concurrent_activity_inactivity: bool,
auto_sleep: bool,
measuring: bool,
sleep_enabled: bool,
sleep_mode_frequency_reading: SleepModeFrequencyReadings
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
i2c_disabled: bool,
concurrent_activity_inactivity: bool,
auto_sleep: bool,
measuring: bool,
sleep_enabled: bool,
sleep_mode_frequency_reading: SleepModeFrequencyReadings
) -> Result<(), Adxl313Error<SpiError, PinError>>
pub fn interrupt_enable(
&mut self,
conf: InterruptSource
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
conf: InterruptSource
) -> Result<(), Adxl313Error<SpiError, PinError>>
pub fn interrupt_pin_mapping(
&mut self,
conf: InterruptSource
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
conf: InterruptSource
) -> Result<(), Adxl313Error<SpiError, PinError>>
pub fn interrupt_source(
&mut self
) -> Result<InterruptSource, Adxl313Error<SpiError, PinError>>
[src]
&mut self
) -> Result<InterruptSource, Adxl313Error<SpiError, PinError>>
pub fn data_format(
&mut self,
self_test: bool,
spi_mode: SpiMode,
irq_mode: IrqMode,
full_resolution: bool,
left_justified_data: bool,
range: Range
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
self_test: bool,
spi_mode: SpiMode,
irq_mode: IrqMode,
full_resolution: bool,
left_justified_data: bool,
range: Range
) -> Result<(), Adxl313Error<SpiError, PinError>>
pub fn fifo_control(
&mut self,
fifo_mode: FifoMode,
interrupt_to_pin2: bool,
samples: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self,
fifo_mode: FifoMode,
interrupt_to_pin2: bool,
samples: u8
) -> Result<(), Adxl313Error<SpiError, PinError>>
pub fn fifo_status(
&mut self
) -> Result<FifoStatus, Adxl313Error<SpiError, PinError>>
[src]
&mut self
) -> Result<FifoStatus, Adxl313Error<SpiError, PinError>>
pub fn start_measuring(
&mut self
) -> Result<(), Adxl313Error<SpiError, PinError>>
[src]
&mut self
) -> Result<(), Adxl313Error<SpiError, PinError>>
pub fn is_10_bit(&self) -> bool
[src]
pub fn get_device_id(&mut self) -> Result<u32, Adxl313Error<SpiError, PinError>>
[src]
Get the device ID
Trait Implementations
impl<SPI, CS, E, PinError> Accelerometer for Adxl313<SPI, CS> where
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin<Error = PinError>,
E: Debug,
[src]
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin<Error = PinError>,
E: Debug,
type Error = E
Error type
fn accel_norm(&mut self) -> Result<F32x3, Error<Self::Error>>
[src]
fn sample_rate(&mut self) -> Result<f32, Error<Self::Error>>
[src]
impl<SPI, CS, E, EO> RawAccelerometer<I32x3> for Adxl313<SPI, CS> where
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin<Error = EO>,
E: Debug,
[src]
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin<Error = EO>,
E: Debug,
Auto Trait Implementations
impl<SPI, CS> Send for Adxl313<SPI, CS> where
CS: Send,
SPI: Send,
CS: Send,
SPI: Send,
impl<SPI, CS> Sync for Adxl313<SPI, CS> where
CS: Sync,
SPI: Sync,
CS: Sync,
SPI: Sync,
impl<SPI, CS> Unpin for Adxl313<SPI, CS> where
CS: Unpin,
SPI: Unpin,
CS: Unpin,
SPI: 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>,