From 5d476699520460044ab51c32c387ebf99f5e4fda Mon Sep 17 00:00:00 2001 From: lfierz Date: Fri, 26 Apr 2024 08:40:06 +0200 Subject: [PATCH 1/2] prefix typedef in header to avoid conflicts when including several sensirion driver headers in the same source file --- CHANGELOG.md | 6 ++++-- src/SensirionI2cSf06Lf.cpp | 11 +++++------ src/SensirionI2cSf06Lf.h | 9 +++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 050904f..7e7f236 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -Example how to change I2C address for SLF3x sensors +* Example how to change I2C address for SLF3x sensors ### Changed -Names of defines for I2C addresses in SensirionI2cSf06Lf.h changed +* Names of defines for I2C addresses in SensirionI2cSf06Lf.h changed +* Added prefix to enum definitions in SensirionI2cSf06Lf.h + (InvFlowScaleFactors -> I2cSf06LfInvFlowScaleFactors, CmdId -> I2cSf06LfCmdId) ## [0.1.0] - 2022-03-30 diff --git a/src/SensirionI2cSf06Lf.cpp b/src/SensirionI2cSf06Lf.cpp index b926f35..e8353e1 100644 --- a/src/SensirionI2cSf06Lf.cpp +++ b/src/SensirionI2cSf06Lf.cpp @@ -44,8 +44,8 @@ static uint8_t communication_buffer[18] = {0}; SensirionI2cSf06Lf::SensirionI2cSf06Lf() { } -float SensirionI2cSf06Lf::signalFlow(int16_t rawFlow, - InvFlowScaleFactors invFlowScaleFactor) { +float SensirionI2cSf06Lf::signalFlow( + int16_t rawFlow, Sf06LfInvFlowScaleFactors invFlowScaleFactor) { float flow = 0.0; flow = (float)(rawFlow); flow = flow / (int)(invFlowScaleFactor); @@ -71,10 +71,9 @@ SensirionI2cSf06Lf::signalThermalConductivity(int16_t rawThermalConductivity) { return thermalConductivity; } -int16_t -SensirionI2cSf06Lf::readMeasurementData(InvFlowScaleFactors invFlowScaleFactor, - float& aFlow, float& aTemperature, - uint16_t& aSignalingFlags) { +int16_t SensirionI2cSf06Lf::readMeasurementData( + Sf06LfInvFlowScaleFactors invFlowScaleFactor, float& aFlow, + float& aTemperature, uint16_t& aSignalingFlags) { int16_t rawFlow = 0; int16_t rawTemp = 0; uint16_t signalingFlags = 0u; diff --git a/src/SensirionI2cSf06Lf.h b/src/SensirionI2cSf06Lf.h index f56d8f0..22e4069 100644 --- a/src/SensirionI2cSf06Lf.h +++ b/src/SensirionI2cSf06Lf.h @@ -60,7 +60,7 @@ typedef enum { EXIT_SLEEP_CMD_ID = 0x0, READ_PRODUCT_IDENTIFIER_PREPARE_CMD_ID = 0x367c, READ_PRODUCT_IDENTIFIER_CMD_ID = 0xe102, -} CmdId; +} Sf06LfCmdId; typedef enum { INV_FLOW_SCALE_FACTORS_SLF3C_1300F = 500, @@ -69,7 +69,7 @@ typedef enum { INV_FLOW_SCALE_FACTORS_SLF3S_0600F = 10, INV_FLOW_SCALE_FACTORS_LD20_0600L = 1200, INV_FLOW_SCALE_FACTORS_LD20_2600B = 20, -} InvFlowScaleFactors; +} Sf06LfInvFlowScaleFactors; class SensirionI2cSf06Lf { public: @@ -102,7 +102,7 @@ class SensirionI2cSf06Lf { * * @return error_code 0 on success, an error code otherwise. */ - int16_t readMeasurementData(InvFlowScaleFactors invFlowScaleFactor, + int16_t readMeasurementData(Sf06LfInvFlowScaleFactors invFlowScaleFactor, float& aFlow, float& aTemperature, uint16_t& aSignalingFlags); @@ -351,7 +351,8 @@ class SensirionI2cSf06Lf { * raw value is converted by: flow = raw_flow / inv_flow_scale_factor * Resulting unit depends on your specific sensor type. */ - float signalFlow(int16_t rawFlow, InvFlowScaleFactors invFlowScaleFactor); + float signalFlow(int16_t rawFlow, + Sf06LfInvFlowScaleFactors invFlowScaleFactor); /** * @brief signalTemperature From 3d8822aa59eee707b4cf91314cdab7198ef87cc8 Mon Sep 17 00:00:00 2001 From: lfierz Date: Fri, 26 Apr 2024 08:43:03 +0200 Subject: [PATCH 2/2] prepare release 1.0.0 --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e7f236..effecdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,10 @@ All notable changes to this project will be documented in this file. 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] +## [1.0.0] + ### Added * Example how to change I2C address for SLF3x sensors @@ -19,3 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Initial release + +[Unreleased]: https://github.com/Sensirion/arduino-i2c-sf06-lf/compare/1.0.0...HEAD +[1.0.0]: https://github.com/Sensirion/arduino-i2c-sf06-lf/compare/0.1.0...1.0.0 +[0.1.0]: https://github.com/Sensirion/arduino-i2c-sf06-lf/releases/tag/0.1.0 \ No newline at end of file