Go to the documentation of this file.
14 #ifndef SPI_LIS3L02DQ_H_
15 #define SPI_LIS3L02DQ_H_
16 #define LIS3L02DQ_READ_REG(a) ((a) | 0x80)
17 #define LIS3L02DQ_WRITE_REG(a) a
20 #define LIS3L02DQ_REG_OFFSET_X_ADDR 0x16
21 #define LIS3L02DQ_REG_OFFSET_Y_ADDR 0x17
22 #define LIS3L02DQ_REG_OFFSET_Z_ADDR 0x18
24 #define LIS3L02DQ_REG_GAIN_X_ADDR 0x19
25 #define LIS3L02DQ_REG_GAIN_Y_ADDR 0x1A
26 #define LIS3L02DQ_REG_GAIN_Z_ADDR 0x1B
29 #define LIS3L02DQ_REG_CTRL_1_ADDR 0x20
31 #define LIS3L02DQ_REG_CTRL_1_PD_ON 0xC0
34 #define LIS3L02DQ_DEC_MASK 0x30
35 #define LIS3L02DQ_REG_CTRL_1_DF_128 0x00
36 #define LIS3L02DQ_REG_CTRL_1_DF_64 0x10
37 #define LIS3L02DQ_REG_CTRL_1_DF_32 0x20
38 #define LIS3L02DQ_REG_CTRL_1_DF_8 (0x10 | 0x20)
41 #define LIS3L02DQ_REG_CTRL_1_SELF_TEST_ON 0x08
44 #define LIS3L02DQ_REG_CTRL_1_AXES_Z_ENABLE 0x04
45 #define LIS3L02DQ_REG_CTRL_1_AXES_Y_ENABLE 0x02
46 #define LIS3L02DQ_REG_CTRL_1_AXES_X_ENABLE 0x01
49 #define LIS3L02DQ_REG_CTRL_2_ADDR 0x21
52 #define LIS3L02DQ_REG_CTRL_2_BLOCK_UPDATE 0x40
55 #define LIS3L02DQ_REG_CTRL_2_BIG_ENDIAN 0x20
58 #define LIS3L02DQ_REG_CTRL_2_REBOOT_MEMORY 0x10
61 #define LIS3L02DQ_REG_CTRL_2_ENABLE_INTERRUPT 0x08
64 #define LIS3L02DQ_REG_CTRL_2_ENABLE_DATA_READY_GENERATION 0x04
67 #define LIS3L02DQ_REG_CTRL_2_THREE_WIRE_SPI_MODE 0x02
71 #define LIS3L02DQ_REG_CTRL_2_DATA_ALIGNMENT_16_BIT_LEFT_JUSTIFIED 0x01
74 #define LIS3L02DQ_REG_WAKE_UP_CFG_ADDR 0x23
77 #define LIS3L02DQ_REG_WAKE_UP_CFG_BOOLEAN_AND 0x80
81 #define LIS3L02DQ_REG_WAKE_UP_CFG_LATCH_SRC 0x40
84 #define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_Z_HIGH 0x20
86 #define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_Z_LOW 0x10
88 #define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_Y_HIGH 0x08
90 #define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_Y_LOW 0x04
92 #define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_X_HIGH 0x02
94 #define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_X_LOW 0x01
98 #define LIS3L02DQ_REG_WAKE_UP_SRC_ADDR 0x24
101 #define LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_ACTIVATED 0x40
103 #define LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_HIGH 0x20
104 #define LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_LOW 0x10
105 #define LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_HIGH 0x08
106 #define LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_LOW 0x04
107 #define LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_HIGH 0x02
108 #define LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_LOW 0x01
110 #define LIS3L02DQ_REG_WAKE_UP_ACK_ADDR 0x25
113 #define LIS3L02DQ_REG_STATUS_ADDR 0x27
115 #define LIS3L02DQ_REG_STATUS_XYZ_OVERRUN 0x80
116 #define LIS3L02DQ_REG_STATUS_Z_OVERRUN 0x40
117 #define LIS3L02DQ_REG_STATUS_Y_OVERRUN 0x20
118 #define LIS3L02DQ_REG_STATUS_X_OVERRUN 0x10
120 #define LIS3L02DQ_REG_STATUS_XYZ_NEW_DATA 0x08
121 #define LIS3L02DQ_REG_STATUS_Z_NEW_DATA 0x04
122 #define LIS3L02DQ_REG_STATUS_Y_NEW_DATA 0x02
123 #define LIS3L02DQ_REG_STATUS_X_NEW_DATA 0x01
127 #define LIS3L02DQ_REG_OUT_X_L_ADDR 0x28
128 #define LIS3L02DQ_REG_OUT_X_H_ADDR 0x29
129 #define LIS3L02DQ_REG_OUT_Y_L_ADDR 0x2A
130 #define LIS3L02DQ_REG_OUT_Y_H_ADDR 0x2B
131 #define LIS3L02DQ_REG_OUT_Z_L_ADDR 0x2C
132 #define LIS3L02DQ_REG_OUT_Z_H_ADDR 0x2D
136 #define LIS3L02DQ_REG_THS_L_ADDR 0x2E
137 #define LIS3L02DQ_REG_THS_H_ADDR 0x2F
139 #define LIS3L02DQ_DEFAULT_CTRL1 (LIS3L02DQ_REG_CTRL_1_PD_ON \
140 | LIS3L02DQ_REG_CTRL_1_AXES_Z_ENABLE \
141 | LIS3L02DQ_REG_CTRL_1_AXES_Y_ENABLE \
142 | LIS3L02DQ_REG_CTRL_1_AXES_X_ENABLE \
143 | LIS3L02DQ_REG_CTRL_1_DF_128)
145 #define LIS3L02DQ_DEFAULT_CTRL2 0
147 #define LIS3L02DQ_MAX_TX 12
148 #define LIS3L02DQ_MAX_RX 12
177 #ifdef CONFIG_IIO_BUFFER
187 #ifdef CONFIG_LIS3L02DQ_BUF_RING_SW
188 #define lis3l02dq_free_buf iio_sw_rb_free
189 #define lis3l02dq_alloc_buf iio_sw_rb_allocate
191 #ifdef CONFIG_LIS3L02DQ_BUF_KFIFO
192 #define lis3l02dq_free_buf iio_kfifo_free
193 #define lis3l02dq_alloc_buf iio_kfifo_allocate
196 #define lis3l02dq_th lis3l02dq_data_rdy_trig_poll
199 #define lis3l02dq_th lis3l02dq_nobuffer