diff options
| author | Bernard Xiong <[email protected]> | 2021-04-03 23:21:31 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-04-03 23:21:31 +0800 |
| commit | eec83be864a4659026c369d85cf77454547301be (patch) | |
| tree | 2cb2b24ee606296aabb9a1192bc25da37a3df15a /components | |
| parent | de1df3e308f488cbf285905a4f92da9aaef68430 (diff) | |
| parent | e6f9ecfe269f8c20793a1188780b32c1d4378f07 (diff) | |
Merge pull request #4564 from StackRyan/sensor0402
[add] add spo2 sensor support in drivers/include/drivers/sensor.h and…
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/include/drivers/sensor.h | 3 | ||||
| -rw-r--r-- | components/drivers/sensors/sensor.c | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/components/drivers/include/drivers/sensor.h b/components/drivers/include/drivers/sensor.h index d071893eed..e05006f9f6 100644 --- a/components/drivers/include/drivers/sensor.h +++ b/components/drivers/include/drivers/sensor.h @@ -49,6 +49,7 @@ extern "C" { #define RT_SENSOR_CLASS_ECO2 (15) /* eCO2 sensor */ #define RT_SENSOR_CLASS_GNSS (16) /* GPS/GNSS sensor */ #define RT_SENSOR_CLASS_TOF (17) /* TOF sensor */ +#define RT_SENSOR_CLASS_SPO2 (18) /* SpO2 sensor */ /* Sensor vendor types */ @@ -89,6 +90,7 @@ extern "C" { #define RT_SENSOR_UNIT_PPB (15) /* Concentration unit: ppb */ #define RT_SENSOR_UNIT_DMS (16) /* Coordinates unit: DMS */ #define RT_SENSOR_UNIT_DD (17) /* Coordinates unit: DD */ +#define RT_SENSOR_UNIT_PERCENT (18) /* Percentage unit: % */ /* Sensor communication interface types */ @@ -217,6 +219,7 @@ struct rt_sensor_data rt_int32_t force; /* Force sensor. unit: mN */ rt_uint32_t dust; /* Dust sensor. unit: ug/m3 */ rt_uint32_t eco2; /* eCO2 sensor. unit: ppm */ + rt_uint32_t spo2; /* SpO2 sensor. unit: % */ } data; }; diff --git a/components/drivers/sensors/sensor.c b/components/drivers/sensors/sensor.c index 6d584e568e..8d43a7a905 100644 --- a/components/drivers/sensors/sensor.c +++ b/components/drivers/sensors/sensor.c @@ -36,7 +36,8 @@ static char *const sensor_name_str[] = "dust_", /* Dust sensor */ "eco2_", /* eCO2 sensor */ "gnss_", /* GPS/GNSS sensor */ - "tof_" /* TOF sensor */ + "tof_", /* TOF sensor */ + "spo2_" /* SpO2 sensor */ }; /* Sensor interrupt correlation function */ |
