Skip to content

Commit

Permalink
Generate SEN66 driver from SEN66 model version 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Driver Generator 2 committed Dec 3, 2024
1 parent e896141 commit 745ad67
Show file tree
Hide file tree
Showing 10 changed files with 282 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/arduino_quality_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: sensirion/.github/.github/workflows/driver.arduino.check.yml@main
with:
expect-arduino-examples: true
lint-lib-manager-check: submit
lint-lib-manager-check: update

todo-check:
if: github.event_name == 'push' && github.ref != 'refs/head/main'
Expand Down
103 changes: 103 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
stages:
- validate
- test

variables:
YQ_URL: https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_amd64

compile_test:
stage: test
image:
name: registry.gitlab.sensirion.lokal/sensirion/docker/docker-arduino:0.4.0
tags: [docker, linux]
before_script:
- rm -rf ../sensirion-core-arduino-library
script:
- git clone --depth 1 --branch 0.7.0 https://github.com/Sensirion/arduino-core.git ../sensirion-core-arduino-library
- arduino-cli compile --libraries=".." --warnings all --fqbn arduino:samd:mkrzero ./examples/exampleUsage/exampleUsage.ino
- arduino-cli compile --libraries=".." --warnings all --fqbn arduino:avr:mega ./examples/exampleUsage/exampleUsage.ino
- arduino-cli compile --libraries=".." --warnings all --fqbn arduino:avr:nano ./examples/exampleUsage/exampleUsage.ino
- arduino-cli compile --libraries=".." --warnings all --fqbn arduino:avr:uno ./examples/exampleUsage/exampleUsage.ino
- arduino-cli compile --libraries=".." --warnings all --fqbn esp32:esp32:esp32 ./examples/exampleUsage/exampleUsage.ino
- arduino-cli compile --libraries=".." --warnings all --fqbn esp8266:esp8266:generic ./examples/exampleUsage/exampleUsage.ino

arduino_lint:
stage: validate
image:
name: registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0
tags: [linux, docker]
script:
- mkdir ~/arlint
- PATH=~/arlint:$PATH
- curl -fsSL https://raw.githubusercontent.com/arduino/arduino-lint/main/etc/install.sh | BINDIR=~/arlint sh
- arduino-lint --library-manager false

syntax_check:
stage: validate
image:
name: registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0
tags: [linux, docker]
script:
- find . -type f -iregex ".*\.\(c\|h\|cpp\|ino\)" -exec clang-format-6.0 -i -style=file {} \; && git diff --exit-code


cppcheck:
stage: validate
image:
name: registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0
tags: [linux, docker]
script:
- cppcheck --std=c++11 --language=c++ --error-exitcode=1 --enable=warning,style,performance,portability --suppress=unreadVariable --suppress=unusedStructMember src/*

TODO_check:
stage: validate
image:
name: registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0
tags: [linux, docker]
script:
- '! grep -rnw --exclude=.gitlab-ci.yml --exclude-dir=.git . -e "TODO"'

metadata_check:
stage: validate
image:
name: registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0
tags: [linux, docker]
before_script:
- apt-get -qq update && apt-get -qq install -y wget
- if ! [ -d downloads/ ]; then mkdir downloads; fi
- if ! [ -e downloads/yq ]; then wget --no-verbose $YQ_URL -O downloads/yq; fi
- cp downloads/yq /usr/local/bin/yq && chmod +x /usr/local/bin/yq
script:
# check if metadata.yml exists
- >
if ! [ -f "metadata.yml" ]; then
echo "metadata.yml file not found"
exit 1
fi
# check that dg_status is 'released'
- export DG_STATUS=$(yq ".dg_status.[]" ./metadata.yml)
- >
if [ $DG_STATUS != "released" ]; then
echo "dg_status in metadata.yml has to be 'released', not '$DG_STATUS'"
exit 1
fi
# check that last_generated is not older than timestamp of last non-merge commit (+ 3 minutes)
- export IS_MANUALLY_MODIFIED=$(yq ".is_manually_modified" ./metadata.yml)
- >
if [ $IS_MANUALLY_MODIFIED = false ]; then
export LAST_GENERATED_TS=$(yq ".last_generated" ./metadata.yml)
export LAST_GENERATED_TS_EPOCH=$(date -d "$LAST_GENERATED_TS" +%s)
export LAST_NON_MERGE_COMMIT_TS=$(git log --format=%ad --date=iso-strict --no-merges -1)
export COMMIT_TS_EPOCH=$(date -d "$LAST_NON_MERGE_COMMIT_TS" +%s)
if [ $(($LAST_GENERATED_TS_EPOCH + 180)) -lt $COMMIT_TS_EPOCH ]; then
echo "'last_generated' timestamp in metadata.yml is older than commit timestamp ($LAST_GENERATED_TS vs $LAST_NON_MERGE_COMMIT_TS)"
exit 1
fi
fi
# check that 'is_manually_modified' is set to true if commit is not from driver generator
- export LAST_NON_MERGE_COMMIT_AUTHOR=$(git log --format=%an --no-merges -1)
- >
if ! [ "$LAST_NON_MERGE_COMMIT_AUTHOR" = "Driver Generator 2" ] && [ "$IS_MANUALLY_MODIFIED" = false ]; then
echo "Last commit is not from Driver Generator. Please update 'is_manually_modified' in metadata.yml"
exit 1
fi
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.0.1] - 2024-12-1

### Fixed

- Fix naming from mass concentration to number concentration for read number concentration method (returned values were correct).
## [1.0.0] - 2024-11-25

### Added
Expand All @@ -21,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add interfaces to start, stop and read measurements.
- Add interfaces to read product name, serial number and version

[Unreleased]: https://github.com/Sensirion/arduino-i2c-sen66/compare/1.0.0...HEAD
[Unreleased]: https://github.com/Sensirion/arduino-i2c-sen66/compare/1.0.1...HEAD
[1.0.1]: https://github.com/Sensirion/arduino-i2c-sen66/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/Sensirion/arduino-i2c-sen66/compare/0.1.0...1.0.0
[0.1.0]: https://github.com/Sensirion/arduino-i2c-sen66/releases/tag/0.1.0
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ Use the following pin description to connect your SEN66 to the standard I²C bus

| *Pin* | *Cable Color* | *Name* | *Description* | *Comments* |
|-------|---------------|:------:|----------------|------------|
| 1 | red | VDD | Supply Voltage | 3.3V ±10%
| 1 | red | VDD | Supply Voltage | 3.3V ±5%
| 2 | black | GND | Ground |
| 3 | green | SDA | I2C: Serial data input / output | TTL 5V compatible
| 4 | yellow | SCL | I2C: Serial clock input | TTL 5V compatible
| 5 | | NC | Do not connect |
| 6 | | NC | Do not connect |
| 5 | | GND | Ground | Do not connect (Pins 2 and 5 are connected internally)
| 6 | | VDD | Supply Voltage | Do not connect (Pins 1 and 6 are connected internally)



Expand All @@ -69,6 +69,8 @@ You will find pinout schematics for recommended board models below:
| GND | 2 | black | GND |
| SDA | 3 | green | D18/SDA |
| SCL | 4 | yellow | D19/SCL |
| GND | 5 | | GND |
| VDD | 6 | | 3.3V |



Expand All @@ -88,6 +90,8 @@ You will find pinout schematics for recommended board models below:
| GND | 2 | black | GND |
| SDA | 3 | green | A4 |
| SCL | 4 | yellow | A5 |
| GND | 5 | | GND |
| VDD | 6 | | 3.3V |



Expand All @@ -107,6 +111,8 @@ You will find pinout schematics for recommended board models below:
| GND | 2 | black | GND |
| SDA | 3 | green | D2/SDA |
| SCL | 4 | yellow | ~D3/SCL |
| GND | 5 | | GND |
| VDD | 6 | | 3.3V |



Expand All @@ -126,6 +132,8 @@ You will find pinout schematics for recommended board models below:
| GND | 2 | black | GND |
| SDA | 3 | green | D20/SDA |
| SCL | 4 | yellow | D21/SCL |
| GND | 5 | | GND |
| VDD | 6 | | 3.3V |



Expand All @@ -145,6 +153,8 @@ You will find pinout schematics for recommended board models below:
| GND | 2 | black | GND |
| SDA | 3 | green | GPIO 21 |
| SCL | 4 | yellow | GPIO 22 |
| GND | 5 | | GND |
| VDD | 6 | | 3V3 |



Expand Down
2 changes: 1 addition & 1 deletion examples/exampleUsage/exampleUsage.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Generator: sensirion-driver-generator 1.0.1
* Product: sen66
* Model-Version: 1.3.0
* Model-Version: 1.3.1
*/
/*
* Copyright (c) 2024, Sensirion AG
Expand Down
6 changes: 5 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ getSerialNumber KEYWORD2
readDeviceStatus KEYWORD2
readAndClearDeviceStatus KEYWORD2
deviceReset KEYWORD2
signalMassConcentrationPm0p5 KEYWORD2
signalMassConcentrationPm1p0 KEYWORD2
signalMassConcentrationPm2p5 KEYWORD2
signalMassConcentrationPm4p0 KEYWORD2
signalMassConcentrationPm10p0 KEYWORD2
signalNumberConcentrationPm0p5 KEYWORD2
signalNumberConcentrationPm1p0 KEYWORD2
signalNumberConcentrationPm2p5 KEYWORD2
signalNumberConcentrationPm4p0 KEYWORD2
signalNumberConcentrationPm10p0 KEYWORD2
signalTemperature KEYWORD2
signalHumidity KEYWORD2
signalVocIndex KEYWORD2
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=Sensirion I2C SEN66
version=1.0.0
version=1.0.1
author=Sensirion
maintainer=Sensirion
sentence=Library for the SEN66 sensor by Sensirion
Expand Down
6 changes: 3 additions & 3 deletions metadata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# driver generation metadata
generator_version: 1.0.1
model_version: 1.3.0
model_version: 1.3.1
dg_status: released
is_manually_modified: true
is_manually_modified: false
first_generated: '2024-10-30 08:14'
last_generated: '2024-11-27 07:57'
last_generated: '2024-12-03 09:56'
97 changes: 65 additions & 32 deletions src/SensirionI2cSen66.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Generator: sensirion-driver-generator 1.0.1
* Product: sen66
* Model-Version: 1.3.0
* Model-Version: 1.3.1
*/
/*
* Copyright (c) 2024, Sensirion AG
Expand Down Expand Up @@ -50,13 +50,6 @@ static uint8_t communication_buffer[48] = {0};
SensirionI2cSen66::SensirionI2cSen66() {
}

float SensirionI2cSen66::signalMassConcentrationPm0p5(
uint16_t massConcentrationPm0p5Raw) {
float massConcentrationPm0p5 = 0.0;
massConcentrationPm0p5 = massConcentrationPm0p5Raw / 10.0;
return massConcentrationPm0p5;
}

float SensirionI2cSen66::signalMassConcentrationPm1p0(
uint16_t massConcentrationPm1p0Raw) {
float massConcentrationPm1p0 = 0.0;
Expand Down Expand Up @@ -85,6 +78,41 @@ float SensirionI2cSen66::signalMassConcentrationPm10p0(
return massConcentrationPm10p0;
}

float SensirionI2cSen66::signalNumberConcentrationPm0p5(
uint16_t numberConcentrationPm0p5Raw) {
float numberConcentrationPm0p5 = 0.0;
numberConcentrationPm0p5 = numberConcentrationPm0p5Raw / 10.0;
return numberConcentrationPm0p5;
}

float SensirionI2cSen66::signalNumberConcentrationPm1p0(
uint16_t numberConcentrationPm1p0Raw) {
float numberConcentrationPm1p0 = 0.0;
numberConcentrationPm1p0 = numberConcentrationPm1p0Raw / 10.0;
return numberConcentrationPm1p0;
}

float SensirionI2cSen66::signalNumberConcentrationPm2p5(
uint16_t numberConcentrationPm2p5Raw) {
float numberConcentrationPm2p5 = 0.0;
numberConcentrationPm2p5 = numberConcentrationPm2p5Raw / 10.0;
return numberConcentrationPm2p5;
}

float SensirionI2cSen66::signalNumberConcentrationPm4p0(
uint16_t numberConcentrationPm4p0Raw) {
float numberConcentrationPm4p0 = 0.0;
numberConcentrationPm4p0 = numberConcentrationPm4p0Raw / 10.0;
return numberConcentrationPm4p0;
}

float SensirionI2cSen66::signalNumberConcentrationPm10p0(
uint16_t numberConcentrationPm10p0Raw) {
float numberConcentrationPm10p0 = 0.0;
numberConcentrationPm10p0 = numberConcentrationPm10p0Raw / 10.0;
return numberConcentrationPm10p0;
}

float SensirionI2cSen66::signalTemperature(int16_t temperatureRaw) {
float temperature = 0.0;
temperature = temperatureRaw / 200.0;
Expand Down Expand Up @@ -154,32 +182,37 @@ int16_t SensirionI2cSen66::readMeasuredValues(
}

int16_t SensirionI2cSen66::readNumberConcentrationValues(
float& massConcentrationPm0p5, float& massConcentrationPm1p0,
float& massConcentrationPm2p5, float& massConcentrationPm4p0,
float& massConcentrationPm10p0) {
uint16_t massConcentrationPm0p5Raw = 0;
uint16_t massConcentrationPm1p0Raw = 0;
uint16_t massConcentrationPm2p5Raw = 0;
uint16_t massConcentrationPm4p0Raw = 0;
uint16_t massConcentrationPm10p0Raw = 0;
float& numberConcentrationPm0p5, float& numberConcentrationPm1p0,
float& numberConcentrationPm2p5, float& numberConcentrationPm4p0,
float& numberConcentrationPm10p0) {
uint16_t numberConcentrationPm0p5Raw = 0;
uint16_t numberConcentrationPm1p0Raw = 0;
uint16_t numberConcentrationPm2p5Raw = 0;
uint16_t numberConcentrationPm4p0Raw = 0;
uint16_t numberConcentrationPm10p0Raw = 0;
int16_t localError = 0;
localError = readNumberConcentrationValuesAsIntegers(
massConcentrationPm0p5Raw, massConcentrationPm1p0Raw,
massConcentrationPm2p5Raw, massConcentrationPm4p0Raw,
massConcentrationPm10p0Raw);
if (localError != NO_ERROR) {
return localError;
}
massConcentrationPm0p5 = SensirionI2cSen66::signalMassConcentrationPm0p5(
massConcentrationPm0p5Raw);
massConcentrationPm1p0 = SensirionI2cSen66::signalMassConcentrationPm1p0(
massConcentrationPm1p0Raw);
massConcentrationPm2p5 = SensirionI2cSen66::signalMassConcentrationPm2p5(
massConcentrationPm2p5Raw);
massConcentrationPm4p0 = SensirionI2cSen66::signalMassConcentrationPm4p0(
massConcentrationPm4p0Raw);
massConcentrationPm10p0 = SensirionI2cSen66::signalMassConcentrationPm10p0(
massConcentrationPm10p0Raw);
numberConcentrationPm0p5Raw, numberConcentrationPm1p0Raw,
numberConcentrationPm2p5Raw, numberConcentrationPm4p0Raw,
numberConcentrationPm10p0Raw);
if (localError != NO_ERROR) {
return localError;
}
numberConcentrationPm0p5 =
SensirionI2cSen66::signalNumberConcentrationPm0p5(
numberConcentrationPm0p5Raw);
numberConcentrationPm1p0 =
SensirionI2cSen66::signalNumberConcentrationPm1p0(
numberConcentrationPm1p0Raw);
numberConcentrationPm2p5 =
SensirionI2cSen66::signalNumberConcentrationPm2p5(
numberConcentrationPm2p5Raw);
numberConcentrationPm4p0 =
SensirionI2cSen66::signalNumberConcentrationPm4p0(
numberConcentrationPm4p0Raw);
numberConcentrationPm10p0 =
SensirionI2cSen66::signalNumberConcentrationPm10p0(
numberConcentrationPm10p0Raw);
return localError;
}

Expand Down
Loading

0 comments on commit 745ad67

Please sign in to comment.