drivers/sensors: add SHTC3 uORB driver #3

Open
mojito02 wants to merge 1 commits from mojito02/nuttx:shtc3-uorb-driver into dev
First-time contributor

Changes

 drivers/sensors/shtc3_uorb.c   | new file (1224 lines)
 include/nuttx/sensors/shtc3.h  | new file
 drivers/sensors/Kconfig        | +9
 drivers/sensors/Make.defs      | +4
 drivers/sensors/CMakeLists.txt | +4

All changes to existing files are pure additions; no existing file
content is modified or removed.

Summary

Add a uORB driver for the Sensirion SHTC3 temperature and humidity
sensor. NuttX already supports several Sensirion parts (sht21.c,
sht3x.c, sht4x.c), but not the SHTC3, which uses a different command
set and a wake/sleep power model.

The driver registers two uORB topics:

  • SENSOR_TYPE_AMBIENT_TEMPERATURE — temperature in degrees Celsius
  • SENSOR_TYPE_RELATIVE_HUMIDITY — relative humidity in percent

Implementation notes

  • Power management: the SHTC3 defaults to sleep mode and must be woken
    before each measurement. The driver tracks the sleep state and issues
    wake/sleep commands around measurements to keep idle current low.
  • Data integrity: every I2C read is CRC-8 validated per the datasheet
    (polynomial 0x31); a failed checksum is reported rather than published.
  • Error recovery: a failed measurement attempts a soft reset before
    giving up, so a transient bus glitch does not leave the sensor stuck.
  • Per-channel work items: temperature and humidity each own a work
    queue entry, so the two topics can be enabled and paced independently.
  • Uses the high-repeatability, temperature-first command with clock
    stretching disabled, and waits the datasheet's measurement time.

Testing

Tested on an Allwinner R528 board with an SHTC3 on I2C:

  • Both uORB topics publish at the expected cadence
  • Temperature and humidity values validated against the datasheet ranges

Notes

The driver contains no platform-specific code and depends only on
standard NuttX interfaces (i2c_master, sensors/sensor.h, wqueue,
mutex). Kconfig, Make.defs and CMakeLists.txt entries follow the
existing Sensirion sensor pattern.

Both new files pass nxstyle with zero warnings; the code was formatted
using tools/uncrustify.cfg.

合并请求描述

[简要描述本次合并请求的目的和主要内容]

相关Issue

关联Issue编号:#{Issue编号}

变更内容

1. 增强了xxx

## Changes ``` drivers/sensors/shtc3_uorb.c | new file (1224 lines) include/nuttx/sensors/shtc3.h | new file drivers/sensors/Kconfig | +9 drivers/sensors/Make.defs | +4 drivers/sensors/CMakeLists.txt | +4 ``` All changes to existing files are **pure additions**; no existing file content is modified or removed. ## Summary Add a uORB driver for the Sensirion SHTC3 temperature and humidity sensor. NuttX already supports several Sensirion parts (`sht21.c`, `sht3x.c`, `sht4x.c`), but not the SHTC3, which uses a different command set and a wake/sleep power model. The driver registers two uORB topics: - `SENSOR_TYPE_AMBIENT_TEMPERATURE` — temperature in degrees Celsius - `SENSOR_TYPE_RELATIVE_HUMIDITY` — relative humidity in percent ## Implementation notes - **Power management**: the SHTC3 defaults to sleep mode and must be woken before each measurement. The driver tracks the sleep state and issues wake/sleep commands around measurements to keep idle current low. - **Data integrity**: every I2C read is CRC-8 validated per the datasheet (polynomial 0x31); a failed checksum is reported rather than published. - **Error recovery**: a failed measurement attempts a soft reset before giving up, so a transient bus glitch does not leave the sensor stuck. - **Per-channel work items**: temperature and humidity each own a work queue entry, so the two topics can be enabled and paced independently. - Uses the high-repeatability, temperature-first command with clock stretching disabled, and waits the datasheet's measurement time. ## Testing Tested on an Allwinner R528 board with an SHTC3 on I2C: - Both uORB topics publish at the expected cadence - Temperature and humidity values validated against the datasheet ranges ## Notes The driver contains no platform-specific code and depends only on standard NuttX interfaces (`i2c_master`, `sensors/sensor.h`, `wqueue`, `mutex`). Kconfig, Make.defs and CMakeLists.txt entries follow the existing Sensirion sensor pattern. Both new files pass `nxstyle` with zero warnings; the code was formatted using `tools/uncrustify.cfg`. ## 合并请求描述 [简要描述本次合并请求的目的和主要内容] ## 相关Issue 关联Issue编号:#{Issue编号} ## 变更内容 ### 1. 增强了xxx
mojito02 added 1 commit 2026-07-29 20:52:55 +08:00
0899d1faaa drivers/sensors: add SHTC3 uORB driver
Signed-off-by: mojito02 <1786365650@qq.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b mojito02-shtc3-uorb-driver dev
git pull shtc3-uorb-driver

Step 2:

Merge the changes and update on Gitea.
git checkout dev
git merge --no-ff mojito02-shtc3-uorb-driver
git push origin dev
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: openvela/nuttx#3
No description provided.