Skip to content

Commit

Permalink
Merge branch 'update-header' into 'master'
Browse files Browse the repository at this point in the history
prefix typedef & prepare release

See merge request MSO-SW/drivers/arduino/arduino-i2c-sf06-lf!6
  • Loading branch information
LeonieFierz committed Apr 29, 2024
2 parents 6a6892e + 3d8822a commit cffb948
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@ 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
* 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

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
11 changes: 5 additions & 6 deletions src/SensirionI2cSf06Lf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions src/SensirionI2cSf06Lf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cffb948

Please sign in to comment.