Skip to content

Commit

Permalink
Merge branch 'sht4x_2.1.1_20240411_1410' into 'master'
Browse files Browse the repository at this point in the history
Generate SHT4x driver from SHT4X model version 2.1.1

See merge request MSO-SW/drivers/arduino/arduino-i2c-sht4x!6
  • Loading branch information
psachs committed Apr 11, 2024
2 parents f6d7684 + 54d4ebb commit f086990
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 20 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

<img src="images/SHT4x.png" width="300px">
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -83,6 +86,7 @@ You will find pinout schematics for recommended board models below:




<details><summary>Arduino Nano</summary>
<p>

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




<details><summary>Arduino Micro</summary>
<p>

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




<details><summary>Arduino Mega 2560</summary>
<p>

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




<details><summary>ESP32 DevKitC</summary>
<p>

Expand All @@ -154,6 +161,7 @@ You will find pinout schematics for recommended board models below:
</details>



## Quick Start

1. Install the libraries and dependencies according to [Installation of the library](#installation-of-the-library)
Expand All @@ -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`
Expand Down Expand Up @@ -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).
17 changes: 12 additions & 5 deletions examples/exampleUsage/exampleUsage.ino
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,10 +36,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <Arduino.h>
#include <SensirionI2CSht4x.h>
#include <SensirionI2cSht4x.h>
#include <Wire.h>

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;
Expand Down
2 changes: 1 addition & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Datatypes (KEYWORD1)
#######################################

SensirionI2CSht4x KEYWORD1
SensirionI2cSht4x KEYWORD1

#######################################
# Methods and Functions (KEYWORD2)
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -8,4 +8,4 @@ url=https://github.com/Sensirion/arduino-i2c-sht4x
category=Sensors
architectures=*
depends=Sensirion Core
includes=SensirionI2CSht4x.h
includes=SensirionI2cSht4x.h
8 changes: 4 additions & 4 deletions metadata.yml
Original file line number Diff line number Diff line change
@@ -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'
Loading

0 comments on commit f086990

Please sign in to comment.