Skip to content

Commit 9380c48

Browse files
committed
refactor(ens161): rename class and usage to ENS16x
1 parent 338d38f commit 9380c48

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

src/components/i2c/WipperSnapper_I2C.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,16 +352,16 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
352352
WS_DEBUG_PRINTLN("DS2484 Initialized Successfully!");
353353
} else if ((strcmp("ens160", msgDeviceInitReq->i2c_device_name) == 0) ||
354354
(strcmp("ens161", msgDeviceInitReq->i2c_device_name) == 0)) {
355-
_ens160 = new WipperSnapper_I2C_Driver_ENS160(this->_i2c, i2cAddress);
356-
if (!_ens160->begin()) {
357-
WS_DEBUG_PRINTLN("ERROR: Failed to initialize ENS160!");
355+
_ens16x = new WipperSnapper_I2C_Driver_ENS16x(this->_i2c, i2cAddress);
356+
if (!_ens16x->begin()) {
357+
WS_DEBUG_PRINTLN("ERROR: Failed to initialize ENS16x!");
358358
_busStatusResponse =
359359
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
360360
return false;
361361
}
362-
_ens160->configureDriver(msgDeviceInitReq);
363-
drivers.push_back(_ens160);
364-
WS_DEBUG_PRINTLN("ENS160 Initialized Successfully!");
362+
_ens16x->configureDriver(msgDeviceInitReq);
363+
drivers.push_back(_ens16x);
364+
WS_DEBUG_PRINTLN("ENS16x Initialized Successfully!");
365365
} else if (strcmp("hdc302x", msgDeviceInitReq->i2c_device_name) == 0) {
366366
_hdc302x = new WipperSnapper_I2C_Driver_HDC302X(this->_i2c, i2cAddress);
367367
if (!_hdc302x->begin()) {

src/components/i2c/WipperSnapper_I2C.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class WipperSnapper_Component_I2C {
167167
WipperSnapper_I2C_Driver_D6T1A *_d6t1a = nullptr;
168168
WipperSnapper_I2C_Driver_DPS310 *_dps310 = nullptr;
169169
WipperSnapper_I2C_Driver_DS2484 *_ds2484 = nullptr;
170-
WipperSnapper_I2C_Driver_ENS160 *_ens160 = nullptr;
170+
WipperSnapper_I2C_Driver_ENS16x *_ens16x = nullptr;
171171
WipperSnapper_I2C_Driver_SCD30 *_scd30 = nullptr;
172172
WipperSnapper_I2C_Driver_BH1750 *_bh1750 = nullptr;
173173
WipperSnapper_I2C_Driver_BME280 *_bme280 = nullptr;

src/components/i2c/drivers/WipperSnapper_I2C_Driver_ENS160.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
2-
* @file WipperSnapper_I2C_Driver_ENS160.h
2+
* @file WipperSnapper_I2C_Driver_ENS16X.h
33
*
4-
* Device driver for a ENS160 MOX Gas Sensor.
4+
* Device driver for a ENS160/ENS161 MOX Gas Sensor.
55
*
66
* Adafruit invests time and resources providing this open source code,
77
* please support Adafruit and open-source hardware by purchasing
@@ -13,8 +13,8 @@
1313
*
1414
*/
1515

16-
#ifndef WipperSnapper_I2C_Driver_ENS160_H
17-
#define WipperSnapper_I2C_Driver_ENS160_H
16+
#ifndef WipperSnapper_I2C_Driver_ENS16X_H
17+
#define WipperSnapper_I2C_Driver_ENS16X_H
1818

1919
#include "WipperSnapper_I2C_Driver.h"
2020
#include <ScioSense_ENS160.h>
@@ -23,38 +23,38 @@
2323

2424
/**************************************************************************/
2525
/*!
26-
@brief Class that provides a sensor driver for the ENS160 temperature
27-
and humidity sensor.
26+
@brief Class that provides a sensor driver for the ENS16x temperature
27+
and humidity sensors.
2828
*/
2929
/**************************************************************************/
30-
class WipperSnapper_I2C_Driver_ENS160 : public WipperSnapper_I2C_Driver {
30+
class WipperSnapper_I2C_Driver_ENS16x : public WipperSnapper_I2C_Driver {
3131

3232
public:
3333
/*******************************************************************************/
3434
/*!
35-
@brief Constructor for an ENS160 sensor.
35+
@brief Constructor for an ENS16x sensor.
3636
@param i2c
3737
The I2C interface.
3838
@param sensorAddress
3939
7-bit device address.
4040
*/
4141
/*******************************************************************************/
42-
WipperSnapper_I2C_Driver_ENS160(TwoWire *i2c, uint16_t sensorAddress)
42+
WipperSnapper_I2C_Driver_ENS16x(TwoWire *i2c, uint16_t sensorAddress)
4343
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
4444
_i2c = i2c;
4545
_sensorAddress = sensorAddress;
4646
}
4747

4848
/*******************************************************************************/
4949
/*!
50-
@brief Destructor for an ENS160 sensor.
50+
@brief Destructor for an ENS16x sensor.
5151
*/
5252
/*******************************************************************************/
53-
~WipperSnapper_I2C_Driver_ENS160() { delete _ens16x; }
53+
~WipperSnapper_I2C_Driver_ENS16x() { delete _ens16x; }
5454

5555
/*******************************************************************************/
5656
/*!
57-
@brief Initializes the ENS160 sensor and begins I2C.
57+
@brief Initializes the ENS16x sensor and begins I2C.
5858
@returns True if initialized successfully, False otherwise.
5959
*/
6060
/*******************************************************************************/
@@ -84,7 +84,7 @@ class WipperSnapper_I2C_Driver_ENS160 : public WipperSnapper_I2C_Driver {
8484

8585
/*******************************************************************************/
8686
/*!
87-
@brief Reads the ENS160's eCO2 sensor into an event.
87+
@brief Reads the ENS16x's eCO2 sensor into an event.
8888
@param eco2Event
8989
Pointer to an adafruit sensor event.
9090
@returns True if the sensor event was obtained successfully, False
@@ -100,7 +100,7 @@ class WipperSnapper_I2C_Driver_ENS160 : public WipperSnapper_I2C_Driver {
100100

101101
/*******************************************************************************/
102102
/*!
103-
@brief Reads the ENS160's TVOC sensor into an event.
103+
@brief Reads the ENS16x's TVOC sensor into an event.
104104
@param tvocEvent
105105
Pointer to an adafruit sensor event.
106106
@returns True if the sensor event was obtained successfully, False
@@ -116,7 +116,7 @@ class WipperSnapper_I2C_Driver_ENS160 : public WipperSnapper_I2C_Driver {
116116

117117
/*******************************************************************************/
118118
/*!
119-
@brief Reads the ENS160's AQI value into an event.
119+
@brief Reads the ENS16x's AQI value into an event.
120120
@param rawEvent
121121
Pointer to an adafruit sensor event.
122122
@returns True if the sensor event was obtained successfully, False
@@ -131,7 +131,7 @@ class WipperSnapper_I2C_Driver_ENS160 : public WipperSnapper_I2C_Driver {
131131
}
132132

133133
protected:
134-
ScioSense_ENS160 *_ens16x; ///< ENS160/1 object
134+
ScioSense_ENS160 *_ens16x; ///< ENS16x object
135135
};
136136

137-
#endif // WipperSnapper_I2C_Driver_ENS160
137+
#endif // WipperSnapper_I2C_Driver_ENS16X_H

0 commit comments

Comments
 (0)