drivers/sensors: add SGP30 uORB driver #1
Loading…
Reference in New Issue
No description provided.
Delete Branch "mojito02/nuttx:sgp30-uorb-driver"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Changes
All changes to existing files are pure additions; no existing function is
modified or removed, so current users of the character-device driver are
unaffected.
Summary
Add a uORB-based driver for the Sensirion SGP30 air quality sensor
(CO2eq / TVOC), complementing the existing character-device driver
(
sgp30.c).The existing
sgp30.cexposes the SGP30 through a POSIX characterdevice. This patch adds
sgp30_uorb.c, which registers the sensor withthe uORB sensor framework (
SENSOR_TYPE_CO2andSENSOR_TYPE_TVOC).The two interfaces are mutually exclusive and selected by
CONFIG_SENSORS_SGP30_UORB, following the same pattern already used bythe BMP180 driver (
bmp180.c/bmp180_uorb.c).Why
The SGP30 differs from most environmental sensors in that it requires a
sustained 1 Hz measurement cadence to maintain its internal baseline
compensation. A character device that only measures inside
read()cannot guarantee that cadence, so readings degrade when the application
polls irregularly.
This driver runs a dedicated sampling thread at a configurable interval
(
CONFIG_SENSORS_SGP30_POLL_INTERVAL, default 1 s) and publishes touORB, so any number of consumers can subscribe without affecting the
sensor's timing requirements.
Implementation notes
SENSOR_TYPE_CO2andSENSOR_TYPE_TVOCconsumers
state (warming up / valid / saturated / stale / I/O error), so
consumers can distinguish "sensor still warming up" from "sensor
failed"
of the sensor rather than leaving it permanently stuck
Testing
Tested on an Allwinner R528 board with an SGP30 on I2C (address 0x58):
Notes
The driver contains no platform-specific code; it depends only on
standard NuttX interfaces (
i2c_master,sensors/sensor.h,kthread,mutex). The existing character-device driver and its Kconfig optionsare left unchanged, so current users are unaffected.
合并请求描述
[简要描述本次合并请求的目的和主要内容]
相关Issue
关联Issue编号:#{Issue编号}
变更内容
1. 增强了xxx
Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Gitea.