modm API documentation
|
#include <modm/driver/color/tcs3472.hpp>
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 ()) | |
modm::ResumableResult< bool > | initialize (Enable_t flags=Enable_PollingMode) |
Power up sensor and start conversions. | |
modm::ResumableResult< bool > | configure (Gain gain=Gain::X1, IntegrationTime int_time=IntegrationTime::MSEC_2_4) |
modm::ResumableResult< bool > | setGain (Gain gain=Gain::X1) |
The gain can be used to adjust the sensitivity of all ADC output channels. | |
modm::ResumableResult< bool > | setIntegrationTime (IntegrationTime int_time=tcs3472::IntegrationTime::MSEC_2_4) |
Sets the integration time for the ADCs. | |
modm::ResumableResult< bool > | setWaitTime (WaitTime wait_time, bool wait_long=false) |
Sets the wait time for the ADCs. | |
modm::ResumableResult< bool > | setInterruptLowThreshold (uint16_t threshold) |
Sets the low threshold for the interrupt-comparator. | |
modm::ResumableResult< bool > | setInterruptHighThreshold (uint16_t threshold) |
Sets the high threshold for the interrupt-comparator. | |
modm::ResumableResult< bool > | setInterruptPersistenceFilter (InterruptPersistence value) |
The gain can be used to adjust the sensitivity of all ADC output channels. | |
modm::ResumableResult< bool > | reloadInterrupt () |
Resets the interrupt output. | |
modm::ResumableResult< bool > | readColor () |
Read current samples of ADC conversions for all channels. | |
modm::ResumableResult< bool > | readRegisters (RegisterAddress address, uint8_t *values, uint8_t count=1) |
modm::ResumableResult< bool > | writeRegister (RegisterAddress address, uint8_t value) |
Data & | getData () |
void | attachConfigurationHandler (I2c::ConfigurationHandler handler) |
modm::ResumableResult< bool > | ping () |
modm::ResumableResult< bool > | read (uint8_t *buffer, std::size_t size) |
Starts a write transaction and waits until finished. | |
void | setAddress (uint8_t address) |
modm::ResumableResult< bool > | write (const uint8_t *buffer, std::size_t size) |
Starts a write transaction and waits until finished. | |
modm::ResumableResult< 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) |
Protected Member Functions | |
modm::ResumableResult< ReturnType > resumable | function (...) |
int8_t | getResumableDepth () const |
bool | isResumableRunning () const |
bool | isTransactionRunning () |
modm::ResumableResult< bool > | runTransaction () |
Starts our own transaction and waits until finished. | |
bool | startRead (uint8_t *buffer, std::size_t size) |
Configures the transaction with a read operation and starts it. | |
bool | startTransaction () |
Starts the transaction with our own transaction object. | |
bool | startTransaction (modm::I2cTransaction *transaction) |
Starts the transaction with a separate transaction object. | |
bool | startWrite (const uint8_t *buffer, std::size_t size) |
Configures the transaction with a write operation and starts it. | |
bool | startWriteRead (const uint8_t *writeBuffer, std::size_t writeSize, uint8_t *readBuffer, std::size_t readSize) |
Configures the transaction with a write/read operation and starts it. | |
void | stopResumable () |
Force all resumable functions to stop running at the current nesting level. | |
bool | wasTransactionSuccessful () |
Protected Attributes | |
Data & | data |
uint8_t | buffer [2] |
I2cWriteReadTransaction | transaction |
TCS3472X Digital Color Sensors
|
inlinestaticconstexpr |
Device Address depends on version TCS3472x
|
inheritedinline |
Attaches a configuration handler, which is called before a transaction, whenever the configuration has to be changed.
|
inherited |
Run the resumable function.
You need to implement this method in you subclass yourself.
NestingError
if still running, <=NestingError
if it has finished.
|
inheritedinline |
|
inheritedinline |
true
if a resumable function is running at the current nesting level, else false
|
inheritedinlineprotected |
true
when transaction is busy.
|
inheritedinline |
true | device responds to address |
false | no device with address found |
|
inheritedinline |
Sets a new address of the slave device.
address | the slave address not yet shifted left (address < 128). |
|
inheritedinlineprotected |
true
when transaction did not return an error.