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

Method readRaw

libraries/SGP30/SGP30.cpp:219–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217
218
219bool SGP30::readRaw()
220{
221 if (_lastRequest == 0) return false;
222 if (millis() - _lastRequest < 26) return false; // Page 11
223 _lastRequest = 0;
224
225 if (_wire->requestFrom(_address, (uint8_t)6) != 6)
226 {
227 _error = SGP30_ERROR_I2C;
228 return false;
229 }
230 _h2 = _wire->read() << 8;
231 _h2 += _wire->read();
232 uint8_t crc = _wire->read();
233 if (_CRC8(_h2) != crc)
234 {
235 _error = SGP30_ERROR_CRC;
236 return false;
237 }
238 _ethanol = _wire->read() << 8;
239 _ethanol += _wire->read();
240 crc = _wire->read();
241 if (_CRC8(_ethanol) != crc)
242 {
243 _error = SGP30_ERROR_CRC;
244 return false;
245 }
246 _error = SGP30_OK;
247 return true;
248}
249
250
251// experimental - datasheet Page 2

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected