diff --git a/.github/workflows/raspberry_quality_check.yml b/.github/workflows/raspberry_quality_check.yml index 5b1fddb..31722af 100644 --- a/.github/workflows/raspberry_quality_check.yml +++ b/.github/workflows/raspberry_quality_check.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index ee79771..62f2c81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 \ No newline at end of file diff --git a/README.md b/README.md index 9ab1a59..9aff5ee 100644 --- a/README.md +++ b/README.md @@ -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) @@ -162,4 +162,4 @@ they are fixed. ## License -See [LICENSE](LICENSE). \ No newline at end of file +See [LICENSE](LICENSE). diff --git a/example-usage/sen66_i2c_example_usage.c b/example-usage/sen66_i2c_example_usage.c index 05cd5eb..905bdbe 100644 --- a/example-usage/sen66_i2c_example_usage.c +++ b/example-usage/sen66_i2c_example_usage.c @@ -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 diff --git a/metadata.yml b/metadata.yml index e7f7ddb..505283c 100644 --- a/metadata.yml +++ b/metadata.yml @@ -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' diff --git a/sen66_i2c.c b/sen66_i2c.c index 64dbd26..d621112 100644 --- a/sen66_i2c.c +++ b/sen66_i2c.c @@ -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 @@ -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; @@ -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; @@ -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; } diff --git a/sen66_i2c.h b/sen66_i2c.h index e08530b..323be4c 100644 --- a/sen66_i2c.h +++ b/sen66_i2c.h @@ -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 @@ -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); @@ -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); @@ -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); @@ -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 * @@ -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. @@ -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)