Skip to content

Commit 3a25055

Browse files
2.0.0
Implements the ScioSense core libraries, separates C drivers and Arduino wrappers
2 parents 4747a17 + 1ab68e1 commit 3a25055

30 files changed

+1600
-1180
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ monitoring, offering an unrivalled wealth of fully-processed outputs including l
88

99
## Links
1010
* [ENS160 Datasheet](https://www.sciosense.com/wp-content/uploads/2023/12/ENS160-Datasheet.pdf)
11-
* [ENS161 Datasheet](https://www.sciosense.com/wp-content/uploads/2023/12/ENS161-Datasheet.pdf)
11+
* [ENS161 Datasheet](https://www.sciosense.com/wp-content/uploads/2024/12/ENS161-Datasheet.pdf)
1212
* [Further information about the ENS16x family](https://www.sciosense.com/ens16x-digital-metal-oxide-multi-gas-sensor-family/)
1313
* Buy the ENS161 on [Mouser](https://mou.sr/3NSRp0K) or [another distributor](https://www.sciosense.com/contact/)
1414
* Buy the ENS161 evaluation kit on [Mouser](https://mou.sr/3vxi5xJ) or [another distributor](https://www.sciosense.com/contact/)

examples/01_Basic/ENS160/ENS160.ino

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
#include <Wire.h>
33
#include <ScioSense_ENS16x.h>
44

5-
#include "ens16x_i2c_interface.h"
6-
7-
using namespace ScioSense;
8-
95
#define I2C_ADDRESS 0x52
10-
I2cInterface i2c;
116

127
#define USE_INTERRUPT
138
#define INTN 2
@@ -20,10 +15,10 @@ void setup()
2015
ens160.enableDebugging(Serial);
2116

2217
Wire.begin();
23-
i2c.begin(Wire, I2C_ADDRESS);
18+
ens160.begin(&Wire, I2C_ADDRESS);
2419

2520
Serial.println("begin..");
26-
while (ens160.begin(&i2c) != true)
21+
while (ens160.init() != true)
2722
{
2823
Serial.print(".");
2924
delay(1000);
@@ -34,9 +29,9 @@ void setup()
3429
ens160.setInterruptPin(INTN);
3530
ens160.writeConfiguration
3631
(
37-
ENS160::Configuration::InterruptEnable
38-
| ENS160::Configuration::NewGeneralPurposeData
39-
| ENS160::Configuration::NewData
32+
ENS16X_CONFIGURATION_INTERRUPT_ENABLE
33+
| ENS16X_CONFIGURATION_NEW_GENERAL_PURPOSE_DATA
34+
| ENS16X_CONFIGURATION_NEW_DATA
4035
);
4136
#endif
4237

@@ -49,24 +44,22 @@ void loop()
4944

5045
// Enable Tools->Serial Plotter to see the sensor output as a graph
5146

52-
if (ens160.update() == ENS16x::Result::Ok)
47+
if (ens160.update() == RESULT_OK)
5348
{
54-
if (hasFlag(ens160.getDeviceStatus(), ENS16x::DeviceStatus::NewData))
49+
if (ens160.hasNewData())
5550
{
5651
Serial.print("AQI UBA:"); Serial.print((uint8_t)ens160.getAirQualityIndex_UBA());
5752

5853
Serial.print("\tTVOC:"); Serial.print(ens160.getTvoc());
5954
Serial.print("\tECO2:"); Serial.println(ens160.getEco2());
6055
}
6156

62-
if (hasFlag(ens160.getDeviceStatus(), ENS16x::DeviceStatus::NewGeneralPurposeData))
57+
if (ens160.hasNewGeneralPurposeData())
6358
{
6459
Serial.print("RS0:"); Serial.print(ens160.getRs0());
6560
Serial.print("\tRS1:"); Serial.print(ens160.getRs1());
6661
Serial.print("\tRS2:"); Serial.print(ens160.getRs2());
6762
Serial.print("\tRS3:"); Serial.println(ens160.getRs3());
6863
}
69-
70-
7164
}
7265
}

examples/01_Basic/ENS160/ens16x_i2c_interface.h

Lines changed: 0 additions & 89 deletions
This file was deleted.

examples/01_Basic/ENS161/ENS161.ino

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
#include <Wire.h>
33
#include <ScioSense_ENS16x.h>
44

5-
#include "ens16x_i2c_interface.h"
6-
7-
using namespace ScioSense;
8-
95
#define I2C_ADDRESS 0x52
10-
I2cInterface i2c;
116

127
#define USE_INTERRUPT
138
#define INTN 2
@@ -20,10 +15,10 @@ void setup()
2015
ens161.enableDebugging(Serial);
2116

2217
Wire.begin();
23-
i2c.begin(Wire, I2C_ADDRESS);
18+
ens161.begin(&Wire, I2C_ADDRESS);
2419

2520
Serial.println("begin..");
26-
while (ens161.begin(&i2c) != true)
21+
while (ens161.init() != true)
2722
{
2823
Serial.print(".");
2924
delay(1000);
@@ -34,9 +29,9 @@ void setup()
3429
ens161.setInterruptPin(INTN);
3530
ens161.writeConfiguration
3631
(
37-
ENS161::Configuration::InterruptEnable
38-
| ENS161::Configuration::NewGeneralPurposeData
39-
| ENS161::Configuration::NewData
32+
ENS16X_CONFIGURATION_INTERRUPT_ENABLE
33+
| ENS16X_CONFIGURATION_NEW_GENERAL_PURPOSE_DATA
34+
| ENS16X_CONFIGURATION_NEW_DATA
4035
);
4136
#endif
4237

@@ -49,24 +44,22 @@ void loop()
4944

5045
// Enable Tools->Serial Plotter to see the sensor output as a graph
5146

52-
if (ens161.update() == ENS16x::Result::Ok)
47+
if (ens161.update() == RESULT_OK)
5348
{
54-
if (hasFlag(ens161.getDeviceStatus(), ENS16x::DeviceStatus::NewData))
49+
if (ens161.hasNewData())
5550
{
5651
Serial.print("AQI UBA:"); Serial.print((uint8_t)ens161.getAirQualityIndex_UBA());
5752

5853
Serial.print("\tTVOC:"); Serial.print(ens161.getTvoc());
5954
Serial.print("\tECO2:"); Serial.println(ens161.getEco2());
6055
}
6156

62-
if (hasFlag(ens161.getDeviceStatus(), ENS16x::DeviceStatus::NewGeneralPurposeData))
57+
if (ens161.hasNewGeneralPurposeData())
6358
{
6459
Serial.print("RS0:"); Serial.print(ens161.getRs0());
6560
Serial.print("\tRS1:"); Serial.print(ens161.getRs1());
6661
Serial.print("\tRS2:"); Serial.print(ens161.getRs2());
6762
Serial.print("\tRS3:"); Serial.println(ens161.getRs3());
6863
}
69-
70-
7164
}
7265
}

examples/01_Basic/ENS161/ens16x_i2c_interface.h

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)