[sensor]Add blood pressure sensor type (#5766)

This commit is contained in:
Tangyuxin 2022-04-05 19:35:23 +08:00 committed by GitHub
parent 6bd22f3e6f
commit 59e751eb2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -52,6 +52,7 @@ extern "C" {
#define RT_SENSOR_CLASS_SPO2 (18) /* SpO2 sensor */
#define RT_SENSOR_CLASS_IAQ (19) /* IAQ sensor. */
#define RT_SENSOR_CLASS_ETOH (20) /* EtOH sensor. */
#define RT_SENSOR_CLASS_BP (21) /* Blood Pressure */
/* Sensor vendor types */
@ -93,6 +94,7 @@ extern "C" {
#define RT_SENSOR_UNIT_DMS (16) /* Coordinates unit: DMS */
#define RT_SENSOR_UNIT_DD (17) /* Coordinates unit: DD */
#define RT_SENSOR_UNIT_MGM3 (18) /* Concentration unit: mg/m3 */
#define RT_SENSOR_UNIT_MMHG (19) /* Blood Pressure unit: mmHg */
/* Sensor communication interface types */
#define RT_SENSOR_INTF_I2C (1 << 0)
@ -192,6 +194,13 @@ struct sensor_3_axis
rt_int32_t z;
};
/* Blood Pressure Data Type */
struct sensor_bp
{
rt_int32_t sbp; /* SBP : systolic pressure */
rt_int32_t dbp; /* DBP : diastolic pressure */
};
struct coordinates
{
double longitude;
@ -223,6 +232,7 @@ struct rt_sensor_data
rt_uint32_t spo2; /* SpO2 sensor. unit: permillage */
rt_uint32_t iaq; /* IAQ sensor. unit: 1 */
rt_uint32_t etoh; /* EtOH sensor. unit: ppm */
struct sensor_bp bp; /* BloodPressure. unit: mmHg */
} data;
};

View File

@ -40,6 +40,7 @@ static char *const sensor_name_str[] =
"spo2_", /* SpO2 sensor */
"iaq_", /* IAQ sensor */
"etoh_", /* EtOH sensor */
"bp_" /* Blood Pressure */
};
/* Sensor interrupt correlation function */

View File

@ -80,6 +80,9 @@ static void sensor_show_data(rt_size_t num, rt_sensor_t sensor, struct rt_sensor
case RT_SENSOR_CLASS_ETOH:
LOG_I("num:%3d, EtOH:%5d.%03d ppm, timestamp:%5d", num, sensor_data->data.etoh / 1000, sensor_data->data.etoh % 1000, sensor_data->timestamp);
break;
case RT_SENSOR_CLASS_BP:
LOG_I("num:%3d, bp.sbp:%5d mmHg, bp.dbp:%5d mmHg, timestamp:%5d", num, sensor_data->data.bp.sbp, sensor_data->data.bp.dbp, sensor_data->timestamp);
break;
default:
break;
}
@ -409,6 +412,9 @@ static void sensor(int argc, char **argv)
case RT_SENSOR_UNIT_PPB:
rt_kprintf("unit :ppb\n");
break;
case RT_SENSOR_UNIT_MMHG:
rt_kprintf("unit :mmHg\n");
break;
}
rt_kprintf("range_max :%d\n", info.range_max);
rt_kprintf("range_min :%d\n", info.range_min);