Arslan Test
Dependencies: AMS_ENS210_temp_humid_sensor
Diff: AMS_CCS811.cpp
- Revision:
- 11:ef2d4258cd15
- Parent:
- 10:225a71ec316c
- Child:
- 12:45065badca0f
--- a/AMS_CCS811.cpp Tue Jan 24 11:33:47 2017 +0000 +++ b/AMS_CCS811.cpp Tue Jan 24 14:08:52 2017 +0000 @@ -1,12 +1,13 @@ #include "AMS_CCS811.h" +#include "messageParse.h" -AMS_CCS811::AMS_CCS811(I2C * i2c, PinName n_wake_pin) { +AMS_CCS811::AMS_CCS811(I2C * i2c, PinName n_wake_pin) : _n_wake_out(), _addr_out(), _int_data(), _ens210(), i2c() { _n_wake_out = new (std::nothrow) DigitalOut(n_wake_pin, 1); _i2c = i2c; } -AMS_CCS811::AMS_CCS811(I2C * i2c, PinName n_wake_pin, I2C * ens210_i2c) { +AMS_CCS811::AMS_CCS811(I2C * i2c, PinName n_wake_pin, I2C * ens210_i2c) : _n_wake_out(), _addr_out(), _int_data(), _ens210(), i2c() { _n_wake_out = new (std::nothrow) DigitalOut(n_wake_pin, 1); _i2c = i2c; ens210_i2c_interface(ens210_i2c); @@ -51,7 +52,9 @@ } bool AMS_CCS811::ens210_i2c_interface(I2C * i2c) { + bool success; + if (_ens210 == NULL) { _ens210 = new (std::nothrow) AMS_ENS210(i2c, true, true); if (_ens210 != NULL) {