[add] add spo2 sensor support in drivers/include/drivers/sensor.h and drivers/sensors/sensor.c

Signed-off-by: yuanjie <yuanjie@rt-thread.com>
This commit is contained in:
StackRyan 2021-04-02 21:32:00 +08:00 committed by yuanjie
parent 199f73c72d
commit e6f9ecfe26
2 changed files with 5 additions and 1 deletions

View File

@ -49,6 +49,7 @@ extern "C" {
#define RT_SENSOR_CLASS_ECO2 (15) /* eCO2 sensor */ #define RT_SENSOR_CLASS_ECO2 (15) /* eCO2 sensor */
#define RT_SENSOR_CLASS_GNSS (16) /* GPS/GNSS sensor */ #define RT_SENSOR_CLASS_GNSS (16) /* GPS/GNSS sensor */
#define RT_SENSOR_CLASS_TOF (17) /* TOF sensor */ #define RT_SENSOR_CLASS_TOF (17) /* TOF sensor */
#define RT_SENSOR_CLASS_SPO2 (18) /* SpO2 sensor */
/* Sensor vendor types */ /* Sensor vendor types */
@ -89,6 +90,7 @@ extern "C" {
#define RT_SENSOR_UNIT_PPB (15) /* Concentration unit: ppb */ #define RT_SENSOR_UNIT_PPB (15) /* Concentration unit: ppb */
#define RT_SENSOR_UNIT_DMS (16) /* Coordinates unit: DMS */ #define RT_SENSOR_UNIT_DMS (16) /* Coordinates unit: DMS */
#define RT_SENSOR_UNIT_DD (17) /* Coordinates unit: DD */ #define RT_SENSOR_UNIT_DD (17) /* Coordinates unit: DD */
#define RT_SENSOR_UNIT_PERCENT (18) /* Percentage unit: % */
/* Sensor communication interface types */ /* Sensor communication interface types */
@ -217,6 +219,7 @@ struct rt_sensor_data
rt_int32_t force; /* Force sensor. unit: mN */ rt_int32_t force; /* Force sensor. unit: mN */
rt_uint32_t dust; /* Dust sensor. unit: ug/m3 */ rt_uint32_t dust; /* Dust sensor. unit: ug/m3 */
rt_uint32_t eco2; /* eCO2 sensor. unit: ppm */ rt_uint32_t eco2; /* eCO2 sensor. unit: ppm */
rt_uint32_t spo2; /* SpO2 sensor. unit: % */
} data; } data;
}; };

View File

@ -36,7 +36,8 @@ static char *const sensor_name_str[] =
"dust_", /* Dust sensor */ "dust_", /* Dust sensor */
"eco2_", /* eCO2 sensor */ "eco2_", /* eCO2 sensor */
"gnss_", /* GPS/GNSS sensor */ "gnss_", /* GPS/GNSS sensor */
"tof_" /* TOF sensor */ "tof_", /* TOF sensor */
"spo2_" /* SpO2 sensor */
}; };
/* Sensor interrupt correlation function */ /* Sensor interrupt correlation function */