pub struct Tcs3472<I2C> { /* private fields */ }
Expand description
TCS3472 device driver.
Implementations§
Source§impl<I2C, E> Tcs3472<I2C>where
I2C: I2c<Error = E>,
impl<I2C, E> Tcs3472<I2C>where
I2C: I2c<Error = E>,
Sourcepub fn enable(&mut self) -> Result<(), Error<E>>
pub fn enable(&mut self) -> Result<(), Error<E>>
Enable the device (Power ON).
The device goes to idle state.
Sourcepub fn enable_rgbc(&mut self) -> Result<(), Error<E>>
pub fn enable_rgbc(&mut self) -> Result<(), Error<E>>
Enable the RGB converter.
Sourcepub fn disable_rgbc(&mut self) -> Result<(), Error<E>>
pub fn disable_rgbc(&mut self) -> Result<(), Error<E>>
Disable the RGB converter.
Sourcepub fn enable_rgbc_interrupts(&mut self) -> Result<(), Error<E>>
pub fn enable_rgbc_interrupts(&mut self) -> Result<(), Error<E>>
Enable the RGB converter interrupt generation.
Sourcepub fn disable_rgbc_interrupts(&mut self) -> Result<(), Error<E>>
pub fn disable_rgbc_interrupts(&mut self) -> Result<(), Error<E>>
Disable the RGB converter interrupt generation.
Sourcepub fn enable_wait(&mut self) -> Result<(), Error<E>>
pub fn enable_wait(&mut self) -> Result<(), Error<E>>
Enable the wait feature (wait timer).
Sourcepub fn disable_wait(&mut self) -> Result<(), Error<E>>
pub fn disable_wait(&mut self) -> Result<(), Error<E>>
Disable the wait feature (wait timer).
Sourcepub fn set_wait_cycles(&mut self, cycles: u16) -> Result<(), Error<E>>
pub fn set_wait_cycles(&mut self, cycles: u16) -> Result<(), Error<E>>
Set the number of wait time cycles (1-256).
The actual wait time depends on the “wait long” setting.
- If wait long is disabled, then the wait time corresponds to:
number_of_cycles * 2.4ms
. - If wait long is enabled, then the wait time is increased by a
factor of 12 and therefore corresponds to aproximately:
number_of_cycles * 0.029s
.
See enable_wait_long()
and
disable_wait_long()
.
Sourcepub fn enable_wait_long(&mut self) -> Result<(), Error<E>>
pub fn enable_wait_long(&mut self) -> Result<(), Error<E>>
Enable the wait long setting.
The wait time configured with set_wait_cycles()
is increased by a
factor of 12. See set_wait_cycles()
.
Sourcepub fn disable_wait_long(&mut self) -> Result<(), Error<E>>
pub fn disable_wait_long(&mut self) -> Result<(), Error<E>>
Disable the wait long setting.
The wait time configured with set_wait_cycles()
is used without
multiplication factor. See set_wait_cycles()
.
Sourcepub fn set_rgbc_gain(&mut self, gain: RgbCGain) -> Result<(), Error<E>>
pub fn set_rgbc_gain(&mut self, gain: RgbCGain) -> Result<(), Error<E>>
Set the RGB converter gain.
Sourcepub fn set_integration_cycles(&mut self, cycles: u16) -> Result<(), Error<E>>
pub fn set_integration_cycles(&mut self, cycles: u16) -> Result<(), Error<E>>
Set the number of integration cycles (1-256).
The actual integration time corresponds to: number_of_cycles * 2.4ms
.
Sourcepub fn set_rgbc_interrupt_low_threshold(
&mut self,
threshold: u16,
) -> Result<(), Error<E>>
pub fn set_rgbc_interrupt_low_threshold( &mut self, threshold: u16, ) -> Result<(), Error<E>>
Set the RGB converter interrupt clear channel low threshold.
Sourcepub fn set_rgbc_interrupt_high_threshold(
&mut self,
threshold: u16,
) -> Result<(), Error<E>>
pub fn set_rgbc_interrupt_high_threshold( &mut self, threshold: u16, ) -> Result<(), Error<E>>
Set the RGB converter interrupt clear channel high threshold.
Sourcepub fn set_rgbc_interrupt_persistence(
&mut self,
persistence: RgbCInterruptPersistence,
) -> Result<(), Error<I2C::Error>>
pub fn set_rgbc_interrupt_persistence( &mut self, persistence: RgbCInterruptPersistence, ) -> Result<(), Error<I2C::Error>>
Set the RGB converter interrupt persistence.
This controls the RGB converter interrupt generation rate.
Source§impl<I2C, E> Tcs3472<I2C>where
I2C: I2c<Error = E>,
impl<I2C, E> Tcs3472<I2C>where
I2C: I2c<Error = E>,
Sourcepub fn is_rgbc_status_valid(&mut self) -> Result<bool, Error<E>>
pub fn is_rgbc_status_valid(&mut self) -> Result<bool, Error<E>>
Check whether the RGB converter status is valid.
Indicates that the RGBC channels have completed an integration cycle.
Sourcepub fn read_clear_channel(&mut self) -> Result<u16, Error<E>>
pub fn read_clear_channel(&mut self) -> Result<u16, Error<E>>
Read the clear (unfiltered) channel measurement data.
Sourcepub fn read_red_channel(&mut self) -> Result<u16, Error<E>>
pub fn read_red_channel(&mut self) -> Result<u16, Error<E>>
Read the red channel measurement data.
Sourcepub fn read_green_channel(&mut self) -> Result<u16, Error<E>>
pub fn read_green_channel(&mut self) -> Result<u16, Error<E>>
Read the green channel measurement data.
Sourcepub fn read_blue_channel(&mut self) -> Result<u16, Error<E>>
pub fn read_blue_channel(&mut self) -> Result<u16, Error<E>>
Read the blue channel measurement data.
Sourcepub fn read_all_channels(&mut self) -> Result<AllChannelMeasurement, Error<E>>
pub fn read_all_channels(&mut self) -> Result<AllChannelMeasurement, Error<E>>
Read the measurement data of all channels at once.
Sourcepub fn read_device_id(&mut self) -> Result<u8, Error<E>>
pub fn read_device_id(&mut self) -> Result<u8, Error<E>>
Read the device ID.
The value returned corresponds to the part number identification:
0x44
=>TCS34725
0x4D
=>TCS34727