Struct afe4400::Afe4400 [−][src]
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: 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]
impl<SPI, IN, OUT> Afe4400<SPI, IN, OUT> where
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]
pub fn write_data(
&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]
pub fn read_data(
&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
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
[src]
pub fn get_led1_data(
&mut self
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
Get data from LED1 (IR) after subtracting ambient background.
pub fn get_led2_data(
&mut self
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
[src]
pub fn get_led2_data(
&mut self
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
Get data from LED2 (Red) after subtracting ambient background.
pub fn set_cancellation_filters(
&mut self,
value: u16
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]
pub fn set_cancellation_filters(
&mut self,
value: u16
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
Set the cancellation filter gain resistor R_f
value
LED current and cancellation filter gain are used to compensate for changing ambient light conditions.
TIA_AMB_GAIN: RF_LED[2:0] set to 110
(see p.64 in docs for all R_f
options)
pub fn set_led_current(
&mut self,
value: u8
) -> Result<u32, Error<<SPI as FullDuplex<u8>>::Error>>
[src]
pub fn set_led_current(
&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 default_pulse_timings(
&mut self
) -> Result<(), Error<<SPI as FullDuplex<u8>>::Error>>
[src]
pub fn default_pulse_timings(
&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]
pub fn self_check(
&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