From 3d9c30645451f05a98d5432742ade462e7b2052f Mon Sep 17 00:00:00 2001 From: guozhanxin Date: Thu, 14 Feb 2019 19:49:50 +0800 Subject: [PATCH 1/2] [sensor] change heart rate unit form 'HZ' to 'bpm'. --- components/drivers/sensors/sensor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/drivers/sensors/sensor.h b/components/drivers/sensors/sensor.h index f6afdb6dbb..083c12ca3f 100644 --- a/components/drivers/sensors/sensor.h +++ b/components/drivers/sensors/sensor.h @@ -67,6 +67,7 @@ extern "C" { #define RT_SENSOR_UNIT_DCELSIUS (8) /* Temperature unit: dCelsius */ #define RT_SENSOR_UNIT_HZ (9) /* Frequency unit: HZ */ #define RT_SENSOR_UNIT_ONE (10) /* Dimensionless quantity unit: 1 */ +#define RT_SENSOR_UNIT_BPM (11) /* Heart rate unit: bpm */ /* Sensor communication interface types */ @@ -176,7 +177,7 @@ struct rt_sensor_data rt_int32_t baro; /* Pressure. unit: pascal (Pa) */ rt_int32_t light; /* Light. unit: lux */ rt_int32_t proximity; /* Distance. unit: centimeters */ - rt_int32_t hr; /* Heat rate. unit: HZ */ + rt_int32_t hr; /* Heart rate. unit: bpm */ rt_int32_t tvoc; /* TVOC. unit: permillage */ rt_int32_t noise; /* Noise Loudness. unit: HZ */ rt_uint32_t step; /* Step sensor. unit: 1 */ From fb9482d61b095650ecdcf4de7004240162fc71c6 Mon Sep 17 00:00:00 2001 From: guozhanxin Date: Fri, 15 Feb 2019 10:39:48 +0800 Subject: [PATCH 2/2] [sensor] change RT_SENSOR_FLAG_FIFO to RT_DEVICE_FLAG_FIFO_RX --- components/drivers/sensors/sensor.c | 2 +- components/drivers/sensors/sensor.h | 2 +- components/drivers/sensors/sensor_cmd.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/drivers/sensors/sensor.c b/components/drivers/sensors/sensor.c index 98a0e8aa74..0c21f04b6f 100644 --- a/components/drivers/sensors/sensor.c +++ b/components/drivers/sensors/sensor.c @@ -179,7 +179,7 @@ static rt_err_t rt_sensor_open(rt_device_t dev, rt_uint16_t oflag) rt_sensor_irq_init(sensor); } } - else if (oflag & RT_SENSOR_FLAG_FIFO && dev->flag & RT_SENSOR_FLAG_FIFO) + else if (oflag & RT_DEVICE_FLAG_FIFO_RX && dev->flag & RT_DEVICE_FLAG_FIFO_RX) { /* If fifo mode is supported, configure it to fifo mode */ if (sensor->ops->control(sensor, RT_SENSOR_CTRL_SET_MODE, (void *)RT_SENSOR_MODE_FIFO) == RT_EOK) diff --git a/components/drivers/sensors/sensor.h b/components/drivers/sensors/sensor.h index 083c12ca3f..fd437e4e09 100644 --- a/components/drivers/sensors/sensor.h +++ b/components/drivers/sensors/sensor.h @@ -25,7 +25,7 @@ extern "C" { #endif #define RT_PIN_NONE 0xFFFF /* RT PIN NONE */ -#define RT_SENSOR_FLAG_FIFO 0x200 /* Flag to use when the sensor is open by fifo mode */ +#define RT_DEVICE_FLAG_FIFO_RX 0x200 /* Flag to use when the sensor is open by fifo mode */ #define RT_SENSOR_MODULE_MAX (3) /* The maximum number of members of a sensor module */ diff --git a/components/drivers/sensors/sensor_cmd.c b/components/drivers/sensors/sensor_cmd.c index d1c7057c2f..b6dd471988 100644 --- a/components/drivers/sensors/sensor_cmd.c +++ b/components/drivers/sensors/sensor_cmd.c @@ -119,7 +119,7 @@ static void sensor_fifo(int argc, char **argv) rt_device_set_rx_indicate(dev, rx_callback); - if (rt_device_open(dev, RT_SENSOR_FLAG_FIFO) != RT_EOK) + if (rt_device_open(dev, RT_DEVICE_FLAG_FIFO_RX) != RT_EOK) { LOG_E("open device failed!"); return;