Skip to content

Commit edc169b

Browse files
author
Driver Generator 2
committed
Generate SEN66 driver from SEN66 model version 1.6.0
1 parent a59374d commit edc169b

File tree

7 files changed

+113
-16
lines changed

7 files changed

+113
-16
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: Quality check
22

33
on:
4-
pull_request:
5-
branches:
6-
- main
74
push:
5+
pull_request:
86
branches:
97
- main
10-
118
jobs:
129
driver-quality:
1310
uses: sensirion/.github/.github/workflows/driver.c.check.yml@main
11+
12+
code-generation-check:
13+
uses: sensirion/.github/.github/workflows/driver.generated.metadata_check.yml@main

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55

66
## [Unreleased]
77

8+
## [1.2.0] - 2025-3-13
9+
10+
### Added
11+
12+
- get version command to read the firmware version
13+
- get SHT heater measurement to read humidity and temperature measurement after heater activation. This command is available for firmware version >= 4.0.
14+
### Changed
15+
16+
- Activate SHT heater duration reduced to 20ms. For firmware version >= 4.0 the get heater measurements command can be used to check if the heater has finished. With firmware versions < 4.0 one must wait at least 1300ms before issuing another command.
817
## [1.1.0] - 2025-2-12
918

1019
### Changed
1120

1221
- Serial number and product name interpreted as string (changed from uint8[32] to int8[32])
22+
## [1.0.1] - 2024-12-1
1323

24+
### Fixed
1425

26+
- Fix naming from mass concentration to number concentration for read number concentration method (returned values were correct).
1527
## [1.0.0] - 2024-11-25
1628

1729
### Added
@@ -28,7 +40,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2840
- Add interfaces to start, stop and read measurements.
2941
- Add interfaces to read product name, serial number and version
3042

31-
[Unreleased]: https://github.com/Sensirion/embedded-i2c-sen66/compare/1.1.0...HEAD
43+
[Unreleased]: https://github.com/Sensirion/embedded-i2c-sen66/compare/1.2.0...HEAD
44+
[1.2.0]: https://github.com/Sensirion/embedded-i2c-sen66/compare/1.1.0...1.2.0
3245
[1.1.0]: https://github.com/Sensirion/embedded-i2c-sen66/compare/1.0.1...1.1.0
3346
[1.0.1]: https://github.com/Sensirion/embedded-i2c-sen66/compare/1.0.0...1.0.1
3447
[1.0.0]: https://github.com/Sensirion/embedded-i2c-sen66/compare/0.1.0...1.0.0

