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

Method readStatus

libraries/SHT31/SHT31.cpp:139–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

unittestFunction · 0.45

Calls 1

crc8Function · 0.85

Tested by 1

unittestFunction · 0.36