14 namespace duds {
namespace hardware {
namespace devices {
namespace instruments {
26 if ((chk & 0xFF00) != 0x400) {
77 std::int16_t samp =
com->receiveWordBe(5);
78 temp = ((double)duds::general::SignExtend<13>(samp)) / 16.0 + 273.15;
A container for a value and a unit to better describe the value.
char rev
Device's revision byte.
~MCP9808()
Stops sampling.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
char res
The raw data for the configured resolution.
std::unique_ptr< duds::hardware::interface::Smbus > com
Communication bus.
void start()
Begin sampling.
void sample()
Reads sample data from the device.
std::uint16_t config
The configuration word.
duds::data::Quantity temperature() const
Returns the last sampled temperature.
std::uint16_t receiveWordBe(std::uint8_t cmd)
Sends a command byte, then reads a big-endian word from the device.
double temp
Last temperature sample.
boost::error_info< struct Info_smbusdevaddr, int > SmbusDeviceAddr
Provides the device (slave) address along with an error.
MCP9808(std::unique_ptr< duds::hardware::interface::Smbus > &c)
Prepares to use a MCP9808 by identifying the device and reading, but not changing, its current configuration.
double resolutionDegrees() const
Resolution resolution() const
Returns the current sampling resolution.
virtual std::uint8_t receiveByte()=0
Read a single byte from the device without sending a command/register byte first. ...
An attempt was made to use a device that seems to exist, but the responding device is not the type th...
void suspend()
Stop sampling.
#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))