20 namespace duds {
namespace hardware {
namespace devices {
namespace instruments {
50 for (
int attempts = 2; attempts >= 0; --attempts) {
52 std::this_thread::sleep_for(std::chrono::milliseconds(10));
64 std::uint16_t data[4];
71 if (data[0] != 0x304) {
116 t = (std::int16_t)data[2];
125 (
double)
t / 10.0 + 273.15,
A container for a value and a unit to better describe the value.
ConversationVector & addInputVector(std::size_t len)
Creates a new ConversationVector for fixed length input and initializes it with the given length...
std::uint16_t rh
Relative humidity.
bool bigEndian() const
True if this part is flagged as having data in big-endian form.
std::unique_ptr< duds::hardware::interface::I2c > com
The I2C communication interface.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
std::int16_t t
Temperature.
Represents an SI unit, either base or derived.
duds::hardware::interface::Conversation wake
Used to awaken the device; needed initially and after 3 or more seconds of not talking to the device...
duds::data::Quantity relHumidity() const
Returns the unitless relative humidity quantity.
Base class for all errors specific to I2C communications and used for very general errors...
duds::data::Quantity temperature() const
Returns the temperature in Kelvin.
AM2320(std::unique_ptr< duds::hardware::interface::I2c > &c)
Only address is 0x5C.
An attempt was made to use a device that seems to exist, but the responding device is not the type th...
ConversationVector & addOutputVector()
Creates a new ConversationVector for output and returns it for modification.
duds::hardware::interface::Conversation read
Used to read in sampled data from the device.
void sample()
Reads in the last sample and causes the device to start another sample.
#define DUDS_THROW_EXCEPTION(x)
Works like BOOST_THROW_EXCEPTION, but includes a stack trace if DUDS_ERRORS_VERBOSE is defined...
constexpr Unit Kelvin(DUDS_UNIT_VALUE(0, 0, 1, 0, 0, 0, 0, 0, 0))