Skip to content

Commit 7a328be

Browse files
authored
Merge pull request #2 from Sensirion/stcc4_3.3.0_20250613_0914
Generate STCC4 driver from STCC4 model version 3.3.0
2 parents 8ee04e6 + 753950e commit 7a328be

File tree

10 files changed

+38
-65
lines changed

10 files changed

+38
-65
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
### Added
99

10-
- Support STCC4 I2C interfaces as described in Datasheet.
10+
- Initial support for STCC4.
1111

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ Use the following pin description to connect your STCC4 to the standard I²C bus
4444

4545
| *Pin* | *Cable Color* | *Name* | *Description* | *Comments* |
4646
|-------|---------------|:------:|----------------|------------|
47-
| 1 | yellow | SCL | I2C: Serial clock input |
48-
| 2 | black | GND | Ground |
49-
| 3 | red | VDD | Supply Voltage | 3.3V
50-
| 4 | green | SDA | I2C: Serial data input / output |
47+
| 1 | black | GND | Ground |
48+
| 2 | red | VDD | Supply Voltage | 2.7V to 5.5V
49+
| 3 | green | SDA | I2C: Serial data input / output |
50+
| 4 | yellow | SCL | I2C: Serial clock input |
5151

5252

5353

@@ -64,10 +64,10 @@ You will find pinout schematics for recommended board models below:
6464

6565
| *STCC4* | *STCC4 Pin* | *Cable Color* | *Board Pin* |
6666
| :---: | --- | --- | --- |
67-
| SCL | 1 | yellow | D19/SCL |
68-
| GND | 2 | black | GND |
69-
| VDD | 3 | red | 3.3V |
70-
| SDA | 4 | green | D18/SDA |
67+
| GND | 1 | black | GND |
68+
| VDD | 2 | red | 3.3V |
69+
| SDA | 3 | green | D18/SDA |
70+
| SCL | 4 | yellow | D19/SCL |
7171

7272

7373

@@ -83,10 +83,10 @@ You will find pinout schematics for recommended board models below:
8383

8484
| *STCC4* | *STCC4 Pin* | *Cable Color* | *Board Pin* |
8585
| :---: | --- | --- | --- |
86-
| SCL | 1 | yellow | A5 |
87-
| GND | 2 | black | GND |
88-
| VDD | 3 | red | 3.3V |
89-
| SDA | 4 | green | A4 |
86+
| GND | 1 | black | GND |
87+
| VDD | 2 | red | 3.3V |
88+
| SDA | 3 | green | A4 |
89+
| SCL | 4 | yellow | A5 |
9090

9191

9292

@@ -102,10 +102,10 @@ You will find pinout schematics for recommended board models below:
102102

103103
| *STCC4* | *STCC4 Pin* | *Cable Color* | *Board Pin* |
104104
| :---: | --- | --- | --- |
105-
| SCL | 1 | yellow | ~D3/SCL |
106-
| GND | 2 | black | GND |
107-
| VDD | 3 | red | 3.3V |
108-
| SDA | 4 | green | D2/SDA |
105+
| GND | 1 | black | GND |
106+
| VDD | 2 | red | 3.3V |
107+
| SDA | 3 | green | D2/SDA |
108+
| SCL | 4 | yellow | ~D3/SCL |
109109

110110

111111

@@ -121,10 +121,10 @@ You will find pinout schematics for recommended board models below:
121121

122122
| *STCC4* | *STCC4 Pin* | *Cable Color* | *Board Pin* |
123123
| :---: | --- | --- | --- |
124-
| SCL | 1 | yellow | D21/SCL |
125-
| GND | 2 | black | GND |
126-
| VDD | 3 | red | 3.3V |
127-
| SDA | 4 | green | D20/SDA |
124+
| GND | 1 | black | GND |
125+
| VDD | 2 | red | 3.3V |
126+
| SDA | 3 | green | D20/SDA |
127+
| SCL | 4 | yellow | D21/SCL |
128128

129129

130130

@@ -140,10 +140,10 @@ You will find pinout schematics for recommended board models below:
140140

141141
| *STCC4* | *STCC4 Pin* | *Cable Color* | *Board Pin* |
142142
| :---: | --- | --- | --- |
143-
| SCL | 1 | yellow | GPIO 22 |
144-
| GND | 2 | black | GND |
145-
| VDD | 3 | red | 3V3 |
146-
| SDA | 4 | green | GPIO 21 |
143+
| GND | 1 | black | GND |
144+
| VDD | 2 | red | 3V3 |
145+
| SDA | 3 | green | GPIO 21 |
146+
| SCL | 4 | yellow | GPIO 22 |
147147

148148

149149

