modm API documentation
modm::Tcs3472< I2cMaster > Class Template Reference

#include <modm/driver/color/tcs3472.hpp>

Inheritance diagram for modm::Tcs3472< I2cMaster >:
modm::I2cDevice< I2cMaster >

Classes

struct  Data
 

Public Typedefs

using Rgb = color::RgbT< uint16_t >
 

Public Types

enum  RegisterAddress : uint8_t
 Register addresses.
 
enum  Gain : uint8_t
 Analog rgbc gain control.
 
enum  IntegrationTime : uint8_t
 Light integration time in ms.
 
enum  WaitTime : uint8_t
 Time to wait between samples in ms.
 
enum  InterruptPersistence : uint8_t
 Controls rate of interrupt to the host processor.
 
enum  Enable : uint8_t
 Power-control and feature enable flags.
 

Public Member Functions

 MODM_FLAGS8 (Enable)
 
 Tcs3472 (Data &data, uint8_t address=addr ())
 
bool initialize (Enable_t flags=Enable_PollingMode)
 Power up sensor and start conversions.
 
bool configure (Gain gain=Gain::X1, IntegrationTime int_time=IntegrationTime::MSEC_2_4)
 
bool setGain (Gain gain=Gain::X1)
 The gain can be used to adjust the sensitivity of all ADC output channels.
 
bool setIntegrationTime (IntegrationTime int_time=tcs3472::IntegrationTime::MSEC_2_4)
 Sets the integration time for the ADCs.
 
bool setWaitTime (WaitTime wait_time, bool wait_long=false)
 Sets the wait time for the ADCs.
 
bool setInterruptLowThreshold (uint16_t threshold)
 Sets the low threshold for the interrupt-comparator.
 
bool setInterruptHighThreshold (uint16_t threshold)
 Sets the high threshold for the interrupt-comparator.
 
bool setInterruptPersistenceFilter (InterruptPersistence value)
 The gain can be used to adjust the sensitivity of all ADC output channels.
 
bool reloadInterrupt ()
 Resets the interrupt output.
 
bool readColor ()
 Read current samples of ADC conversions for all channels.
 
bool readRegisters (RegisterAddress address, uint8_t *values, uint8_t count=1)
 
bool writeRegister (RegisterAddress address, uint8_t value)
 
DatagetData ()
 
void attachConfigurationHandler (I2c::ConfigurationHandler handler)
 
bool ping ()
 
bool read (uint8_t *buffer, std::size_t size)
 Starts a write transaction and waits until finished.
 
void setAddress (uint8_t address)
 
bool write (const uint8_t *buffer, std::size_t size)
 Starts a write transaction and waits until finished.
 
bool writeRead (const uint8_t *writeBuffer, std::size_t writeSize, uint8_t *readBuffer, std::size_t readSize)
 Starts a write-read transaction and waits until finished.
 

Static Public Member Functions

static constexpr uint8_t addr (uint8_t version=5)
 

Static Public Attributes

static constexpr Enable_t Enable_PollingMode = Enable::POWER_ON | Enable::ADC_ENABLE
 
static constexpr Enable_t Enable_InterruptMode = Enable_PollingMode | Enable::INTERRUPT_ENABLE
 
static constexpr Enable_t Enable_InterruptMode_Waittime = Enable_InterruptMode | Enable::INTERRUPT_ENABLE
 

Protected Member Functions

bool isTransactionRunning ()
 
bool runTransaction ()
 Starts our own transaction and waits until finished.
 
bool startTransaction ()
 Starts the transaction with our own transaction object.
 
bool startTransaction (modm::I2cTransaction *transaction)
 Starts the transaction with a separate transaction object.
 
bool wasTransactionSuccessful ()
 

Protected Attributes

Datadata
 
uint8_t buffer [2]
 
I2cWriteReadTransaction transaction
 

Detailed Description

template<typename I2cMaster>
class modm::Tcs3472< I2cMaster >

TCS3472X Digital Color Sensors

See also
tcs3472
Author
David Hebbeker, Arjun Sarin, Thomas Sommer, Niklas Hauser

Member Function Documentation

template<typename I2cMaster >
static constexpr uint8_t modm::Tcs3472< I2cMaster >::addr ( uint8_t  version = 5)
inlinestaticconstexpr

Device Address depends on version TCS3472x

  • 1 = 0x39 (with IR filter)
  • 3 = 0x39 (without IR filter)
  • 5 = 0x29 (with IR filter)
  • 7 = 0x29 (without IR filter)
void modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::attachConfigurationHandler ( I2c::ConfigurationHandler  handler)
inheritedinline

Attaches a configuration handler, which is called before a transaction, whenever the configuration has to be changed.

bool modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::isTransactionRunning ( )
inheritedinlineprotected
Returns
true when transaction is busy.
bool modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::ping ( )
inheritedinline
Return Values
truedevice responds to address
falseno device with address found
void modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::setAddress ( uint8_t  address)
inheritedinline

Sets a new address of the slave device.

Parameters
addressthe slave address not yet shifted left (address < 128).
bool modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::wasTransactionSuccessful ( )
inheritedinlineprotected
Returns
true when transaction did not return an error.

The documentation for this class was generated from the following file: