22#define rt_sensor_get_ts() time(RT_NULL)
24#define rt_sensor_get_ts() rt_tick_get()
27#define RT_PIN_NONE 0xFFFF
28#define RT_DEVICE_FLAG_FIFO_RX 0x200
30#define RT_SENSOR_MODULE_MAX (3)
34#define RT_SENSOR_CLASS_NONE (0)
35#define RT_SENSOR_CLASS_ACCE (1)
36#define RT_SENSOR_CLASS_GYRO (2)
37#define RT_SENSOR_CLASS_MAG (3)
38#define RT_SENSOR_CLASS_TEMP (4)
39#define RT_SENSOR_CLASS_HUMI (5)
40#define RT_SENSOR_CLASS_BARO (6)
41#define RT_SENSOR_CLASS_LIGHT (7)
42#define RT_SENSOR_CLASS_PROXIMITY (8)
43#define RT_SENSOR_CLASS_HR (9)
44#define RT_SENSOR_CLASS_TVOC (10)
45#define RT_SENSOR_CLASS_NOISE (11)
46#define RT_SENSOR_CLASS_STEP (12)
47#define RT_SENSOR_CLASS_FORCE (13)
48#define RT_SENSOR_CLASS_DUST (14)
49#define RT_SENSOR_CLASS_ECO2 (15)
50#define RT_SENSOR_CLASS_GNSS (16)
51#define RT_SENSOR_CLASS_TOF (17)
52#define RT_SENSOR_CLASS_SPO2 (18)
53#define RT_SENSOR_CLASS_IAQ (19)
54#define RT_SENSOR_CLASS_ETOH (20)
55#define RT_SENSOR_CLASS_BP (21)
56#define RT_SENSOR_CLASS_VOLTAGE (22)
57#define RT_SENSOR_CLASS_CURRENT (23)
58#define RT_SENSOR_CLASS_POWER (24)
62#define RT_SENSOR_VENDOR_UNKNOWN (0)
63#define RT_SENSOR_VENDOR_STM (1)
64#define RT_SENSOR_VENDOR_BOSCH (2)
65#define RT_SENSOR_VENDOR_INVENSENSE (3)
66#define RT_SENSOR_VENDOR_SEMTECH (4)
67#define RT_SENSOR_VENDOR_GOERTEK (5)
68#define RT_SENSOR_VENDOR_MIRAMEMS (6)
69#define RT_SENSOR_VENDOR_DALLAS (7)
70#define RT_SENSOR_VENDOR_ASAIR (8)
71#define RT_SENSOR_VENDOR_SHARP (9)
72#define RT_SENSOR_VENDOR_SENSIRION (10)
73#define RT_SENSOR_VENDOR_TI (11)
74#define RT_SENSOR_VENDOR_PLANTOWER (12)
75#define RT_SENSOR_VENDOR_AMS (13)
76#define RT_SENSOR_VENDOR_MAXIM (14)
77#define RT_SENSOR_VENDOR_MELEXIS (15)
81#define RT_SENSOR_UNIT_NONE (0)
82#define RT_SENSOR_UNIT_MG (1)
83#define RT_SENSOR_UNIT_MDPS (2)
84#define RT_SENSOR_UNIT_MGAUSS (3)
85#define RT_SENSOR_UNIT_LUX (4)
86#define RT_SENSOR_UNIT_CM (5)
87#define RT_SENSOR_UNIT_PA (6)
88#define RT_SENSOR_UNIT_PERMILLAGE (7)
89#define RT_SENSOR_UNIT_DCELSIUS (8)
90#define RT_SENSOR_UNIT_HZ (9)
91#define RT_SENSOR_UNIT_ONE (10)
92#define RT_SENSOR_UNIT_BPM (11)
93#define RT_SENSOR_UNIT_MM (12)
94#define RT_SENSOR_UNIT_MN (13)
95#define RT_SENSOR_UNIT_PPM (14)
96#define RT_SENSOR_UNIT_PPB (15)
97#define RT_SENSOR_UNIT_DMS (16)
98#define RT_SENSOR_UNIT_DD (17)
99#define RT_SENSOR_UNIT_MGM3 (18)
100#define RT_SENSOR_UNIT_MMHG (19)
101#define RT_SENSOR_UNIT_MV (20)
102#define RT_SENSOR_UNIT_MA (21)
103#define RT_SENSOR_UNIT_MW (22)
106#define RT_SENSOR_INTF_I2C (1 << 0)
107#define RT_SENSOR_INTF_SPI (1 << 1)
108#define RT_SENSOR_INTF_UART (1 << 2)
109#define RT_SENSOR_INTF_ONEWIRE (1 << 3)
113#define RT_SENSOR_POWER_NONE (0)
114#define RT_SENSOR_POWER_DOWN (1)
115#define RT_SENSOR_POWER_NORMAL (2)
116#define RT_SENSOR_POWER_LOW (3)
117#define RT_SENSOR_POWER_HIGH (4)
121#define RT_SENSOR_MODE_NONE (0)
122#define RT_SENSOR_MODE_POLLING (1)
123#define RT_SENSOR_MODE_INT (2)
124#define RT_SENSOR_MODE_FIFO (3)
128#define RT_SENSOR_CTRL_GET_ID (RT_DEVICE_CTRL_BASE(Sensor) + 0)
129#define RT_SENSOR_CTRL_GET_INFO (RT_DEVICE_CTRL_BASE(Sensor) + 1)
130#define RT_SENSOR_CTRL_SET_RANGE (RT_DEVICE_CTRL_BASE(Sensor) + 2)
131#define RT_SENSOR_CTRL_SET_ODR (RT_DEVICE_CTRL_BASE(Sensor) + 3)
132#define RT_SENSOR_CTRL_SET_MODE (RT_DEVICE_CTRL_BASE(Sensor) + 4)
133#define RT_SENSOR_CTRL_SET_POWER (RT_DEVICE_CTRL_BASE(Sensor) + 5)
134#define RT_SENSOR_CTRL_SELF_TEST (RT_DEVICE_CTRL_BASE(Sensor) + 6)
136#define RT_SENSOR_CTRL_USER_CMD_START 0x100
struct rt_mutex * rt_mutex_t
unsigned short rt_uint16_t
int rt_hw_sensor_register(rt_sensor_t sensor, const char *name, rt_uint32_t flag, void *data)
struct rt_sensor_device * rt_sensor_t
#define RT_SENSOR_MODULE_MAX
struct rt_sensor_device * rt_sensor_t
struct rt_sensor_intf intf
struct rt_device_pin_mode irq_pin
union rt_sensor_data::@022165123134134131071120365022351202312371364346 data
struct sensor_3_axis gyro
struct sensor_3_axis acce
struct rt_sensor_module * module
const struct rt_sensor_ops * ops
struct rt_sensor_info info
struct rt_sensor_config config
rt_err_t(* irq_handle)(rt_sensor_t sensor)
rt_sensor_t sen[RT_SENSOR_MODULE_MAX]
rt_ssize_t(* fetch_data)(struct rt_sensor_device *sensor, void *buf, rt_size_t len)
rt_err_t(* control)(struct rt_sensor_device *sensor, int cmd, void *arg)