[−][src]Struct veml6030::Veml6030
VEML6030 device driver
Methods
impl<I2C> Veml6030<I2C>
[src]
pub fn new(i2c: I2C, address: SlaveAddr) -> Self
[src]
Create new instance of the VEML6030 device.
pub fn destroy(self) -> I2C
[src]
Destroy driver instance, return I²C bus instance.
impl<I2C, E> Veml6030<I2C> where
I2C: Write<Error = E>,
[src]
I2C: Write<Error = E>,
pub fn enable(&mut self) -> Result<(), Error<E>>
[src]
Enable the device.
Note that when activating the sensor a wait time of 4 ms should be observed before the first measurement is picked up to allow for a correct start of the signal processor and oscillator.
pub fn disable(&mut self) -> Result<(), Error<E>>
[src]
Disable the device (shutdown).
pub fn set_integration_time(
&mut self,
it: IntegrationTime
) -> Result<(), Error<E>>
[src]
&mut self,
it: IntegrationTime
) -> Result<(), Error<E>>
Set the integration time.
pub fn set_gain(&mut self, gain: Gain) -> Result<(), Error<E>>
[src]
Set the gain.
pub fn set_fault_count(&mut self, fc: FaultCount) -> Result<(), Error<E>>
[src]
Set the number of times a threshold crossing must happen consecutively to trigger an interrupt.
pub fn enable_interrupts(&mut self) -> Result<(), Error<E>>
[src]
Enable interrupt generation.
pub fn disable_interrupts(&mut self) -> Result<(), Error<E>>
[src]
Disable interrupt generation.
pub fn set_high_threshold_raw(&mut self, threshold: u16) -> Result<(), Error<E>>
[src]
Set the ALS high threshold in raw format
pub fn set_low_threshold_raw(&mut self, threshold: u16) -> Result<(), Error<E>>
[src]
Set the ALS low threshold in raw format
pub fn set_high_threshold_lux(&mut self, lux: f32) -> Result<(), Error<E>>
[src]
Set the ALS high threshold in lux.
For values higher than 1000 lx and 1/4 or 1/8 gain, the inverse of the compensation formula is applied (this involves quite some math).
pub fn set_low_threshold_lux(&mut self, lux: f32) -> Result<(), Error<E>>
[src]
Set the ALS low threshold in lux.
For values higher than 1000 lx and 1/4 or 1/8 gain, the inverse of the compensation formula is applied (this involves quite some math).
pub fn calculate_raw_threshold_value(&self, lux: f32) -> u16
[src]
Calculate raw value for threshold applying compensation if necessary.
This takes into consideration the configured integration time and gain and compensates the lux value if necessary.
For values higher than 1000 lx and 1/4 or 1/8 gain, the inverse of the compensation formula is applied. This involves quite some math so it may be interesting to calculate the threshold values ahead of time.
pub fn enable_power_saving(
&mut self,
psm: PowerSavingMode
) -> Result<(), Error<E>>
[src]
&mut self,
psm: PowerSavingMode
) -> Result<(), Error<E>>
Enable the power-saving mode
pub fn disable_power_saving(&mut self) -> Result<(), Error<E>>
[src]
Disable the power-saving mode
impl<I2C, E> Veml6030<I2C> where
I2C: WriteRead<Error = E>,
[src]
I2C: WriteRead<Error = E>,
pub fn read_interrupt_status(&mut self) -> Result<InterruptStatus, Error<E>>
[src]
Read whether an interrupt has occurred.
Note that the interrupt status is updated at the same rate as the measurements. Once triggered, flags will stay true until a measurement is taken which does not exceed the threshold.
pub fn read_raw(&mut self) -> Result<u16, Error<E>>
[src]
Read ALS high resolution output data in raw format
pub fn read_lux(&mut self) -> Result<f32, Error<E>>
[src]
Read ALS high resolution output data converted to lux
For values higher than 1000 lx and 1/4 or 1/8 gain,
the following compensation formula is applied:
lux = 6.0135e-13*(lux^4) - 9.3924e-9*(lux^3) + 8.1488e-5*(lux^2) + 1.0023*lux
pub fn convert_raw_als_to_lux(&self, raw_als: u16) -> f32
[src]
Calculate lux value for a raw ALS measurement.
This takes into consideration the configured integration time and gain and compensates the lux value if necessary.
For values higher than 1000 lx and 1/4 or 1/8 gain,
the following compensation formula is applied:
lux = 6.0135e-13*(lux^4) - 9.3924e-9*(lux^3) + 8.1488e-5*(lux^2) + 1.0023*lux
pub fn read_white(&mut self) -> Result<u16, Error<E>>
[src]
Read white channel measurement
Trait Implementations
Auto Trait Implementations
impl<I2C> RefUnwindSafe for Veml6030<I2C> where
I2C: RefUnwindSafe,
I2C: RefUnwindSafe,
impl<I2C> Send for Veml6030<I2C> where
I2C: Send,
I2C: Send,
impl<I2C> Sync for Veml6030<I2C> where
I2C: Sync,
I2C: Sync,
impl<I2C> Unpin for Veml6030<I2C> where
I2C: Unpin,
I2C: Unpin,
impl<I2C> UnwindSafe for Veml6030<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>,