Skip to content

Commit

Permalink
tweak memory alloc and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
caternuson committed Sep 2, 2021
1 parent 15b521f commit 5cc6f12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion Adafruit_CCS811.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "Adafruit_CCS811.h"

Adafruit_CCS811::~Adafruit_CCS811(void) {
if (i2c_dev)
delete i2c_dev;
}

/**************************************************************************/
/*!
@brief Setups the I2C interface and hardware and checks for communication.
Expand All @@ -10,7 +15,8 @@
*/
/**************************************************************************/
bool Adafruit_CCS811::begin(uint8_t addr, TwoWire *theWire) {

if (i2c_dev)
delete i2c_dev;
i2c_dev = new Adafruit_I2CDevice(addr, theWire);
if (!i2c_dev->begin()) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_CCS811.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Adafruit_CCS811 {
public:
// constructors
Adafruit_CCS811(void){};
~Adafruit_CCS811(void){};
~Adafruit_CCS811(void);

bool begin(uint8_t addr = CCS811_ADDRESS, TwoWire *theWire = &Wire);

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit CCS811 Library
version=1.1.0
version=1.1.1
author=Adafruit
maintainer=Adafruit <[email protected]>
sentence=This is a library for the Adafruit CCS811 I2C gas sensor breakout.
Expand Down

0 comments on commit 5cc6f12

Please sign in to comment.