example-usage/sen66_i2c_example_usage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generator: sensirion-driver-generator 1.1.2
55
* Product: sen66
6-
* Model-Version: 1.5.0
6+
* Model-Version: 1.6.0
77
*/
88
/*
99
* Copyright (c) 2025, Sensirion AG

metadata.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# driver generation metadata
22
generator_version: 1.1.2
3-
model_version: 1.5.0
3+
model_version: 1.6.0
44
dg_status: released
55
is_manually_modified: false
66
first_generated: '2024-10-30 08:14'
7-
last_generated: '2025-02-12 09:59'
7+
last_generated: '2025-03-13 10:43'

sen66_i2c.c

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generator: sensirion-driver-generator 1.1.2
55
* Product: sen66
6-
* Model-Version: 1.5.0
6+
* Model-Version: 1.6.0
77
*/
88
/*
99
* Copyright (c) 2025, Sensirion AG
@@ -576,7 +576,29 @@ int16_t sen66_activate_sht_heater() {
576576
if (local_error != NO_ERROR) {
577577
return local_error;
578578
}
579-
sensirion_i2c_hal_sleep_usec(1300 * 1000);
579+
sensirion_i2c_hal_sleep_usec(20 * 1000);
580+
return local_error;
581+
}
582+
583+
int16_t sen66_get_sht_heater_measurements(int16_t* humidity,
584+
int16_t* temperature) {
585+
int16_t local_error = NO_ERROR;
586+
uint8_t* buffer_ptr = communication_buffer;
587+
uint16_t local_offset = 0;
588+
local_offset =
589+
sensirion_i2c_add_command16_to_buffer(buffer_ptr, local_offset, 0x6790);
590+
local_error =
591+
sensirion_i2c_write_data(_i2c_address, buffer_ptr, local_offset);
592+
if (local_error != NO_ERROR) {
593+
return local_error;
594+
}
595+
sensirion_i2c_hal_sleep_usec(20 * 1000);
596+
local_error = sensirion_i2c_read_data_inplace(_i2c_address, buffer_ptr, 4);
597+
if (local_error != NO_ERROR) {
598+
return local_error;
599+
}
600+
*humidity = sensirion_common_bytes_to_int16_t(&buffer_ptr[0]);
601+
*temperature = sensirion_common_bytes_to_int16_t(&buffer_ptr[2]);
580602
return local_error;
581603
}
582604

@@ -624,6 +646,27 @@ int16_t sen66_get_serial_number(int8_t* serial_number,
624646
return local_error;
625647
}
626648

649+
int16_t sen66_get_version(uint8_t* firmware_major, uint8_t* firmware_minor) {
650+
int16_t local_error = NO_ERROR;
651+
uint8_t* buffer_ptr = communication_buffer;
652+
uint16_t local_offset = 0;
653+
local_offset =
654+
sensirion_i2c_add_command16_to_buffer(buffer_ptr, local_offset, 0xd100);
655+
local_error =
656+
sensirion_i2c_write_data(_i2c_address, buffer_ptr, local_offset);
657+
if (local_error != NO_ERROR) {
658+
return local_error;
659+
}
660+
sensirion_i2c_hal_sleep_usec(20 * 1000);
661+
local_error = sensirion_i2c_read_data_inplace(_i2c_address, buffer_ptr, 2);
662+
if (local_error != NO_ERROR) {
663+
return local_error;
664+
}
665+
*firmware_major = (uint8_t)buffer_ptr[0];
666+
*firmware_minor = (uint8_t)buffer_ptr[1];
667+
return local_error;
668+
}
669+
627670
int16_t sen66_read_device_status(sen66_device_status* device_status) {
628671
int16_t local_error = NO_ERROR;
629672
uint8_t* buffer_ptr = communication_buffer;

sen66_i2c.h

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generator: sensirion-driver-generator 1.1.2
55
* Product: sen66
6-
* Model-Version: 1.5.0
6+
* Model-Version: 1.6.0
77
*/
88
/*
99
* Copyright (c) 2025, Sensirion AG
@@ -70,8 +70,10 @@ typedef enum {
7070
SEN66_SET_SENSOR_ALTITUDE_CMD_ID = 0x6736,
7171
SEN66_GET_SENSOR_ALTITUDE_CMD_ID = 0x6736,
7272
SEN66_ACTIVATE_SHT_HEATER_CMD_ID = 0x6765,
73+
SEN66_GET_SHT_HEATER_MEASUREMENTS_CMD_ID = 0x6790,
7374
SEN66_GET_PRODUCT_NAME_CMD_ID = 0xd014,
7475
SEN66_GET_SERIAL_NUMBER_CMD_ID = 0xd033,
76+
SEN66_GET_VERSION_CMD_ID = 0xd100,
7577
SEN66_READ_DEVICE_STATUS_CMD_ID = 0xd206,
7678
SEN66_READ_AND_CLEAR_DEVICE_STATUS_CMD_ID = 0xd210,
7779
SEN66_DEVICE_RESET_CMD_ID = 0xd304,
@@ -729,16 +731,42 @@ int16_t sen66_get_sensor_altitude(uint16_t* altitude);
729731
*
730732
* This command allows to use the inbuilt heater in SHT sensor to reverse creep
731733
* at high humidity. This command activates the SHT sensor heater with 200mW for
732-
* 1s. The heater is then automatically deactivated again. Wait at least 20s
733-
* after this command before starting a measurement to get coherent temperature
734-
* values (heating consequence to disappear).
734+
* 1s. The heater is then automatically deactivated again. The
735+
* "get_sht_heater_measurements" command can be used to check if the heater has
736+
* finished (firmware version >= 4.0). Wait at least 20s after this command
737+
* before starting a measurement to get coherent temperature values (heating
738+
* consequence to disappear).
735739
*
736-
* @note This command is only available in idle mode.
740+
* @note This command is only available in idle mode. For firmware version <
741+
* 4.0, wait for at least 1300ms before sending another command, to ensure
742+
* heating is finsihed.
737743
*
738744
* @return error_code 0 on success, an error code otherwise.
739745
*/
740746
int16_t sen66_activate_sht_heater();
741747

748+
/**
749+
* @brief Get the measurement values when the SHT sensor heating is finished.
750+
*
751+
* Get the measured values when the SHT sensor heating is triggerd. If the
752+
* heating is not finished, the returned humidity and temperature values are
753+
* 0x7FFF.
754+
*
755+
* @param[out] humidity Value is scaled with factor 100: RH [%] = value / 100
756+
* *Note: If this value is not available, 0x7FFF is returned.*
757+
* @param[out] temperature Value is scaled with factor 200: T [°C] = value / 200
758+
* *Note: If this value is not available, 0x7FFF is returned.*
759+
*
760+
* @note This command is only availble in idle mode. This command is only
761+
* available for firmware version >= 4.0. This command must be used after the
762+
* "activate_sht_heater" command. The get_sht_heater_measurements command can be
763+
* queried every 0.05s to get the measurements.
764+
*
765+
* @return error_code 0 on success, an error code otherwise.
766+
*/
767+
int16_t sen66_get_sht_heater_measurements(int16_t* humidity,
768+
int16_t* temperature);
769+
742770
/**
743771
* @brief sen66_get_product_name
744772
*
@@ -765,6 +793,19 @@ int16_t sen66_get_product_name(int8_t* product_name,
765793
int16_t sen66_get_serial_number(int8_t* serial_number,
766794
uint16_t serial_number_size);
767795

796+
/**
797+
* @brief sen66_get_version
798+
*
799+
* Gets the version information for the hardware, firmware and communication
800+
* protocol.
801+
*
802+
* @param[out] firmware_major Firmware major version number.
803+
* @param[out] firmware_minor Firmware minor version number.
804+
*
805+
* @return error_code 0 on success, an error code otherwise.
806+
*/
807+
int16_t sen66_get_version(uint8_t* firmware_major, uint8_t* firmware_minor);
808+
768809
/**
769810
* @brief sen66_read_device_status
770811
*

tests/sen66_i2c_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Generator: sensirion-driver-generator 1.1.2
55
* Product: sen66
6-
* Model-Version: 1.5.0
6+
* Model-Version: 1.6.0
77
*/
88

99
#include "sen66_i2c.h"

0 commit comments

Comments
 (0)