diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c74751..f978a60 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ cppcheck: name: registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0 tags: [linux, docker] script: - - cppcheck --std=c++11 --language=c++ --error-exitcode=1 --enable=warning,style,performance,portability --suppress=unreadVariable src/* + - cppcheck --std=c++11 --language=c++ --error-exitcode=1 --enable=warning,style,performance,portability --suppress=unreadVariable --suppress=unusedStructMember src/* TODO_check: stage: validate diff --git a/CHANGELOG.md b/CHANGELOG.md index 163fd7f..ba4fb21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,30 @@ -# 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] +## [1.1.0] - 2024-4-10 -Defined I2C addresses for different sensor models. -You must now pass the I2C address to use in the begin() method of SensirionI2cSht4x +### Fixed -Improved README +- Fix colliding definitions with other Sensirion sensor drivers +## [1.0.0] - 2024-3-14 -## [0.1.0] - 2021-07-27 +### Changed -Initial release +- Defined I2C addresses for different sensor models. You must now pass the I2C address to use in the begin() method of SensirionI2cSht4x +- Improved README +## [0.1.0] - 2021-7-27 -[0.1.0]: https://github.com/Sensirion/arduino-i2c-sht4x/releases/tag/0.1.0 +### Added + +- Add product picture +- Add interfaces to start, stop and read measurements. +- Add interfaces to read product name, serial number and version + +[Unreleased]: https://github.com/Sensirion/arduino-i2c-sht4x/compare/1.1.0...HEAD +[1.1.0]: https://github.com/Sensirion/arduino-i2c-sht4x/compare/1.0.0...1.1.0 +[1.0.0]: https://github.com/Sensirion/arduino-i2c-sht4x/compare/0.1.0...1.0.0 +[0.1.0]: https://github.com/Sensirion/arduino-i2c-sht4x/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/README.md b/README.md index d42340d..8a15a1d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Sensirion I²C SHT4X Arduino Library -This is the Sensirion SHT4X library for Arduino allowing you to +This is the Sensirion SHT4X library for Arduino allowing you to communicate with a sensor of the SHT4X family over I²C. @@ -32,12 +32,12 @@ the Library Manager via Search for the `Sensirion I2C SHT4X` library in the `Filter your search...` field and install it by clicking the `install` button. -If you cannot find it in the library manager, download the latest release as .zip file +If you cannot find it in the library manager, download the latest release as .zip file and add it to your [Arduino IDE](http://www.arduino.cc/en/main/software) via `Sketch` ➔ `Include Library` ➔ `Add .ZIP Library...` -Don't forget to **install the dependencies** listed below the same way via library +Don't forget to **install the dependencies** listed below the same way via library manager or `Add .ZIP Library` #### Dependencies @@ -51,11 +51,14 @@ Use the following pin description to connect your SHT4X to the standard I²C bus | *Pin* | *Cable Color* | *Name* | *Description* | *Comments* | |-------|---------------|:------:|----------------|------------| -| 1 | green | SDA | I2C: Serial data input / output | -| 2 | black | GND | Ground | -| 3 | yellow | SCL | I2C: Serial clock input | +| 1 | green | SDA | I2C: Serial data input / output | +| 2 | black | GND | Ground | +| 3 | yellow | SCL | I2C: Serial clock input | | 4 | red | VDD | Supply Voltage | 1.1V to 3.6V + + + The recommended voltage is 3.3V. Please refer to the datasheet for proper circuit setup. There are 3rd party boards for easy connection of the SHT4x sensor to your Arduino Board. @@ -83,6 +86,7 @@ You will find pinout schematics for recommended board models below: +
Arduino Nano

@@ -101,6 +105,7 @@ You will find pinout schematics for recommended board models below: +

Arduino Micro

@@ -119,6 +124,7 @@ You will find pinout schematics for recommended board models below: +

Arduino Mega 2560

@@ -137,6 +143,7 @@ You will find pinout schematics for recommended board models below: +

ESP32 DevKitC

@@ -154,6 +161,7 @@ You will find pinout schematics for recommended board models below:

+ ## Quick Start 1. Install the libraries and dependencies according to [Installation of the library](#installation-of-the-library) @@ -164,10 +172,10 @@ You will find pinout schematics for recommended board models below: `File` ➔ `Examples` ➔ `Sensirion I2C SHT4X` ➔ `exampleUsage` - + The provided example is working with a SHT40, I²C address 0x44. - In order to use the code with another product or I²C address you need to change it in the code of `exampleUsage`. - You find the list with pre-defined addresses in `src/SensirionI2CSht4x.h`. + In order to use the code with another product or I²C address you need to change it in the code of `examples/exampleUsage`. + You find the list with pre-defined addresses in `src/SensirionI2cSht4X.h`. 5. Click the `Upload` button in the Arduino IDE or `Sketch` ➔ `Upload` @@ -199,8 +207,8 @@ clang-format -i src/*.cpp src/*.h Note that differences from this formatting will result in a failed build until they are fixed. - +: ## License -See [LICENSE](LICENSE). +See [LICENSE](LICENSE). \ No newline at end of file diff --git a/examples/exampleUsage/exampleUsage.ino b/examples/exampleUsage/exampleUsage.ino index ced6c91..72e48eb 100644 --- a/examples/exampleUsage/exampleUsage.ino +++ b/examples/exampleUsage/exampleUsage.ino @@ -1,12 +1,12 @@ /* * THIS FILE IS AUTOMATICALLY GENERATED * - * Generator: sensirion-driver-generator 0.32.0 + * Generator: sensirion-driver-generator 0.40.0 * Product: sht4x - * Model-Version: 2.0.0 + * Model-Version: 2.1.1 */ /* - * Copyright (c) 2023, Sensirion AG + * Copyright (c) 2024, Sensirion AG * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,10 +36,17 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#include +#include #include -SensirionI2CSht4x sensor; +// macro definitions +// make sure that we use the proper definition of NO_ERROR +#ifdef NO_ERROR +#undef NO_ERROR +#endif +#define NO_ERROR 0 + +SensirionI2cSht4x sensor; static char errorMessage[64]; static int16_t error; diff --git a/keywords.txt b/keywords.txt index 272cdd0..804d3e5 100644 --- a/keywords.txt +++ b/keywords.txt @@ -6,7 +6,7 @@ # Datatypes (KEYWORD1) ####################################### -SensirionI2CSht4x KEYWORD1 +SensirionI2cSht4x KEYWORD1 ####################################### # Methods and Functions (KEYWORD2) diff --git a/library.properties b/library.properties index 2439e57..837c61d 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Sensirion I2C SHT4x -version=1.0.0 +version=1.1.0 author=Sensirion maintainer=Sensirion sentence=Library for the SHT4X sensor family by Sensirion @@ -8,4 +8,4 @@ url=https://github.com/Sensirion/arduino-i2c-sht4x category=Sensors architectures=* depends=Sensirion Core -includes=SensirionI2CSht4x.h +includes=SensirionI2cSht4x.h diff --git a/metadata.yml b/metadata.yml index 488048b..a92bc54 100644 --- a/metadata.yml +++ b/metadata.yml @@ -1,7 +1,7 @@ -generator_version: 0.32.0 -model_version: 2.0.0 +generator_version: 0.40.0 +model_version: 2.1.1 dg_status: - released -is_manually_modified: true +is_manually_modified: yes first_generated: '2021-07-06 15:05' -last_generated: '2023-10-18 07:36' +last_generated: '2024-04-11 14:10' diff --git a/src/SensirionI2CSht4x.cpp b/src/SensirionI2cSht4x.cpp similarity index 81% rename from src/SensirionI2CSht4x.cpp rename to src/SensirionI2cSht4x.cpp index aa2418f..d127400 100644 --- a/src/SensirionI2CSht4x.cpp +++ b/src/SensirionI2cSht4x.cpp @@ -1,12 +1,12 @@ /* * THIS FILE IS AUTOMATICALLY GENERATED * - * Generator: sensirion-driver-generator 0.32.0 + * Generator: sensirion-driver-generator 0.40.0 * Product: sht4x - * Model-Version: 2.0.0 + * Model-Version: 2.1.1 */ /* - * Copyright (c) 2023, Sensirion AG + * Copyright (c) 2024, Sensirion AG * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,29 +36,35 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "SensirionI2CSht4x.h" +#include "SensirionI2cSht4x.h" #include +// make sure that we use the proper definition of NO_ERROR +#ifdef NO_ERROR +#undef NO_ERROR +#endif +#define NO_ERROR 0 + static uint8_t communication_buffer[6] = {0}; -SensirionI2CSht4x::SensirionI2CSht4x() { +SensirionI2cSht4x::SensirionI2cSht4x() { } -float SensirionI2CSht4x::signalTemperature(uint16_t temperatureTicks) { +float SensirionI2cSht4x::signalTemperature(uint16_t temperatureTicks) { float temperature = 0.0; temperature = (float)(temperatureTicks); - temperature = (float)((temperature * 175.0) / 65535.0) - 45.0; + temperature = ((temperature * 175.0) / 65535.0) - 45.0; return temperature; } -float SensirionI2CSht4x::signalHumidity(uint16_t humidityTicks) { +float SensirionI2cSht4x::signalHumidity(uint16_t humidityTicks) { float humidity = 0.0; humidity = (float)(humidityTicks); - humidity = (float)((humidity * 125.0) / 65535.0) - 6.0; + humidity = ((humidity * 125.0) / 65535.0) - 6.0; return humidity; } -int16_t SensirionI2CSht4x::measureHighPrecision(float& aTemperature, +int16_t SensirionI2cSht4x::measureHighPrecision(float& aTemperature, float& aHumidity) { uint16_t tempTicks = 0; uint16_t humiTicks = 0; @@ -67,12 +73,12 @@ int16_t SensirionI2CSht4x::measureHighPrecision(float& aTemperature, if (localError != NO_ERROR) { return localError; } - aTemperature = signalTemperature(tempTicks); - aHumidity = signalHumidity(humiTicks); + aTemperature = SensirionI2cSht4x::signalTemperature(tempTicks); + aHumidity = SensirionI2cSht4x::signalHumidity(humiTicks); return localError; } -int16_t SensirionI2CSht4x::measureMediumPrecision(float& aTemperature, +int16_t SensirionI2cSht4x::measureMediumPrecision(float& aTemperature, float& aHumidity) { uint16_t tempTicks = 0; uint16_t humiTicks = 0; @@ -81,12 +87,12 @@ int16_t SensirionI2CSht4x::measureMediumPrecision(float& aTemperature, if (localError != NO_ERROR) { return localError; } - aTemperature = signalTemperature(tempTicks); - aHumidity = signalHumidity(humiTicks); + aTemperature = SensirionI2cSht4x::signalTemperature(tempTicks); + aHumidity = SensirionI2cSht4x::signalHumidity(humiTicks); return localError; } -int16_t SensirionI2CSht4x::measureLowestPrecision(float& aTemperature, +int16_t SensirionI2cSht4x::measureLowestPrecision(float& aTemperature, float& aHumidity) { uint16_t tempTicks = 0; uint16_t humiTicks = 0; @@ -95,12 +101,12 @@ int16_t SensirionI2CSht4x::measureLowestPrecision(float& aTemperature, if (localError != NO_ERROR) { return localError; } - aTemperature = signalTemperature(tempTicks); - aHumidity = signalHumidity(humiTicks); + aTemperature = SensirionI2cSht4x::signalTemperature(tempTicks); + aHumidity = SensirionI2cSht4x::signalHumidity(humiTicks); return localError; } -int16_t SensirionI2CSht4x::activateHighestHeaterPowerLong(float& aTemperature, +int16_t SensirionI2cSht4x::activateHighestHeaterPowerLong(float& aTemperature, float& aHumidity) { uint16_t tempTicks = 0; uint16_t humiTicks = 0; @@ -109,12 +115,12 @@ int16_t SensirionI2CSht4x::activateHighestHeaterPowerLong(float& aTemperature, if (localError != NO_ERROR) { return localError; } - aTemperature = signalTemperature(tempTicks); - aHumidity = signalHumidity(humiTicks); + aTemperature = SensirionI2cSht4x::signalTemperature(tempTicks); + aHumidity = SensirionI2cSht4x::signalHumidity(humiTicks); return localError; } -int16_t SensirionI2CSht4x::activateHighestHeaterPowerShort(float& aTemperature, +int16_t SensirionI2cSht4x::activateHighestHeaterPowerShort(float& aTemperature, float& aHumidity) { uint16_t tempTicks = 0; uint16_t humiTicks = 0; @@ -123,12 +129,12 @@ int16_t SensirionI2CSht4x::activateHighestHeaterPowerShort(float& aTemperature, if (localError != NO_ERROR) { return localError; } - aTemperature = signalTemperature(tempTicks); - aHumidity = signalHumidity(humiTicks); + aTemperature = SensirionI2cSht4x::signalTemperature(tempTicks); + aHumidity = SensirionI2cSht4x::signalHumidity(humiTicks); return localError; } -int16_t SensirionI2CSht4x::activateMediumHeaterPowerLong(float& aTemperature, +int16_t SensirionI2cSht4x::activateMediumHeaterPowerLong(float& aTemperature, float& aHumidity) { uint16_t tempTicks = 0; uint16_t humiTicks = 0; @@ -137,12 +143,12 @@ int16_t SensirionI2CSht4x::activateMediumHeaterPowerLong(float& aTemperature, if (localError != NO_ERROR) { return localError; } - aTemperature = signalTemperature(tempTicks); - aHumidity = signalHumidity(humiTicks); + aTemperature = SensirionI2cSht4x::signalTemperature(tempTicks); + aHumidity = SensirionI2cSht4x::signalHumidity(humiTicks); return localError; } -int16_t SensirionI2CSht4x::activateMediumHeaterPowerShort(float& aTemperature, +int16_t SensirionI2cSht4x::activateMediumHeaterPowerShort(float& aTemperature, float& aHumidity) { uint16_t tempTicks = 0; uint16_t humiTicks = 0; @@ -151,12 +157,12 @@ int16_t SensirionI2CSht4x::activateMediumHeaterPowerShort(float& aTemperature, if (localError != NO_ERROR) { return localError; } - aTemperature = signalTemperature(tempTicks); - aHumidity = signalHumidity(humiTicks); + aTemperature = SensirionI2cSht4x::signalTemperature(tempTicks); + aHumidity = SensirionI2cSht4x::signalHumidity(humiTicks); return localError; } -int16_t SensirionI2CSht4x::activateLowestHeaterPowerLong(float& aTemperature, +int16_t SensirionI2cSht4x::activateLowestHeaterPowerLong(float& aTemperature, float& aHumidity) { uint16_t tempTicks = 0; uint16_t humiTicks = 0; @@ -165,12 +171,12 @@ int16_t SensirionI2CSht4x::activateLowestHeaterPowerLong(float& aTemperature, if (localError != NO_ERROR) { return localError; } - aTemperature = signalTemperature(tempTicks); - aHumidity = signalHumidity(humiTicks); + aTemperature = SensirionI2cSht4x::signalTemperature(tempTicks); + aHumidity = SensirionI2cSht4x::signalHumidity(humiTicks); return localError; } -int16_t SensirionI2CSht4x::activateLowestHeaterPowerShort(float& aTemperature, +int16_t SensirionI2cSht4x::activateLowestHeaterPowerShort(float& aTemperature, float& aHumidity) { uint16_t tempTicks = 0; uint16_t humiTicks = 0; @@ -179,12 +185,12 @@ int16_t SensirionI2CSht4x::activateLowestHeaterPowerShort(float& aTemperature, if (localError != NO_ERROR) { return localError; } - aTemperature = signalTemperature(tempTicks); - aHumidity = signalHumidity(humiTicks); + aTemperature = SensirionI2cSht4x::signalTemperature(tempTicks); + aHumidity = SensirionI2cSht4x::signalHumidity(humiTicks); return localError; } -int16_t SensirionI2CSht4x::measureHighPrecisionTicks(uint16_t& temperatureTicks, +int16_t SensirionI2cSht4x::measureHighPrecisionTicks(uint16_t& temperatureTicks, uint16_t& humidityTicks) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; @@ -208,7 +214,7 @@ int16_t SensirionI2CSht4x::measureHighPrecisionTicks(uint16_t& temperatureTicks, } int16_t -SensirionI2CSht4x::measureMediumPrecisionTicks(uint16_t& temperatureTicks, +SensirionI2cSht4x::measureMediumPrecisionTicks(uint16_t& temperatureTicks, uint16_t& humidityTicks) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; @@ -232,7 +238,7 @@ SensirionI2CSht4x::measureMediumPrecisionTicks(uint16_t& temperatureTicks, } int16_t -SensirionI2CSht4x::measureLowestPrecisionTicks(uint16_t& temperatureTicks, +SensirionI2cSht4x::measureLowestPrecisionTicks(uint16_t& temperatureTicks, uint16_t& humidityTicks) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; @@ -255,7 +261,7 @@ SensirionI2CSht4x::measureLowestPrecisionTicks(uint16_t& temperatureTicks, return localError; } -int16_t SensirionI2CSht4x::activateHighestHeaterPowerLongTicks( +int16_t SensirionI2cSht4x::activateHighestHeaterPowerLongTicks( uint16_t& temperatureTicks, uint16_t& humidityTicks) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; @@ -278,7 +284,7 @@ int16_t SensirionI2CSht4x::activateHighestHeaterPowerLongTicks( return localError; } -int16_t SensirionI2CSht4x::activateHighestHeaterPowerShortTicks( +int16_t SensirionI2cSht4x::activateHighestHeaterPowerShortTicks( uint16_t& temperatureTicks, uint16_t& humidityTicks) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; @@ -301,7 +307,7 @@ int16_t SensirionI2CSht4x::activateHighestHeaterPowerShortTicks( return localError; } -int16_t SensirionI2CSht4x::activateMediumHeaterPowerLongTicks( +int16_t SensirionI2cSht4x::activateMediumHeaterPowerLongTicks( uint16_t& temperatureTicks, uint16_t& humidityTicks) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; @@ -324,7 +330,7 @@ int16_t SensirionI2CSht4x::activateMediumHeaterPowerLongTicks( return localError; } -int16_t SensirionI2CSht4x::activateMediumHeaterPowerShortTicks( +int16_t SensirionI2cSht4x::activateMediumHeaterPowerShortTicks( uint16_t& temperatureTicks, uint16_t& humidityTicks) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; @@ -347,7 +353,7 @@ int16_t SensirionI2CSht4x::activateMediumHeaterPowerShortTicks( return localError; } -int16_t SensirionI2CSht4x::activateLowestHeaterPowerLongTicks( +int16_t SensirionI2cSht4x::activateLowestHeaterPowerLongTicks( uint16_t& temperatureTicks, uint16_t& humidityTicks) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; @@ -370,7 +376,7 @@ int16_t SensirionI2CSht4x::activateLowestHeaterPowerLongTicks( return localError; } -int16_t SensirionI2CSht4x::activateLowestHeaterPowerShortTicks( +int16_t SensirionI2cSht4x::activateLowestHeaterPowerShortTicks( uint16_t& temperatureTicks, uint16_t& humidityTicks) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; @@ -393,7 +399,7 @@ int16_t SensirionI2CSht4x::activateLowestHeaterPowerShortTicks( return localError; } -int16_t SensirionI2CSht4x::serialNumber(uint32_t& serialNumber) { +int16_t SensirionI2cSht4x::serialNumber(uint32_t& serialNumber) { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; SensirionI2CTxFrame txFrame = @@ -414,7 +420,7 @@ int16_t SensirionI2CSht4x::serialNumber(uint32_t& serialNumber) { return localError; } -int16_t SensirionI2CSht4x::softReset() { +int16_t SensirionI2cSht4x::softReset() { int16_t localError = NO_ERROR; uint8_t* buffer_ptr = communication_buffer; SensirionI2CTxFrame txFrame = @@ -428,7 +434,7 @@ int16_t SensirionI2CSht4x::softReset() { return localError; } -void SensirionI2CSht4x::begin(TwoWire& i2cBus, uint8_t i2cAddress) { +void SensirionI2cSht4x::begin(TwoWire& i2cBus, uint8_t i2cAddress) { _i2cBus = &i2cBus; _i2cAddress = i2cAddress; } diff --git a/src/SensirionI2CSht4x.h b/src/SensirionI2cSht4x.h similarity index 94% rename from src/SensirionI2CSht4x.h rename to src/SensirionI2cSht4x.h index a74a6d3..1872a87 100644 --- a/src/SensirionI2CSht4x.h +++ b/src/SensirionI2cSht4x.h @@ -1,12 +1,12 @@ /* * THIS FILE IS AUTOMATICALLY GENERATED * - * Generator: sensirion-driver-generator 0.32.0 + * Generator: sensirion-driver-generator 0.40.0 * Product: sht4x - * Model-Version: 2.0.0 + * Model-Version: 2.1.1 */ /* - * Copyright (c) 2023, Sensirion AG + * Copyright (c) 2024, Sensirion AG * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,6 @@ #include #include -#define NO_ERROR 0 #define SHT40_I2C_ADDR_44 0x44 #define SHT40_I2C_ADDR_45 0x45 #define SHT41_I2C_ADDR_44 0x44 @@ -51,22 +50,22 @@ #define SHT45_I2C_ADDR_45 0x45 typedef enum { - MEASURE_HIGH_PRECISION_TICKS_CMD_ID = 0xfd, - MEASURE_MEDIUM_PRECISION_TICKS_CMD_ID = 0xf6, - MEASURE_LOWEST_PRECISION_TICKS_CMD_ID = 0xe0, - ACTIVATE_HIGHEST_HEATER_POWER_LONG_TICKS_CMD_ID = 0x39, - ACTIVATE_HIGHEST_HEATER_POWER_SHORT_TICKS_CMD_ID = 0x32, - ACTIVATE_MEDIUM_HEATER_POWER_LONG_TICKS_CMD_ID = 0x2f, - ACTIVATE_MEDIUM_HEATER_POWER_SHORT_TICKS_CMD_ID = 0x24, - ACTIVATE_LOWEST_HEATER_POWER_LONG_TICKS_CMD_ID = 0x1e, - ACTIVATE_LOWEST_HEATER_POWER_SHORT_TICKS_CMD_ID = 0x15, - SERIAL_NUMBER_CMD_ID = 0x89, - SOFT_RESET_CMD_ID = 0x94, -} CmdId; + SHT4X_MEASURE_HIGH_PRECISION_TICKS_CMD_ID = 0xfd, + SHT4X_MEASURE_MEDIUM_PRECISION_TICKS_CMD_ID = 0xf6, + SHT4X_MEASURE_LOWEST_PRECISION_TICKS_CMD_ID = 0xe0, + SHT4X_ACTIVATE_HIGHEST_HEATER_POWER_LONG_TICKS_CMD_ID = 0x39, + SHT4X_ACTIVATE_HIGHEST_HEATER_POWER_SHORT_TICKS_CMD_ID = 0x32, + SHT4X_ACTIVATE_MEDIUM_HEATER_POWER_LONG_TICKS_CMD_ID = 0x2f, + SHT4X_ACTIVATE_MEDIUM_HEATER_POWER_SHORT_TICKS_CMD_ID = 0x24, + SHT4X_ACTIVATE_LOWEST_HEATER_POWER_LONG_TICKS_CMD_ID = 0x1e, + SHT4X_ACTIVATE_LOWEST_HEATER_POWER_SHORT_TICKS_CMD_ID = 0x15, + SHT4X_SERIAL_NUMBER_CMD_ID = 0x89, + SHT4X_SOFT_RESET_CMD_ID = 0x94, +} SHT4xCmdId; -class SensirionI2CSht4x { +class SensirionI2cSht4x { public: - SensirionI2CSht4x(); + SensirionI2cSht4x(); /** * @brief Initializes the SHT4x class. * @@ -397,10 +396,6 @@ class SensirionI2CSht4x { */ int16_t softReset(); - private: - TwoWire* _i2cBus = nullptr; - uint8_t _i2cAddress = 0; - /** * @brief signalTemperature * @@ -409,7 +404,7 @@ class SensirionI2CSht4x { * @return Converted from ticks to degrees celsius by (175 * ticks_value / * 65535) - 45 */ - float signalTemperature(uint16_t temperatureTicks); + static float signalTemperature(uint16_t temperatureTicks); /** * @brief signalHumidity @@ -419,7 +414,11 @@ class SensirionI2CSht4x { * @return Converted from ticks to percent relative humdity by (125 * * ticks_value / 65535) - 6 */ - float signalHumidity(uint16_t humidityTicks); + static float signalHumidity(uint16_t humidityTicks); + + private: + TwoWire* _i2cBus = nullptr; + uint8_t _i2cAddress = 0; }; #endif // SENSIRIONI2CSHT4X_H \ No newline at end of file