未验证 提交 fd3eb65e 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #2331 from Guozhanxin/sensor_1

完善 Sensor
......@@ -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)
......
......@@ -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 */
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册