Struct tcs3472::Tcs3472 [−][src]
TCS3472 device driver.
Implementations
impl<I2C, E> Tcs3472<I2C> where
I2C: Write<Error = E>,
[src]
I2C: Write<Error = E>,
pub fn enable(&mut self) -> Result<(), Error<E>>
[src]
Enable the device (Power ON).
The device goes to idle state.
pub fn disable(&mut self) -> Result<(), Error<E>>
[src]
Disable the device (sleep).
pub fn enable_rgbc(&mut self) -> Result<(), Error<E>>
[src]
Enable the RGB converter.
pub fn disable_rgbc(&mut self) -> Result<(), Error<E>>
[src]
Disable the RGB converter.
pub fn enable_rgbc_interrupts(&mut self) -> Result<(), Error<E>>
[src]
Enable the RGB converter interrupt generation.
pub fn disable_rgbc_interrupts(&mut self) -> Result<(), Error<E>>
[src]
Disable the RGB converter interrupt generation.
pub fn enable_wait(&mut self) -> Result<(), Error<E>>
[src]
Enable the wait feature (wait timer).
pub fn disable_wait(&mut self) -> Result<(), Error<E>>
[src]
Disable the wait feature (wait timer).
pub fn set_wait_cycles(&mut self, cycles: u16) -> Result<(), Error<E>>
[src]
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
. Seeenable_wait_long()
anddisable_wait_long()
.
pub fn enable_wait_long(&mut self) -> Result<(), Error<E>>
[src]
Enable the wait long setting.
The wait time configured with set_wait_cycles()
is increased by a
factor of 12. See set_wait_cycles()
.
pub fn disable_wait_long(&mut self) -> Result<(), Error<E>>
[src]
Disable the wait long setting.
The wait time configured with set_wait_cycles()
is used without
multiplication factor. See set_wait_cycles()
.
pub fn set_rgbc_gain(&mut self, gain: RgbCGain) -> Result<(), Error<E>>
[src]
Set the RGB converter gain.
pub fn set_integration_cycles(&mut self, cycles: u16) -> Result<(), Error<E>>
[src]
Set the number of integration cycles (1-256).
The actual integration time corresponds to: number_of_cycles * 2.4ms
.
pub fn set_rgbc_interrupt_low_threshold(
&mut self,
threshold: u16
) -> Result<(), Error<E>>
[src]
&mut self,
threshold: u16
) -> Result<(), Error<E>>
Set the RGB converter interrupt clear channel low threshold.
pub fn set_rgbc_interrupt_high_threshold(
&mut self,
threshold: u16
) -> Result<(), Error<E>>
[src]
&mut self,
threshold: u16
) -> Result<(), Error<E>>
Set the RGB converter interrupt clear channel high threshold.
pub fn set_rgbc_interrupt_persistence(
&mut self,
persistence: RgbCInterruptPersistence
) -> Result<(), Error<E>>
[src]
&mut self,
persistence: RgbCInterruptPersistence
) -> Result<(), Error<E>>
Set the RGB converter interrupt persistence.
This controls the RGB converter interrupt generation rate.
impl<I2C, E> Tcs3472<I2C> where
I2C: WriteRead<Error = E>,
[src]
I2C: WriteRead<Error = E>,
pub fn is_rgbc_status_valid(&mut self) -> Result<bool, Error<E>>
[src]
Check whether the RGB converter status is valid.
Indicates that the RGBC channels have completed an integration cycle.
pub fn read_clear_channel(&mut self) -> Result<u16, Error<E>>
[src]
Read the clear (unfiltered) channel measurement data.
pub fn read_red_channel(&mut self) -> Result<u16, Error<E>>
[src]
Read the red channel measurement data.
pub fn read_green_channel(&mut self) -> Result<u16, Error<E>>
[src]
Read the green channel measurement data.
pub fn read_blue_channel(&mut self) -> Result<u16, Error<E>>
[src]
Read the blue channel measurement data.
pub fn read_all_channels(&mut self) -> Result<AllChannelMeasurement, Error<E>>
[src]
Read the measurement data of all channels at once.
pub fn read_device_id(&mut self) -> Result<u8, Error<E>>
[src]
Read the device ID.
The value returned corresponds to the part number identification:
0x44
=>TCS34725
0x4D
=>TCS34727
impl<I2C, E> Tcs3472<I2C> where
I2C: Write<Error = E>,
[src]
I2C: Write<Error = E>,
pub fn new(i2c: I2C) -> Self
[src]
Create new instance of the TCS3472 device.
pub fn destroy(self) -> I2C
[src]
Destroy driver instance, return I²C bus instance.
Trait Implementations
Auto Trait Implementations
impl<I2C> RefUnwindSafe for Tcs3472<I2C> where
I2C: RefUnwindSafe,
I2C: RefUnwindSafe,
impl<I2C> Send for Tcs3472<I2C> where
I2C: Send,
I2C: Send,
impl<I2C> Sync for Tcs3472<I2C> where
I2C: Sync,
I2C: Sync,
impl<I2C> Unpin for Tcs3472<I2C> where
I2C: Unpin,
I2C: Unpin,
impl<I2C> UnwindSafe for Tcs3472<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,
pub 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.
pub 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>,