MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / readStatus

Method readStatus

libraries/SHT85/SHT85.cpp:141–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139
140
141uint16_t SHT::readStatus()
142{
143 uint8_t status[3] = { 0, 0, 0 };
144 // page 13 datasheet
145 if (writeCmd(SHT_READ_STATUS) == false)
146 {
147 return 0xFFFF;
148 }
149 // 16 bit status + CRC
150 if (readBytes(3, (uint8_t*) &status[0]) == false)
151 {
152 return 0xFFFF;
153 }
154
155 if (status[2] != crc8(status, 2))
156 {
157 _error = SHT_ERR_CRC_STATUS;
158 return 0xFFFF;
159 }
160
161 return (uint16_t) (status[0] << 8) + status[1];
162}
163
164
165bool SHT::reset(bool hard)

Callers 1

unittestFunction · 0.45

Calls 1

crc8Function · 0.85

Tested by 1

unittestFunction · 0.36