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 f6afdb6dbb..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 */ @@ -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 */ 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;