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

Method getBaseline

libraries/SGP30/SGP30.cpp:304–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302
303
304bool SGP30::getBaseline(uint16_t *CO2, uint16_t *TVOC)
305{
306 _command(0x2015);
307 if (_wire->requestFrom(_address, (uint8_t)6) != 6)
308 {
309 _error = SGP30_ERROR_I2C;
310 return false;
311 }
312 *CO2 = _wire->read() << 8;
313 *CO2 += _wire->read();
314 uint8_t crc = _wire->read();
315 if (_CRC8(*CO2) != crc)
316 {
317 _error = SGP30_ERROR_CRC;
318 return false;
319 }
320 *TVOC = _wire->read() << 8;
321 *TVOC += _wire->read();
322 crc = _wire->read();
323 if (_CRC8(*TVOC) != crc)
324 {
325 _error = SGP30_ERROR_CRC;
326 return false;
327 }
328 _error = SGP30_OK;
329 return true;
330}
331
332
333void SGP30::setTVOCBaseline(uint16_t TVOC)

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected