Skip to content

Commit

Permalink
Merge pull request #3 from Sensirion/sen66_1.3.1_20241203_0956
Browse files Browse the repository at this point in the history
Generate SEN66 driver from SEN66 model version 1.3.1
  • Loading branch information
LeonieFierz authored Dec 3, 2024
2 parents 78a7985 + c780aeb commit 8f939ee
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 77 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/raspberry_quality_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@ on:
jobs:
driver-quality:
uses: sensirion/.github/.github/workflows/driver.c.check.yml@main

todo-check:
if: github.event_name == 'push' && github.ref != 'refs/head/main'
uses: sensirion/.github/.github/workflows/driver.common.todo_check.yml@main
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/raspberry-pi-i2c-sen66/compare/1.0.0...HEAD
[Unreleased]: https://github.com/Sensirion/raspberry-pi-i2c-sen66/compare/1.0.1...HEAD
[1.0.1]: https://github.com/Sensirion/raspberry-pi-i2c-sen66/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/Sensirion/raspberry-pi-i2c-sen66/compare/0.1.0...1.0.0
[0.1.0]: https://github.com/Sensirion/raspberry-pi-i2c-sen66/releases/tag/0.1.0
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ Use the following pins to connect your SEN66:

| *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 | | NC | Do not connect | Ground (Pins 2 and 5 are connected internally)
| 6 | | NC | Do not connect | Supply Voltage (Pins 1 and 6 are connected internally)



Expand Down Expand Up @@ -162,4 +162,4 @@ they are fixed.

## License

See [LICENSE](LICENSE).
See [LICENSE](LICENSE).
2 changes: 1 addition & 1 deletion example-usage/sen66_i2c_example_usage.c
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
4 changes: 2 additions & 2 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: false
first_generated: '2024-10-30 08:14'
last_generated: '2024-11-27 07:57'
last_generated: '2024-12-03 09:56'
86 changes: 57 additions & 29 deletions sen66_i2c.c
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 @@ -51,13 +51,6 @@ void sen66_init(uint8_t i2c_address) {
_i2c_address = i2c_address;
}

float sen66_signal_mass_concentration_pm0p5(
uint16_t mass_concentration_pm0p5_raw) {
float mass_concentration_pm0p5 = 0.0;
mass_concentration_pm0p5 = mass_concentration_pm0p5_raw / 10.0;
return mass_concentration_pm0p5;
}

