[−][src]Struct rpi_embedded::adxl::Adxl
Fields
id: u8
power_status: u8
offsets: [u8; 3]
raw_data: [u8; 6]
data: [i16; 3]
free_fall: bool
tap: bool
dtap: bool
act: bool
inact: bool
data_ready: bool
overrun: bool
watermark: bool
pitch: f64
pitch and roll
roll: f64
Implementations
impl Adxl
[src]
pub fn new() -> Self
[src]
Creates a empty struct to allow usage and starts the i2c channel Sets it to the default address which is 0x53
Example
let mut adxl = Adxl::new();
pub fn new_alt_adress(address: u16) -> Self
[src]
Creates a empty struct to allow usage and starts the i2c channel Sets it to a adress of your choise
Example
let mut adxl = Adxl::new_alt_adress(0x21);
pub fn start(&mut self)
[src]
Simply gets the defult data, so the user can begin Should be used in the new function but something went wrong, needs testing
pub fn set_sampling(&self)
[src]
This function sets the sampling sampling rate, some libraries do this so I included it not neccecery to use
pub fn set_format(&self)
[src]
Sets the default format
pub fn get_id(&mut self) -> u8
[src]
uses the private function _read_cmd to read the current id and returns it
pub fn get_power_status(&mut self) -> u8
[src]
uses the private function _read_cmd to read the current powerstatus and returns it
pub fn set_power_status(&self, cmd: u8)
[src]
uses the private function _write_cmd to read the current id and returns it
pub fn get_data_raw(&mut self)
[src]
uses the block read function from rpi_embedded to get 6 values of data from the accelerometer The block read command reads from address DATAX0 to DATAX0 + length(self.raw_data) -1 returns it to the struct
pub fn get_data(&mut self)
[src]
gets the raw data, and calulates the values the raw data has a low and high byte so it needs to be combined
pub fn rotations(&mut self)
[src]
calculates rotations from worked data.
pub fn get_offsets(&mut self)
[src]
uses the block read function from rpi_embedded to get 3 values of data from the accelerometer The block read command reads from address OFSX to OFSX + length(self.iffsets) -1 returns it to the struct
pub fn set_offsets(&mut self, buffer: [u8; 3])
[src]
uses the block write function from rpi_embedded to set 3 values on the accelerometer The block write command writes from address OFSX to OFSX + length(self.offsets) -1 a check can be forced by doing get offsets and comparing, how ever this slows down the code so it is made up to the user
impl Adxl
[src]
pub fn set_tap_threshold(&self, cmd: f32)
[src]
UNTESTED should set the tap threshold as the datasheet specifies
pub fn get_tap_threshold(&self) -> f32
[src]
UNTESTED should get the tap threshold as the datasheet specifies
pub fn set_tap_duration(&self, cmd: f32)
[src]
UNTESTED should set the tap duration as the datasheet specifies
pub fn get_tap_duration(&self) -> f32
[src]
UNTESTED should get the tap duration as the datasheet specifies
pub fn set_dtap_latency(&self, cmd: f32)
[src]
pub fn get_dtap_latency(&self) -> f32
[src]
pub fn set_dtap_window(&self, cmd: f32)
[src]
pub fn get_dtap_window(&self) -> f32
[src]
pub fn set_act_threshold(&self, cmd: f32)
[src]
pub fn get_act_threshold(&self) -> f32
[src]
pub fn set_inact_threshold(&self, cmd: f32)
[src]
pub fn get_inact_threshold(&self) -> f32
[src]
pub fn set_inact_time(&self, cmd: u8)
[src]
pub fn get_inact_time(&self) -> u8
[src]
pub fn set_ff_threshold(&self, cmd: f32)
[src]
pub fn get_ff_threshold(&self) -> f32
[src]
pub fn set_ff_time(&self, cmd: f32)
[src]
pub fn get_ff_time(&self) -> f32
[src]
pub fn set_act_inact(&self, cmd: u8)
[src]
pub fn get_act_inact(&self) -> u8
[src]
pub fn set_tap_axes(&self, cmd: u8)
[src]
pub fn get_tap_axes(&self) -> u8
[src]
pub fn set_int_map(&self, cmd: u8)
[src]
pub fn get_int_map(&self) -> u8
[src]
pub fn set_int_enable(&self, cmd: u8)
[src]
pub fn get_int_enable(&self) -> u8
[src]
pub fn clear_interupt(&mut self)
[src]
pub fn clear_settings(&mut self)
[src]
Auto Trait Implementations
impl RefUnwindSafe for Adxl
impl Send for Adxl
impl !Sync for Adxl
impl Unpin for Adxl
impl UnwindSafe for Adxl
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, 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>,