Loading include/driver/scd4x.h +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ class SCD4x { void startLowPower(); void read(); bool read(); }; extern SCD4x scd4x; Loading src/app/datalogger/main.cc +13 −8 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ void loop(void) #endif #ifdef CONFIG_driver_scd4x scd4x.read(); if (scd4x.read()) { kout << dec << "CO₂: " << scd4x.co2 << " ppm" << endl; kout << "Temperature: "; kout.printf_float(((175.0 * scd4x.rawTemperature) / 65536) - 45); Loading @@ -197,6 +197,9 @@ void loop(void) kout << "Humidity: "; kout.printf_float((100.0 * scd4x.rawHumidity) / 65536); kout << " %" << endl; } else { kout << "SCD4x error" << endl; } #endif #ifdef CONFIG_driver_veml6075 Loading Loading @@ -301,7 +304,9 @@ int main(void) #endif #ifdef CONFIG_driver_mpu9250 kout << "MPU9250 init" << endl; mpu9250.init(); kout << "MPU9250 nineAxis" << endl; mpu9250.nineAxis(); #endif Loading src/driver/scd4x.cc +7 −5 Original line number Diff line number Diff line Loading @@ -32,16 +32,18 @@ void SCD4x::startLowPower() i2c.xmit(address, 2, txbuf, 0, rxbuf); } void SCD4x::read() bool SCD4x::read() { txbuf[0] = 0xec; txbuf[1] = 0x05; if (i2c.xmit(address, 2, txbuf, 9, rxbuf) == 0) { if (i2c.xmit(address, 2, txbuf, 9, rxbuf)) { return false; } co2 = (rxbuf[0] << 8) + rxbuf[1]; rawTemperature = ((rxbuf[3] << 8) + rxbuf[4]); rawHumidity = (rxbuf[6] << 8) + rxbuf[7]; } return true; } SCD4x scd4x; Loading
include/driver/scd4x.h +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ class SCD4x { void startLowPower(); void read(); bool read(); }; extern SCD4x scd4x; Loading
src/app/datalogger/main.cc +13 −8 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ void loop(void) #endif #ifdef CONFIG_driver_scd4x scd4x.read(); if (scd4x.read()) { kout << dec << "CO₂: " << scd4x.co2 << " ppm" << endl; kout << "Temperature: "; kout.printf_float(((175.0 * scd4x.rawTemperature) / 65536) - 45); Loading @@ -197,6 +197,9 @@ void loop(void) kout << "Humidity: "; kout.printf_float((100.0 * scd4x.rawHumidity) / 65536); kout << " %" << endl; } else { kout << "SCD4x error" << endl; } #endif #ifdef CONFIG_driver_veml6075 Loading Loading @@ -301,7 +304,9 @@ int main(void) #endif #ifdef CONFIG_driver_mpu9250 kout << "MPU9250 init" << endl; mpu9250.init(); kout << "MPU9250 nineAxis" << endl; mpu9250.nineAxis(); #endif Loading
src/driver/scd4x.cc +7 −5 Original line number Diff line number Diff line Loading @@ -32,16 +32,18 @@ void SCD4x::startLowPower() i2c.xmit(address, 2, txbuf, 0, rxbuf); } void SCD4x::read() bool SCD4x::read() { txbuf[0] = 0xec; txbuf[1] = 0x05; if (i2c.xmit(address, 2, txbuf, 9, rxbuf) == 0) { if (i2c.xmit(address, 2, txbuf, 9, rxbuf)) { return false; } co2 = (rxbuf[0] << 8) + rxbuf[1]; rawTemperature = ((rxbuf[3] << 8) + rxbuf[4]); rawHumidity = (rxbuf[6] << 8) + rxbuf[7]; } return true; } SCD4x scd4x;