[−][src]Struct afe4400::Afe4400
Controller in charge of communication with AFE4400
Fields
spi: SPI
diag_end: Option<IN>
adc_done: Option<IN>
led_err: Option<IN>
sensor_err: Option<IN>
afe_pdn: OUT
adc_rdy: IN
Methods
impl<SPI, IN, OUT> Afe4400<SPI, IN, OUT> where
SPI: FullDuplex<u8>,
IN: InputPin,
OUT: OutputPin,
<SPI as FullDuplex<u8>>::Error: Debug,
[src]
SPI: FullDuplex<u8>,
IN: InputPin,
OUT: OutputPin,
<SPI as FullDuplex<u8>>::Error: Debug,
pub fn write_data(
&mut self,
register: u8,
data: u32
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self,
register: u8,
data: u32
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
Send data to a specified register.
register
should be a constant defined in afe4400::registers
.
Can return an SPI error if communication failure occurs.
pub fn read_data(
&mut self,
register: u8
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self,
register: u8
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
Read data from a specified register
register
should be a constant defined in afe4400::registers
.
Can return an SPI error if communication failure occurs.
pub fn get_led1_data(
&mut self,
source: LEDSource
) -> Result<i32, Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self,
source: LEDSource
) -> Result<i32, Error<<SPI as FullDuplex<u8>>::Error>>
Get data from LED1 (IR)
pub fn get_led2_data(
&mut self,
source: LEDSource
) -> Result<i32, Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self,
source: LEDSource
) -> Result<i32, Error<<SPI as FullDuplex<u8>>::Error>>
Get data from LED1 (IR)
pub fn set_cancellation_current(
&mut self,
current: u8
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self,
current: u8
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
pub fn set_second_stage_gain(
&mut self,
gain: u8,
enabled: bool
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self,
gain: u8,
enabled: bool
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
pub fn set_first_stage_cap(
&mut self,
cap_value: u8
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self,
cap_value: u8
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
pub fn set_first_stage_gain(
&mut self,
rf_value: u8
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self,
rf_value: u8
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
pub fn set_led_current(
&mut self,
value: u8
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self,
value: u8
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
Set current sent to LEDs.
LED current and cancellation filter gain are used to compensate for changing ambient light conditions.
LEDCNTRL (0x22) LED1[15:8], LED2[7:0] Formula: LED_Register_value ------------------ * 50 mA = current 256
pub fn get_led_current(
&mut self
) -> Result<u8, Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self
) -> Result<u8, Error<<SPI as FullDuplex<u8>>::Error>>
pub fn default_pulse_timings(
&mut self
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
Recommended default pulse timings according to the AFE4400 data sheet.
pub fn self_check(
&mut self
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]
&mut self
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
Perform a self check to verify connections and chip clock integrity.
Returns Ok(()) if the self-check passes
Auto Trait Implementations
impl<SPI, IN, OUT> Send for Afe4400<SPI, IN, OUT> where
IN: Send,
OUT: Send,
SPI: Send,
IN: Send,
OUT: Send,
SPI: Send,
impl<SPI, IN, OUT> Sync for Afe4400<SPI, IN, OUT> where
IN: Sync,
OUT: Sync,
SPI: Sync,
IN: Sync,
OUT: Sync,
SPI: Sync,
impl<SPI, IN, OUT> Unpin for Afe4400<SPI, IN, OUT> where
IN: Unpin,
OUT: Unpin,
SPI: Unpin,
IN: Unpin,
OUT: 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, 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>,