From 5b153de8d933c5a59b111666203de80c1931a980 Mon Sep 17 00:00:00 2001 From: Driver Generator 2 Date: Mon, 8 Jan 2024 12:56:18 +0000 Subject: [PATCH 1/2] "Update SFM_SF06 driver from Eris-flow model version 1.5.0" --- .gitignore | 2 +- CHANGELOG.md | 44 +++++-- LICENSE | 2 +- example-usage/sfm_sf06_i2c_example_usage.c | 6 +- metadata.yml | 8 +- sfm_sf06_i2c.c | 38 +++++-- sfm_sf06_i2c.h | 126 +++++++++++++++++---- tests/sfm_sf06_i2c_test.cpp | 4 +- 8 files changed, 175 insertions(+), 55 deletions(-) diff --git a/.gitignore b/.gitignore index 95aa2d2..a52c7c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/sfm_sf06_i2c_example_usage +/example-usage/sfm_sf06_i2c_example_usage /tests/sfm_sf06_test_hw_i2c /tests/sfm_sf06_test_sw_i2c diff --git a/CHANGELOG.md b/CHANGELOG.md index 23a848a..191166b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,47 @@ -# Changelog -All notable changes to this project will be documented in this file. +# CHANGELOG The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] -## [Unreleased] +## [3.0.0] - 2024-1-8 -## [1.0.0] - 2023-10-30 +### Changed + +- Use new changelog format +- Add missing User-API function +- Add prefix for global symbols in C/Cpp code +## [2.0.0] - 2023-10-31 + +### Changed + +- Fix again conversion function +## [1.0.0] - 2023-10-6 ### Changed -- Update code from driver generator 0.34.0 -- Move example and makefile into example-usage directory -- Improve readme +- Regenerate driver from model +- Renaming of functions +- Move usage examples to another folder +- Update readme +## [0.1.1] - 2023-6-1 + +### Changed + +- List more specific sensor names for SFM-4300 and SFM-3013 in the documentation of the start measurement functions as not all subtypes of those sensors support the same gases/gas mixtures. +### Fixed + +- Fix conversion function to avoid overflow +## [0.1.0] - 2021-10-27 -## [0.1.0] - 2021-11-23 +### Added -Initial release +- Provide initial version for SFM4300, SFM3xxx sensors based on Eris platform +[Unreleased]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/3.0.0...HEAD +[3.0.0]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/2.0.0...3.0.0 +[2.0.0]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/1.0.0...2.0.0 +[1.0.0]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/0.1.1...1.0.0 +[0.1.1]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/0.1.0...0.1.1 +[0.1.0]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/releases/tag/0.1.0 \ No newline at end of file diff --git a/LICENSE b/LICENSE index f95f5fe..1daaf92 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2023, Sensirion AG +Copyright (c) 2024, Sensirion AG All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/example-usage/sfm_sf06_i2c_example_usage.c b/example-usage/sfm_sf06_i2c_example_usage.c index d4f2d13..44aa5a2 100644 --- a/example-usage/sfm_sf06_i2c_example_usage.c +++ b/example-usage/sfm_sf06_i2c_example_usage.c @@ -1,12 +1,12 @@ /* * THIS FILE IS AUTOMATICALLY GENERATED * - * Generator: sensirion-driver-generator 0.33.0 + * Generator: sensirion-driver-generator 0.37.0 * Product: sfm_sf06 - * Model-Version: 1.4.0 + * Model-Version: 1.5.0 */ /* - * Copyright (c) 2023, Sensirion AG + * Copyright (c) 2024, Sensirion AG * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/metadata.yml b/metadata.yml index 12a5c91..5cc3b73 100644 --- a/metadata.yml +++ b/metadata.yml @@ -1,7 +1,7 @@ -generator_version: 0.33.0 -model_version: 1.4.0 +generator_version: 0.37.0 +model_version: 1.5.0 dg_status: - released -is_manually_modified: true +is_manually_modified: false first_generated: '2021-10-25 11:00' -last_generated: '2023-10-31 15:48' +last_generated: '2024-01-08 12:56' diff --git a/sfm_sf06_i2c.c b/sfm_sf06_i2c.c index 6c827f5..1da4101 100644 --- a/sfm_sf06_i2c.c +++ b/sfm_sf06_i2c.c @@ -1,12 +1,12 @@ /* * THIS FILE IS AUTOMATICALLY GENERATED * - * Generator: sensirion-driver-generator 0.33.0 + * Generator: sensirion-driver-generator 0.37.0 * Product: sfm_sf06 - * Model-Version: 1.4.0 + * Model-Version: 1.5.0 */ /* - * Copyright (c) 2023, Sensirion AG + * Copyright (c) 2024, Sensirion AG * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,7 +57,7 @@ void sfm_sf06_init(uint8_t i2c_address) { int16_t sfm_sf06_start_o2_continuous_measurement() { int16_t local_error = 0; local_error = sfm_sf06_read_scale_offset_unit( - START_O2_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, + SFM_SF06_START_O2_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, &_flow_offset, &_flow_unit); if (local_error != NO_ERROR) { return local_error; @@ -69,7 +69,7 @@ int16_t sfm_sf06_start_o2_continuous_measurement() { int16_t sfm_sf06_start_air_continuous_measurement() { int16_t local_error = 0; local_error = sfm_sf06_read_scale_offset_unit( - START_AIR_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, + SFM_SF06_START_AIR_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, &_flow_offset, &_flow_unit); if (local_error != NO_ERROR) { return local_error; @@ -81,7 +81,7 @@ int16_t sfm_sf06_start_air_continuous_measurement() { int16_t sfm_sf06_start_n2o_continuous_measurement() { int16_t local_error = 0; local_error = sfm_sf06_read_scale_offset_unit( - START_N2O_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, + SFM_SF06_START_N2O_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, &_flow_offset, &_flow_unit); if (local_error != NO_ERROR) { return local_error; @@ -93,7 +93,7 @@ int16_t sfm_sf06_start_n2o_continuous_measurement() { int16_t sfm_sf06_start_co2_continuous_measurement() { int16_t local_error = 0; local_error = sfm_sf06_read_scale_offset_unit( - START_CO2_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, + SFM_SF06_START_CO2_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, &_flow_offset, &_flow_unit); if (local_error != NO_ERROR) { return local_error; @@ -105,8 +105,8 @@ int16_t sfm_sf06_start_co2_continuous_measurement() { int16_t sfm_sf06_start_n2o_o2_continuous_measurement(uint16_t volume_fraction) { int16_t local_error = 0; local_error = sfm_sf06_read_scale_offset_unit( - START_N2O_O2_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, - &_flow_offset, &_flow_unit); + SFM_SF06_START_N2O_O2_CONTINUOUS_MEASUREMENT_CMD_ID, + &_flow_scale_factor, &_flow_offset, &_flow_unit); if (local_error != NO_ERROR) { return local_error; } @@ -118,8 +118,8 @@ int16_t sfm_sf06_start_n2o_o2_continuous_measurement(uint16_t volume_fraction) { int16_t sfm_sf06_start_co2_o2_continuous_measurement(uint16_t volume_fraction) { int16_t local_error = 0; local_error = sfm_sf06_read_scale_offset_unit( - START_CO2_O2_CONTINUOUS_MEASUREMENT_CMD_ID, &_flow_scale_factor, - &_flow_offset, &_flow_unit); + SFM_SF06_START_CO2_O2_CONTINUOUS_MEASUREMENT_CMD_ID, + &_flow_scale_factor, &_flow_offset, &_flow_unit); if (local_error != NO_ERROR) { return local_error; } @@ -128,6 +128,19 @@ int16_t sfm_sf06_start_co2_o2_continuous_measurement(uint16_t volume_fraction) { return local_error; } +int16_t sfm_sf06_start_air_o2_continuous_measurement(uint16_t volume_fraction) { + int16_t local_error = 0; + local_error = sfm_sf06_read_scale_offset_unit( + SFM_SF06_START_AIR_O2_CONTINUOUS_MEASUREMENT_CMD_ID, + &_flow_scale_factor, &_flow_offset, &_flow_unit); + if (local_error != NO_ERROR) { + return local_error; + } + local_error = + ll_sfm_sf06_start_air_o2_continuous_measurement(volume_fraction); + return local_error; +} + int16_t sfm_sf06_read_measurement_data_raw(int16_t* flow, int16_t* temperature, uint16_t* status_word) { int16_t local_error = 0; @@ -205,7 +218,8 @@ int16_t ll_sfm_sf06_start_co2_continuous_measurement() { return local_error; } -int16_t sfm_sf06_start_air_o2_continuous_measurement(uint16_t volume_fraction) { +int16_t +ll_sfm_sf06_start_air_o2_continuous_measurement(uint16_t volume_fraction) { int16_t local_error = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; uint16_t local_offset = 0; diff --git a/sfm_sf06_i2c.h b/sfm_sf06_i2c.h index 936fe96..c649345 100644 --- a/sfm_sf06_i2c.h +++ b/sfm_sf06_i2c.h @@ -1,12 +1,12 @@ /* * THIS FILE IS AUTOMATICALLY GENERATED * - * Generator: sensirion-driver-generator 0.33.0 + * Generator: sensirion-driver-generator 0.37.0 * Product: sfm_sf06 - * Model-Version: 1.4.0 + * Model-Version: 1.5.0 */ /* - * Copyright (c) 2023, Sensirion AG + * Copyright (c) 2024, Sensirion AG * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,27 +55,27 @@ extern "C" { #define SFM3019_I2C_ADDR_2E 0x2e typedef enum { - START_O2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3603, - START_AIR_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3608, - START_N2O_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3615, - START_CO2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x361e, - START_AIR_O2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3632, - START_N2O_O2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3639, - START_CO2_O2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3646, - UPDATE_CONCENTRATION_SET_CMD_ID = 0xe17d, - UPDATE_CONCENTRATION_ACTIVATE_CMD_ID = 0xe000, - STOP_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3ff9, - CONFIGURE_AVERAGING_CMD_ID = 0x366a, - READ_SCALE_OFFSET_UNIT_CMD_ID = 0x3661, - ENTER_SLEEP_CMD_ID = 0x3677, - EXIT_SLEEP_CMD_ID = 0x0, - READ_PRODUCT_IDENTIFIER_CMD_ID = 0xe102, -} cmd_id_t; + SFM_SF06_START_O2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3603, + SFM_SF06_START_AIR_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3608, + SFM_SF06_START_N2O_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3615, + SFM_SF06_START_CO2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x361e, + SFM_SF06_START_AIR_O2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3632, + SFM_SF06_START_N2O_O2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3639, + SFM_SF06_START_CO2_O2_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3646, + SFM_SF06_UPDATE_CONCENTRATION_SET_CMD_ID = 0xe17d, + SFM_SF06_UPDATE_CONCENTRATION_ACTIVATE_CMD_ID = 0xe000, + SFM_SF06_STOP_CONTINUOUS_MEASUREMENT_CMD_ID = 0x3ff9, + SFM_SF06_CONFIGURE_AVERAGING_CMD_ID = 0x366a, + SFM_SF06_READ_SCALE_OFFSET_UNIT_CMD_ID = 0x3661, + SFM_SF06_ENTER_SLEEP_CMD_ID = 0x3677, + SFM_SF06_EXIT_SLEEP_CMD_ID = 0x0, + SFM_SF06_READ_PRODUCT_IDENTIFIER_CMD_ID = 0xe102, +} SFM_SF06_CMD_ID; typedef enum { - ERROR_CODE_I2C_ERROR = 0, - ERROR_CODE_TIMEOUT = 1, -} error_code_t; + SFM_SF06_ERROR_CODE_I2C_ERROR = 0, + SFM_SF06_ERROR_CODE_TIMEOUT = 1, +} sfm_sf06_error_code_t; /** * @brief Initialize i2c address of driver @@ -134,6 +134,15 @@ int16_t sfm_sf06_start_n2o_o2_continuous_measurement(uint16_t volume_fraction); */ int16_t sfm_sf06_start_co2_o2_continuous_measurement(uint16_t volume_fraction); +/** + * @brief Start measurement and update internal state + * + * @param[in] volume_fraction Volume fraction of dioxigen in ‰. + * + * @return error_code 0 on success, an error code otherwise. + */ +int16_t sfm_sf06_start_air_o2_continuous_measurement(uint16_t volume_fraction); + /** * @brief Rename overwritten function. * @@ -273,8 +282,23 @@ int16_t ll_sfm_sf06_start_co2_continuous_measurement(); * @param[in] volume_fraction Volume fraction of dioxigen in ‰. * * @return error_code 0 on success, an error code otherwise. + * + * Example: + * -------- + * + * @code{.c} + * + * int16_t local_error = 0; + * local_error = sfm_sf06_start_air_o2_continuous_measurement(50); + * if (local_error != NO_ERROR) { + * return local_error; + * } + * + * @endcode + * */ -int16_t sfm_sf06_start_air_o2_continuous_measurement(uint16_t volume_fraction); +int16_t +ll_sfm_sf06_start_air_o2_continuous_measurement(uint16_t volume_fraction); /** * @brief Start continuous measurement of N₂O / O₂ mixture. @@ -293,6 +317,20 @@ int16_t sfm_sf06_start_air_o2_continuous_measurement(uint16_t volume_fraction); * @param[in] volume_fraction Volume fraction of O₂ in ‰. * * @return error_code 0 on success, an error code otherwise. + * + * Example: + * -------- + * + * @code{.c} + * + * int16_t local_error = 0; + * local_error = sfm_sf06_start_n2o_o2_continuous_measurement(50); + * if (local_error != NO_ERROR) { + * return local_error; + * } + * + * @endcode + * */ int16_t ll_sfm_sf06_start_n2o_o2_continuous_measurement(uint16_t volume_fraction); @@ -312,6 +350,20 @@ ll_sfm_sf06_start_n2o_o2_continuous_measurement(uint16_t volume_fraction); * @param[in] volume_fraction Volume fraction of O₂ in ‰. * * @return error_code 0 on success, an error code otherwise. + * + * Example: + * -------- + * + * @code{.c} + * + * int16_t local_error = 0; + * local_error = sfm_sf06_start_co2_o2_continuous_measurement(50); + * if (local_error != NO_ERROR) { + * return local_error; + * } + * + * @endcode + * */ int16_t ll_sfm_sf06_start_co2_o2_continuous_measurement(uint16_t volume_fraction); @@ -357,6 +409,20 @@ int16_t sfm_sf06_read_measurement_data(int16_t* flow, int16_t* temperature, * measurement mode will stop. * * @return error_code 0 on success, an error code otherwise. + * + * Example: + * -------- + * + * @code{.c} + * + * int16_t local_error = 0; + * local_error = sfm_sf06_update_concentration_set(50); + * if (local_error != NO_ERROR) { + * return local_error; + * } + * + * @endcode + * */ int16_t sfm_sf06_update_concentration_set(uint16_t volume_fraction); @@ -409,6 +475,20 @@ int16_t sfm_sf06_stop_continuous_measurement(); * @param[in] average_window Average window configuration value. * * @return error_code 0 on success, an error code otherwise. + * + * Example: + * -------- + * + * @code{.c} + * + * int16_t local_error = 0; + * local_error = sfm_sf06_configure_averaging(50); + * if (local_error != NO_ERROR) { + * return local_error; + * } + * + * @endcode + * */ int16_t sfm_sf06_configure_averaging(uint16_t average_window); diff --git a/tests/sfm_sf06_i2c_test.cpp b/tests/sfm_sf06_i2c_test.cpp index 94d7c6d..be8a9f5 100644 --- a/tests/sfm_sf06_i2c_test.cpp +++ b/tests/sfm_sf06_i2c_test.cpp @@ -1,9 +1,9 @@ /* * THIS FILE IS AUTOMATICALLY GENERATED * - * Generator: sensirion-driver-generator 0.33.0 + * Generator: sensirion-driver-generator 0.37.0 * Product: sfm_sf06 - * Model-Version: 1.4.0 + * Model-Version: 1.5.0 */ #include "sensirion_common.h" From 73af3bdd1afa344cbaee9c6fd1057dcb248cd6f3 Mon Sep 17 00:00:00 2001 From: Rolf Laich Date: Mon, 8 Jan 2024 16:23:35 +0100 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 24 ++++-------------------- metadata.yml | 2 +- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 191166b..f596645 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,43 +5,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [3.0.0] - 2024-1-8 +## [3.0.0] - 2024-1-10 ### Changed - Use new changelog format - Add missing User-API function - Add prefix for global symbols in C/Cpp code -## [2.0.0] - 2023-10-31 - -### Changed - -- Fix again conversion function -## [1.0.0] - 2023-10-6 - -### Changed - -- Regenerate driver from model - Renaming of functions - Move usage examples to another folder - Update readme -## [0.1.1] - 2023-6-1 - -### Changed -- List more specific sensor names for SFM-4300 and SFM-3013 in the documentation of the start measurement functions as not all subtypes of those sensors support the same gases/gas mixtures. ### Fixed - Fix conversion function to avoid overflow + ## [0.1.0] - 2021-10-27 ### Added -- Provide initial version for SFM4300, SFM3xxx sensors based on Eris platform +- Provide initial version for SFM4300, SFM3xxx sensors [Unreleased]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/3.0.0...HEAD -[3.0.0]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/2.0.0...3.0.0 -[2.0.0]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/1.0.0...2.0.0 -[1.0.0]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/0.1.1...1.0.0 -[0.1.1]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/0.1.0...0.1.1 +[3.0.0]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/compare/0.1.0...3.0.0 [0.1.0]: https://github.com/Sensirion/embedded-i2c-sfm-sf06/releases/tag/0.1.0 \ No newline at end of file diff --git a/metadata.yml b/metadata.yml index 5cc3b73..bb80589 100644 --- a/metadata.yml +++ b/metadata.yml @@ -2,6 +2,6 @@ generator_version: 0.37.0 model_version: 1.5.0 dg_status: - released -is_manually_modified: false +is_manually_modified: true first_generated: '2021-10-25 11:00' last_generated: '2024-01-08 12:56'