[][src]Struct afe4400::Afe4400

pub struct Afe4400<SPI: FullDuplex<u8>, IN: InputPin, OUT: OutputPin> {
    pub spi: SPI,
    pub diag_end: Option<IN>,
    pub adc_done: Option<IN>,
    pub led_err: Option<IN>,
    pub sensor_err: Option<IN>,
    pub afe_pdn: OUT,
    pub adc_rdy: IN,
}

Controller in charge of communication with AFE4400

Fields

spi: SPIdiag_end: Option<IN>adc_done: Option<IN>led_err: Option<IN>sensor_err: Option<IN>afe_pdn: OUTadc_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]

pub fn write_data(
    &mut self,
    register: u8,
    data: u32
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]

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]

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]

Get data from LED1 (IR)

pub fn get_led2_data(
    &mut self,
    source: LEDSource
) -> Result<i32, Error<<SPI as FullDuplex<u8>>::Error>>
[src]

Get data from LED1 (IR)

pub fn set_cancellation_current(
    &mut self,
    current: u8
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]

pub fn set_second_stage_gain(
    &mut self,
    gain: u8,
    enabled: bool
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]

pub fn set_first_stage_cap(
    &mut self,
    cap_value: u8
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]

pub fn set_first_stage_gain(
    &mut self,
    rf_value: u8
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]

pub fn set_led_current(
    &mut self,
    value: u8
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
[src]

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]

pub fn default_pulse_timings(
    &mut self
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]

Recommended default pulse timings according to the AFE4400 data sheet.

pub fn self_check(
    &mut self
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]

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

impl<SPI, IN, OUT> Sync for Afe4400<SPI, IN, OUT> where
    IN: Sync,
    OUT: Sync,
    SPI: Sync

impl<SPI, IN, OUT> Unpin for Afe4400<SPI, IN, OUT> where
    IN: Unpin,
    OUT: Unpin,
    SPI: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.