[−][src]Struct hrs3300::Hrs3300
HRS3300 device driver
Methods
impl<I2C> Hrs3300<I2C>
[src]
pub fn new(i2c: I2C) -> Self
[src]
Create new instance of the HRS3300 device.
pub fn destroy(self) -> I2C
[src]
Destroy driver instance, return I²C bus instance.
impl<I2C, E> Hrs3300<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
[src]
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn init(&mut self) -> Result<(), Error<E>>
[src]
Initialize the status of registers
A custom initialization can also be achieved using write_register()
directly.
pub fn enable_hrs(&mut self) -> Result<(), Error<E>>
[src]
Enable the heart-rate sensor (HRS).
pub fn disable_hrs(&mut self) -> Result<(), Error<E>>
[src]
Disable the heart-rate sensor (HRS).
pub fn enable_oscillator(&mut self) -> Result<(), Error<E>>
[src]
Enable the oscillator.
pub fn disable_oscillator(&mut self) -> Result<(), Error<E>>
[src]
Enable the oscillator.
pub fn set_conversion_delay(
&mut self,
delay: ConversionDelay
) -> Result<(), Error<E>>
[src]
&mut self,
delay: ConversionDelay
) -> Result<(), Error<E>>
Set the HRS conversion delay (waiting time between conversion cycles)
pub fn set_gain(&mut self, gain: Gain) -> Result<(), Error<E>>
[src]
Set the HRS ADC gain
pub fn set_als_resolution(
&mut self,
resolution: AlsResolution
) -> Result<(), Error<E>>
[src]
&mut self,
resolution: AlsResolution
) -> Result<(), Error<E>>
Set the ambient light sensor ADC resolution
pub fn set_led_current(&mut self, current: LedCurrent) -> Result<(), Error<E>>
[src]
Set the LED driver current
pub fn device_id(&mut self) -> Result<u8, Error<E>>
[src]
Read the device ID (0x21).
pub fn read_hrs(&mut self) -> Result<u32, Error<E>>
[src]
Read heart rate sensor measurement (CH0)
pub fn read_als(&mut self) -> Result<u32, Error<E>>
[src]
Read ambient light sensor measurement (CH1)
pub fn write_register(
&mut self,
register: u8,
value: u8
) -> Result<(), Error<E>>
[src]
&mut self,
register: u8,
value: u8
) -> Result<(), Error<E>>
Custom register write.
This can be used to do a custom initialization, for example.
pub fn read_register(&mut self, register: u8) -> Result<u8, Error<E>>
[src]
Custom register read.
Trait Implementations
Auto Trait Implementations
impl<I2C> RefUnwindSafe for Hrs3300<I2C> where
I2C: RefUnwindSafe,
I2C: RefUnwindSafe,
impl<I2C> Send for Hrs3300<I2C> where
I2C: Send,
I2C: Send,
impl<I2C> Sync for Hrs3300<I2C> where
I2C: Sync,
I2C: Sync,
impl<I2C> Unpin for Hrs3300<I2C> where
I2C: Unpin,
I2C: Unpin,
impl<I2C> UnwindSafe for Hrs3300<I2C> where
I2C: UnwindSafe,
I2C: UnwindSafe,
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>,