examples/exampleUsage/exampleUsage.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generator: sensirion-driver-generator 1.2.0
55
* Product: stcc4
6-
* Model-Version: 3.2.0
6+
* Model-Version: 3.3.0
77
*/
88
/*
99
* Copyright (c) 2025, Sensirion AG

examples/exampleUsageSingleShot/exampleUsageSingleShot.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generator: sensirion-driver-generator 1.2.0
55
* Product: stcc4
6-
* Model-Version: 3.2.0
6+
* Model-Version: 3.3.0
77
*/
88
/*
99
* Copyright (c) 2025, Sensirion AG

images/STCC4.png

-213 KB
Loading

images/STCC4_pinout.png

135 KB
Loading

keywords.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ exitSleepMode KEYWORD2
2929
enableTestingMode KEYWORD2
3030
disableTestingMode KEYWORD2
3131
performFactoryReset KEYWORD2
32-
reinit KEYWORD2
3332
signalTemperature KEYWORD2
3433
signalRelativeHumidity KEYWORD2
3534

metadata.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# driver generation metadata
22
generator_version: 1.2.0
3-
model_version: 3.2.0
3+
model_version: 3.3.0
44
dg_status: released
55
is_manually_modified: false
66
first_generated: '2025-02-24 11:47'
7-
last_generated: '2025-05-21 10:56'
7+
last_generated: '2025-06-13 09:14'

src/SensirionI2cStcc4.cpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generator: sensirion-driver-generator 1.2.0
55
* Product: stcc4
6-
* Model-Version: 3.2.0
6+
* Model-Version: 3.3.0
77
*/
88
/*
99
* Copyright (c) 2025, Sensirion AG
@@ -157,18 +157,18 @@ int16_t SensirionI2cStcc4::measureSingleShot() {
157157
if (localError != NO_ERROR) {
158158
return localError;
159159
}
160-
delay(350);
160+
delay(500);
161161
return localError;
162162
}
163163

164164
int16_t
165-
SensirionI2cStcc4::performForcedRecalibration(uint16_t targetCO2Concentration,
166-
uint16_t& frcCorrection) {
165+
SensirionI2cStcc4::performForcedRecalibration(int16_t targetCO2Concentration,
166+
int16_t& frcCorrection) {
167167
int16_t localError = NO_ERROR;
168168
uint8_t* buffer_ptr = communication_buffer;
169169
SensirionI2CTxFrame txFrame =
170170
SensirionI2CTxFrame::createWithUInt16Command(0x362f, buffer_ptr, 5);
171-
localError |= txFrame.addUInt16(targetCO2Concentration);
171+
localError |= txFrame.addInt16(targetCO2Concentration);
172172
if (localError != NO_ERROR) {
173173
return localError;
174174
}
@@ -184,7 +184,7 @@ SensirionI2cStcc4::performForcedRecalibration(uint16_t targetCO2Concentration,
184184
if (localError != NO_ERROR) {
185185
return localError;
186186
}
187-
localError |= rxFrame.getUInt16(frcCorrection);
187+
localError |= rxFrame.getInt16(frcCorrection);
188188
return localError;
189189
}
190190

@@ -358,20 +358,6 @@ int16_t SensirionI2cStcc4::performFactoryReset(uint16_t& factoryResetResult) {
358358
return localError;
359359
}
360360

361-
int16_t SensirionI2cStcc4::reinit() {
362-
int16_t localError = NO_ERROR;
363-
uint8_t* buffer_ptr = communication_buffer;
364-
SensirionI2CTxFrame txFrame =
365-
SensirionI2CTxFrame::createWithUInt16Command(0x3646, buffer_ptr, 2);
366-
localError =
367-
SensirionI2CCommunication::sendFrame(_i2cAddress, txFrame, *_i2cBus);
368-
if (localError != NO_ERROR) {
369-
return localError;
370-
}
371-
delay(10);
372-
return localError;
373-
}
374-
375361
void SensirionI2cStcc4::begin(TwoWire& i2cBus, uint8_t i2cAddress) {
376362
_i2cBus = &i2cBus;
377363
_i2cAddress = i2cAddress;

src/SensirionI2cStcc4.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generator: sensirion-driver-generator 1.2.0
55
* Product: stcc4
6-
* Model-Version: 3.2.0
6+
* Model-Version: 3.3.0
77
*/
88
/*
99
* Copyright (c) 2025, Sensirion AG
@@ -60,7 +60,6 @@ typedef enum {
6060
STCC4_ENABLE_TESTING_MODE_CMD_ID = 0x3fbc,
6161
STCC4_DISABLE_TESTING_MODE_CMD_ID = 0x3f3d,
6262
STCC4_PERFORM_FACTORY_RESET_CMD_ID = 0x3632,
63-
STCC4_REINIT_CMD_ID = 0x3646,
6463
} STCC4CmdId;
6564

6665
class SensirionI2cStcc4 {
@@ -204,8 +203,8 @@ class SensirionI2cStcc4 {
204203
*
205204
* @return error_code 0 on success, an error code otherwise.
206205
*/
207-
int16_t performForcedRecalibration(uint16_t targetCO2Concentration,
208-
uint16_t& frcCorrection);
206+
int16_t performForcedRecalibration(int16_t targetCO2Concentration,
207+
int16_t& frcCorrection);
209208

210209
/**
211210
* @brief Read the sensor's 32-bit product id and 64-bit serial number.
@@ -377,17 +376,6 @@ class SensirionI2cStcc4 {
377376
*/
378377
int16_t performFactoryReset(uint16_t& factoryResetResult);
379378

380-
/**
381-
* @brief Reinitializes the sensor.
382-
*
383-
* The reinit command reinitializes the sensor by reloading settings from
384-
* the EEPROM. The sensor must be in the idle state before sending the
385-
* reinit command
386-
*
387-
* @return error_code 0 on success, an error code otherwise.
388-
*/
389-
int16_t reinit();
390-
391379
/**
392380
* @brief signalTemperature
393381
*

0 commit comments

Comments
 (0)