|
DUDS
|
Distributed Update of Data from Something
|
A quick try at supporting TSL2591 brightness sensor; will change significantly in the future. More...
#include <TSL2591.hpp>
Public Member Functions | |
| TSL2591 (std::unique_ptr< duds::hardware::interface::I2c > &c) | |
| Attempts to identify the device, then performs a reset. More... | |
| ~TSL2591 () | |
| Calls suspend(). More... | |
| duds::data::Quantity | brightness () const |
| Broad spectrum brightness. More... | |
| std::uint16_t | brightnessCount () const |
| The value reported by the device for the broad spectrum brightness. More... | |
| duds::data::Quantity | brightnessIr () const |
| Brightness mostly in infrared. More... | |
| std::uint16_t | brightnessIrCount () const |
| The value reported by the device for the infrared brightness. More... | |
| void | init (int gain, int integration) |
| Configures the device. More... | |
| void | resume () |
| Resumes operation after a call to suspend(). More... | |
| void | sample () |
| The device will update samples after it has completed integration. More... | |
| void | suspend () |
| Suspends operation by putting the device into a low-power mode. More... | |
Private Attributes | |
| std::uint16_t | broad |
| The values supplied by the device. More... | |
| std::unique_ptr< duds::hardware::interface::I2c > | com |
| The I2C communication interface. More... | |
| duds::hardware::interface::Conversation | initialize |
| The conversation used to initialize the device. More... | |
| duds::hardware::interface::Conversation | input |
| The conversation used to query the brightness values. More... | |
| std::uint16_t | ir |
| double | scale |
| A scalar value used to partially convert the counts supplied by the device into a value in Watts per square meter. More... | |
A quick try at supporting TSL2591 brightness sensor; will change significantly in the future.
Seems to work, except the Quantity values are wrong.
Definition at line 40 of file TSL2591.hpp.
| duds::hardware::devices::instruments::TSL2591::TSL2591 | ( | std::unique_ptr< duds::hardware::interface::I2c > & | c | ) |
Attempts to identify the device, then performs a reset.
This should leave it in a low-power state where it does not sample. Default device address is 0x29.
| DeviceMisidentified | The reported device ID is incorrect. |
Definition at line 81 of file TSL2591.cpp.
| duds::hardware::devices::instruments::TSL2591::~TSL2591 | ( | ) |
Calls suspend().
Definition at line 123 of file TSL2591.cpp.
| duds::data::Quantity duds::hardware::devices::instruments::TSL2591::brightness | ( | ) | const |
Broad spectrum brightness.
Includes visible and infrared.
Definition at line 180 of file TSL2591.cpp.
|
inline |
The value reported by the device for the broad spectrum brightness.
Definition at line 121 of file TSL2591.hpp.
| duds::data::Quantity duds::hardware::devices::instruments::TSL2591::brightnessIr | ( | ) | const |
Brightness mostly in infrared.
Definition at line 191 of file TSL2591.cpp.
|
inline |
The value reported by the device for the infrared brightness.
Definition at line 135 of file TSL2591.hpp.
| void duds::hardware::devices::instruments::TSL2591::init | ( | int | gain, |
| int | integration | ||
| ) |
Configures the device.
| gain | The gain mode to use. 0 is the lowest gain, and 3 is the highest. The factors are listed as:
|
| integration | The integration time. It may be specified in milliseconds with values between 100 and 600. Only increments of 100ms can be used; values between these increments will be reduced to the next lowest value. The time may also be specified as a value between 0 (100ms) and 5 (600ms). |
| TSL2591BadGain | |
| TSL2591BadIntegration |
Definition at line 127 of file TSL2591.cpp.
| void duds::hardware::devices::instruments::TSL2591::resume | ( | ) |
Resumes operation after a call to suspend().
| DeviceUninitalized | init() hasn't been called. |
Definition at line 165 of file TSL2591.cpp.
| void duds::hardware::devices::instruments::TSL2591::sample | ( | ) |
The device will update samples after it has completed integration.
Sampling faster than that will read old values, but not bad data.
Definition at line 172 of file TSL2591.cpp.
| void duds::hardware::devices::instruments::TSL2591::suspend | ( | ) |
Suspends operation by putting the device into a low-power mode.
Definition at line 155 of file TSL2591.cpp.
Referenced by ~TSL2591().
|
private |
The values supplied by the device.
Definition at line 65 of file TSL2591.hpp.
Referenced by brightness(), and sample().
|
private |
|
private |
|
private |
The conversation used to query the brightness values.
It is created once in the constructor to avoid recreating it.
Definition at line 54 of file TSL2591.hpp.
|
private |
Definition at line 65 of file TSL2591.hpp.
Referenced by brightnessIr(), and sample().
|
private |
A scalar value used to partially convert the counts supplied by the device into a value in Watts per square meter.
It takes into account the gain and integration settings.
Definition at line 61 of file TSL2591.hpp.
Referenced by brightness(), brightnessIr(), and init().