|
M5Unit-COLOR 0.1.1 git rev:9de2836
|
Color recognition unit. More...
#include <unit_TCS3472x.hpp>
Classes | |
| struct | config_t |
| Settings for begin. More... | |
Public Member Functions | |
| UnitTCS3472x (const uint8_t addr=DEFAULT_ADDRESS) | |
| Constructor. | |
| virtual | ~UnitTCS3472x () |
| Destructor. | |
| virtual bool | begin () override |
| Begin communication with the sensor. | |
| virtual void | update (const bool force=false) override |
| Update periodic measurement data. | |
| bool | readStatus (uint8_t &status) |
| Read the status register. | |
Settings for begin | |
| config_t | config () |
| Gets the configuration. | |
| void | config (const config_t &cfg) |
| Set the configuration. | |
Measurement data by periodic | |
| uint8_t | R8 () const |
| Oldest measured Red. | |
| uint8_t | G8 () const |
| Oldest measured Green. | |
| uint8_t | B8 () const |
| Oldest measured Blue. | |
| uint16_t | RGB565 () const |
| Oldest measured RGB565. | |
Settings | |
| bool | readPersistence (tcs3472x::Persistence &pers) |
| Read the persistence. | |
| bool | writePersistence (const tcs3472x::Persistence pers) |
| Write the persistence. | |
| bool | readGain (tcs3472x::Gain &gc) |
| Read the gain control. | |
| bool | writeGain (const tcs3472x::Gain gc) |
| Write the gain control. | |
| bool | readAtime (uint8_t &raw) |
| Read the RGBC integration time (ATIME) | |
| bool | readAtime (float &ms) |
| Read the RGBC integration time (ATIME) | |
| template<typename T , typename std::enable_if< std::is_integral< T >::value, std::nullptr_t >::type = nullptr> | |
| bool | writeAtime (const T raw) |
| Write the RGBC integration time (ATIME) | |
| bool | writeAtime (const float ms) |
| Write the RGBC integration time (ATIME) | |
| bool | readWtime (uint8_t &raw, bool &wlong) |
| Read the wait time (WTIME) | |
| bool | readWtime (float &ms) |
| Read the wait time (WTIME) | |
| bool | writeWtime (const uint8_t raw, const bool wlong) |
| Write the wait time (WTIME) | |
| bool | writeWtime (const float ms) |
| Write the wait time (WTIME) | |
Periodic measurement | |
| bool | startPeriodicMeasurement (const tcs3472x::Gain gc, const float atime, const float wtime) |
| Start periodic measurement. | |
| bool | startPeriodicMeasurement () |
| Start periodic measurement using current settings. | |
| bool | stopPeriodicMeasurement (const bool power_off=true) |
| Stop periodic measurement. | |
Single shot measurement | |
| bool | measureSingleshot (tcs3472x::Data &d, const tcs3472x::Gain gc, const float atime) |
| Measurement single shot. | |
| bool | measureSingleshot (tcs3472x::Data &d) |
| Measurement single shot using current settings. | |
Interrupt | |
| bool | readInterrupt (bool &enable) |
| Read the interrupt status. | |
| bool | writeInterrupt (const bool enable) |
| Write the interrupt status. | |
| bool | readInterruptThreshold (uint16_t &low, uint16_t &high) |
| Read the interrupt thresholds for clear channel. | |
| bool | writeInterruptThreshold (const uint16_t low, const uint16_t high) |
| Write the interrupt thresholds for clear channel. | |
| bool | clearInterrupt () |
| Clear interrupt. | |
Protected Member Functions | |
| virtual bool | is_valid_id (const uint8_t id) |
| bool | read_register8 (const uint8_t reg, uint8_t &val) |
| bool | write_register8 (const uint8_t reg, const uint8_t val) |
| bool | read_register (const uint8_t reg, uint8_t *buf, const uint32_t len) |
| bool | write_register (const uint8_t reg, const uint8_t *buf, const uint32_t len) |
| bool | start_periodic_measurement (const tcs3472x::Gain gc, const float atime, const float wtime) |
| bool | start_periodic_measurement () |
| bool | stop_periodic_measurement (const bool power_off) |
| bool | is_data_ready () |
| bool | read_measurement (tcs3472x::Data &d) |
| bool | write_atime (const uint8_t raw) |
| M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitTCS3472x, tcs3472x::Data) | |
Color recognition unit.
Base class for TCS34725/7
|
inlineexplicit |
Constructor.
| addr | I2C address |
|
overridevirtual |
Begin communication with the sensor.
| bool m5::unit::UnitTCS3472x::measureSingleshot | ( | tcs3472x::Data & | d, |
| const tcs3472x::Gain | gc, | ||
| const float | atime ) |
Measurement single shot.
| [out] | d | Measured data |
| gc | Gain | |
| atime | Integration time(ms) |
| bool m5::unit::UnitTCS3472x::readAtime | ( | float & | ms | ) |
Read the RGBC integration time (ATIME)
| [out] | ms | ATIME in ms |
| bool m5::unit::UnitTCS3472x::readAtime | ( | uint8_t & | raw | ) |
Read the RGBC integration time (ATIME)
| [out] | raw | Raw ATIME value |
| bool m5::unit::UnitTCS3472x::readGain | ( | tcs3472x::Gain & | gc | ) |
Read the gain control.
| [out] | gc | Gain control |
| bool m5::unit::UnitTCS3472x::readInterrupt | ( | bool & | enable | ) |
Read the interrupt status.
| [out] | enable | true if interrupt is enabled |
| bool m5::unit::UnitTCS3472x::readInterruptThreshold | ( | uint16_t & | low, |
| uint16_t & | high ) |
Read the interrupt thresholds for clear channel.
| [out] | low | Low threshold value |
| [out] | high | High threshold value |
| bool m5::unit::UnitTCS3472x::readPersistence | ( | tcs3472x::Persistence & | pers | ) |
Read the persistence.
| [out] | pers | Persistence |
| bool m5::unit::UnitTCS3472x::readStatus | ( | uint8_t & | status | ) |
Read the status register.
| [out] | status | Status register value |
| bool m5::unit::UnitTCS3472x::readWtime | ( | float & | ms | ) |
Read the wait time (WTIME)
| [out] | ms | WTIME in ms |
| bool m5::unit::UnitTCS3472x::readWtime | ( | uint8_t & | raw, |
| bool & | wlong ) |
Read the wait time (WTIME)
| [out] | raw | Raw WTIME value |
| [out] | wlong | x12 longer? |
|
inline |
Start periodic measurement.
| gc | Gain |
| atime | Integration time(ms) |
| wtime | Wait time(ms) |
|
inline |
Stop periodic measurement.
| power_off | To power off if true |
|
overridevirtual |
Update periodic measurement data.
| force | If true, update immediately without waiting for the configured interval |
| bool m5::unit::UnitTCS3472x::writeAtime | ( | const float | ms | ) |
Write the RGBC integration time (ATIME)
| ms | ATIME in ms |
|
inline |
Write the RGBC integration time (ATIME)
| raw | Raw ATIME value |
| bool m5::unit::UnitTCS3472x::writeGain | ( | const tcs3472x::Gain | gc | ) |
Write the gain control.
| gc | Gain control |
| bool m5::unit::UnitTCS3472x::writeInterrupt | ( | const bool | enable | ) |
Write the interrupt status.
| enable | true if interrupt is to be enabled |
| bool m5::unit::UnitTCS3472x::writeInterruptThreshold | ( | const uint16_t | low, |
| const uint16_t | high ) |
Write the interrupt thresholds for clear channel.
| low | Low threshold value |
| high | High threshold value |
| bool m5::unit::UnitTCS3472x::writePersistence | ( | const tcs3472x::Persistence | pers | ) |
Write the persistence.
| pers | Persistence |
| bool m5::unit::UnitTCS3472x::writeWtime | ( | const float | ms | ) |
Write the wait time (WTIME)
| ms | WTIME in ms |
| bool m5::unit::UnitTCS3472x::writeWtime | ( | const uint8_t | raw, |
| const bool | wlong ) |
Write the wait time (WTIME)
| raw | Raw WTIME value |
| wlong | x12 longer? |