float sen66_signal_mass_concentration_pm1p0(
uint16_t mass_concentration_pm1p0_raw) {
float mass_concentration_pm1p0 = 0.0;
Expand Down Expand Up @@ -86,6 +79,41 @@ float sen66_signal_mass_concentration_pm10p0(
return mass_concentration_pm10p0;
}

float sen66_signal_number_concentration_pm0p5(
uint16_t number_concentration_pm0p5_raw) {
float number_concentration_pm0p5 = 0.0;
number_concentration_pm0p5 = number_concentration_pm0p5_raw / 10.0;
return number_concentration_pm0p5;
}

float sen66_signal_number_concentration_pm1p0(
uint16_t number_concentration_pm1p0_raw) {
float number_concentration_pm1p0 = 0.0;
number_concentration_pm1p0 = number_concentration_pm1p0_raw / 10.0;
return number_concentration_pm1p0;
}

float sen66_signal_number_concentration_pm2p5(
uint16_t number_concentration_pm2p5_raw) {
float number_concentration_pm2p5 = 0.0;
number_concentration_pm2p5 = number_concentration_pm2p5_raw / 10.0;
return number_concentration_pm2p5;
}

float sen66_signal_number_concentration_pm4p0(
uint16_t number_concentration_pm4p0_raw) {
float number_concentration_pm4p0 = 0.0;
number_concentration_pm4p0 = number_concentration_pm4p0_raw / 10.0;
return number_concentration_pm4p0;
}

float sen66_signal_number_concentration_pm10p0(
uint16_t number_concentration_pm10p0_raw) {
float number_concentration_pm10p0 = 0.0;
number_concentration_pm10p0 = number_concentration_pm10p0_raw / 10.0;
return number_concentration_pm10p0;
}

float sen66_signal_temperature(int16_t temperature_raw) {
float temperature = 0.0;
temperature = temperature_raw / 200.0;
Expand Down Expand Up @@ -158,32 +186,32 @@ int16_t sen66_read_measured_values(float* mass_concentration_pm1p0,
}

int16_t sen66_read_number_concentration_values(
float* mass_concentration_pm0p5, float* mass_concentration_pm1p0,
float* mass_concentration_pm2p5, float* mass_concentration_pm4p0,
float* mass_concentration_pm10p0) {
uint16_t mass_concentration_pm0p5_raw = 0;
uint16_t mass_concentration_pm1p0_raw = 0;
uint16_t mass_concentration_pm2p5_raw = 0;
uint16_t mass_concentration_pm4p0_raw = 0;
uint16_t mass_concentration_pm10p0_raw = 0;
float* number_concentration_pm0p5, float* number_concentration_pm1p0,
float* number_concentration_pm2p5, float* number_concentration_pm4p0,
float* number_concentration_pm10p0) {
uint16_t number_concentration_pm0p5_raw = 0;
uint16_t number_concentration_pm1p0_raw = 0;
uint16_t number_concentration_pm2p5_raw = 0;
uint16_t number_concentration_pm4p0_raw = 0;
uint16_t number_concentration_pm10p0_raw = 0;
int16_t local_error = 0;
local_error = sen66_read_number_concentration_values_as_integers(
&mass_concentration_pm0p5_raw, &mass_concentration_pm1p0_raw,
&mass_concentration_pm2p5_raw, &mass_concentration_pm4p0_raw,
&mass_concentration_pm10p0_raw);
&number_concentration_pm0p5_raw, &number_concentration_pm1p0_raw,
&number_concentration_pm2p5_raw, &number_concentration_pm4p0_raw,
&number_concentration_pm10p0_raw);
if (local_error != NO_ERROR) {
return local_error;
}
*mass_concentration_pm0p5 =
sen66_signal_mass_concentration_pm0p5(mass_concentration_pm0p5_raw);
*mass_concentration_pm1p0 =
sen66_signal_mass_concentration_pm1p0(mass_concentration_pm1p0_raw);
*mass_concentration_pm2p5 =
sen66_signal_mass_concentration_pm2p5(mass_concentration_pm2p5_raw);
*mass_concentration_pm4p0 =
sen66_signal_mass_concentration_pm4p0(mass_concentration_pm4p0_raw);
*mass_concentration_pm10p0 =
sen66_signal_mass_concentration_pm10p0(mass_concentration_pm10p0_raw);
*number_concentration_pm0p5 =
sen66_signal_number_concentration_pm0p5(number_concentration_pm0p5_raw);
*number_concentration_pm1p0 =
sen66_signal_number_concentration_pm1p0(number_concentration_pm1p0_raw);
*number_concentration_pm2p5 =
sen66_signal_number_concentration_pm2p5(number_concentration_pm2p5_raw);
*number_concentration_pm4p0 =
sen66_signal_number_concentration_pm4p0(number_concentration_pm4p0_raw);
*number_concentration_pm10p0 = sen66_signal_number_concentration_pm10p0(
number_concentration_pm10p0_raw);
return local_error;
}

Expand Down
117 changes: 81 additions & 36 deletions sen66_i2c.h
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 @@ -103,22 +103,12 @@ typedef union {
*/
void sen66_init(uint8_t i2c_address);

/**
* @brief sen66_signal_mass_concentration_pm0p5
*
* @param[in] mass_concentration_pm0p5_raw
*
* @return Mass concentration for particles smaller than 0.5 μm
*/
float sen66_signal_mass_concentration_pm0p5(
uint16_t mass_concentration_pm0p5_raw);

/**
* @brief sen66_signal_mass_concentration_pm1p0
*
* @param[in] mass_concentration_pm1p0_raw
*
* @return Mass concentration for particles smaller than 1.0 μm
* @return Mass concentration in μg/m³ for particles smaller than 1.0 μm
*/
float sen66_signal_mass_concentration_pm1p0(
uint16_t mass_concentration_pm1p0_raw);
Expand All @@ -128,7 +118,7 @@ float sen66_signal_mass_concentration_pm1p0(
*
* @param[in] mass_concentration_pm2p5_raw
*
* @return Mass concentration for particles smaller than 2.5 μm
* @return Mass concentration in μg/m³ for particles smaller than 2.5 μm
*/
float sen66_signal_mass_concentration_pm2p5(
uint16_t mass_concentration_pm2p5_raw);
Expand All @@ -138,7 +128,7 @@ float sen66_signal_mass_concentration_pm2p5(
*
* @param[in] mass_concentration_pm4p0_raw
*
* @return Mass concentration for particles smaller than 4.0 μm
* @return Mass concentration in μg/m³ for particles smaller than 4.0 μm
*/
float sen66_signal_mass_concentration_pm4p0(
uint16_t mass_concentration_pm4p0_raw);
Expand All @@ -148,11 +138,66 @@ float sen66_signal_mass_concentration_pm4p0(
*
* @param[in] mass_concentration_pm10p0_raw
*
* @return Mass concentration for particles smaller than 10.0 μm
* @return Mass concentration in μg/m³ for particles smaller than 10.0 μm
*/
float sen66_signal_mass_concentration_pm10p0(
uint16_t mass_concentration_pm10p0_raw);

/**
* @brief sen66_signal_number_concentration_pm0p5
*
* @param[in] number_concentration_pm0p5_raw
*
* @return Number concentration in particles/cm³ for particles smaller than 0.5
* μm
*/
float sen66_signal_number_concentration_pm0p5(
uint16_t number_concentration_pm0p5_raw);

/**
* @brief sen66_signal_number_concentration_pm1p0
*
* @param[in] number_concentration_pm1p0_raw
*
* @return Number concentration in particles/cm³ for particles smaller than 1.0
* μm
*/
float sen66_signal_number_concentration_pm1p0(
uint16_t number_concentration_pm1p0_raw);

/**
* @brief sen66_signal_number_concentration_pm2p5
*
* @param[in] number_concentration_pm2p5_raw
*
* @return Number concentration in particles/cm³ for particles smaller than 2.5
* μm
*/
float sen66_signal_number_concentration_pm2p5(
uint16_t number_concentration_pm2p5_raw);

/**
* @brief sen66_signal_number_concentration_pm4p0
*
* @param[in] number_concentration_pm4p0_raw
*
* @return Number concentration in particles/cm³ for particles smaller than 4.0
* μm
*/
float sen66_signal_number_concentration_pm4p0(
uint16_t number_concentration_pm4p0_raw);

/**
* @brief sen66_signal_number_concentration_pm10p0
*
* @param[in] number_concentration_pm10p0_raw
*
* @return Number concentration in particles/cm³ for particles smaller than 10.0
* μm
*/
float sen66_signal_number_concentration_pm10p0(
uint16_t number_concentration_pm10p0_raw);

/**
* @brief sen66_signal_temperature
*
Expand Down Expand Up @@ -202,14 +247,14 @@ uint16_t sen66_signal_co2(uint16_t co2_raw);
/**
* @brief Read measured values and apply scaling as defined in datasheet.
*
* @param[out] mass_concentration_pm1p0 Mass concentration for particles smaller
* than 1.0 μm.
* @param[out] mass_concentration_pm2p5 Mass concentration for particles smaller
* than 2.5 μm.
* @param[out] mass_concentration_pm4p0 Mass concentration for particles smaller
* than 4.0 μm.
* @param[out] mass_concentration_pm10p0 Mass concentration for particles
* smaller than 10.0 μm.
* @param[out] mass_concentration_pm1p0 Mass concentration in μg/m³ for
* particles smaller than 1.0 μm.
* @param[out] mass_concentration_pm2p5 Mass concentration in μg/m³ for
* particles smaller than 2.5 μm.
* @param[out] mass_concentration_pm4p0 Mass concentration in μg/m³ for
* particles smaller than 4.0 μm.
* @param[out] mass_concentration_pm10p0 Mass concentration in μg/m³ for
* particles smaller than 10.0 μm.
* @param[out] humidity Measured humidity in %RH.
* @param[out] temperature Measured temperature in degrees celsius.
* @param[out] voc_index Measured VOC Index between 0 and 500.
Expand All @@ -230,23 +275,23 @@ int16_t sen66_read_measured_values(float* mass_concentration_pm1p0,
* @brief Read measured number concentration values and apply scaling as defined
* in datasheet.
*
* @param[out] mass_concentration_pm0p5 Mass concentration for particles smaller
* than 1.0 μm.
* @param[out] mass_concentration_pm1p0 Mass concentration for particles smaller
* than 1.0 μm.
* @param[out] mass_concentration_pm2p5 Mass concentration for particles smaller
* than 2.5 μm.
* @param[out] mass_concentration_pm4p0 Mass concentration for particles smaller
* than 4.0 μm.
* @param[out] mass_concentration_pm10p0 Mass concentration for particles
* smaller than 10.0 μm.
* @param[out] number_concentration_pm0p5 Number concentration in particles/cm³
* for particles smaller than 0.5 μm.
* @param[out] number_concentration_pm1p0 Number concentration in particles/cm³
* for particles smaller than 1.0 μm.
* @param[out] number_concentration_pm2p5 Number concentration in particles/cm³
* for particles smaller than 2.5 μm.
* @param[out] number_concentration_pm4p0 Number concentration in particles/cm³
* for particles smaller than 4.0 μm.
* @param[out] number_concentration_pm10p0 Number concentration in particles/cm³
* for particles smaller than 10.0 μm.
*
* @return error_code 0 on success, an error code otherwise.
*/
int16_t sen66_read_number_concentration_values(
float* mass_concentration_pm0p5, float* mass_concentration_pm1p0,
float* mass_concentration_pm2p5, float* mass_concentration_pm4p0,
float* mass_concentration_pm10p0);
float* number_concentration_pm0p5, float* number_concentration_pm1p0,
float* number_concentration_pm2p5, float* number_concentration_pm4p0,
float* number_concentration_pm10p0);

/**
* @brief Start a continuous measurement (interval 1s)
Expand Down

0 comments on commit 8f939ee

Please sign in to comment.