pub struct Tcs3400<I2C> { /* private fields */ }
Expand description
TCS3400 device driver.
Implementations
sourceimpl<I2C, E> Tcs3400<I2C>where
I2C: Write<Error = E>,
impl<I2C, E> Tcs3400<I2C>where
I2C: Write<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.78ms
. - 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.03s
. Seeenable_wait_long()
anddisable_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.78ms
.
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<E>>
pub fn set_rgbc_interrupt_persistence(
&mut self,
persistence: RgbCInterruptPersistence
) -> Result<(), Error<E>>
Set the RGB converter interrupt persistence.
This controls the RGB converter interrupt generation rate.
sourceimpl<I2C, E> Tcs3400<I2C>where
I2C: WriteRead<Error = E>,
impl<I2C, E> Tcs3400<I2C>where
I2C: WriteRead<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:
0x90
=>TCS34001 & TCS34005
0x93
=>TCS34003 & TCS34007