This source file includes following definitions.
- itg3200_remove_trigger
- itg3200_probe_trigger
- itg3200_buffer_configure
- itg3200_buffer_unconfigure
1
2
3
4
5
6
7
8
9
10
11 #ifndef I2C_ITG3200_H_
12 #define I2C_ITG3200_H_
13
14 #include <linux/iio/iio.h>
15
16
17 #define ITG3200_REG_ADDRESS 0x00
18
19
20
21
22 #define ITG3200_REG_SAMPLE_RATE_DIV 0x15
23
24
25 #define ITG3200_REG_DLPF 0x16
26
27 #define ITG3200_DLPF_FS_SEL_2000 0x18
28
29
30 #define ITG3200_DLPF_256_8 0x00
31 #define ITG3200_DLPF_188_1 0x01
32 #define ITG3200_DLPF_98_1 0x02
33 #define ITG3200_DLPF_42_1 0x03
34 #define ITG3200_DLPF_20_1 0x04
35 #define ITG3200_DLPF_10_1 0x05
36 #define ITG3200_DLPF_5_1 0x06
37
38 #define ITG3200_DLPF_CFG_MASK 0x07
39
40
41 #define ITG3200_REG_IRQ_CONFIG 0x17
42
43 #define ITG3200_IRQ_ACTIVE_LOW 0x80
44 #define ITG3200_IRQ_ACTIVE_HIGH 0x00
45
46 #define ITG3200_IRQ_OPEN_DRAIN 0x40
47 #define ITG3200_IRQ_PUSH_PULL 0x00
48
49 #define ITG3200_IRQ_LATCH_UNTIL_CLEARED 0x20
50 #define ITG3200_IRQ_LATCH_50US_PULSE 0x00
51
52 #define ITG3200_IRQ_LATCH_CLEAR_ANY 0x10
53 #define ITG3200_IRQ_LATCH_CLEAR_STATUS 0x00
54
55 #define ITG3200_IRQ_DEVICE_RDY_ENABLE 0x04
56
57 #define ITG3200_IRQ_DATA_RDY_ENABLE 0x01
58
59
60 #define ITG3200_REG_IRQ_STATUS 0x1A
61
62 #define ITG3200_IRQ_DEVICE_RDY_STATUS 0x04
63
64 #define ITG3200_IRQ_DATA_RDY_STATUS 0x01
65
66
67 #define ITG3200_REG_TEMP_OUT_H 0x1B
68 #define ITG3200_REG_TEMP_OUT_L 0x1C
69 #define ITG3200_REG_GYRO_XOUT_H 0x1D
70 #define ITG3200_REG_GYRO_XOUT_L 0x1E
71 #define ITG3200_REG_GYRO_YOUT_H 0x1F
72 #define ITG3200_REG_GYRO_YOUT_L 0x20
73 #define ITG3200_REG_GYRO_ZOUT_H 0x21
74 #define ITG3200_REG_GYRO_ZOUT_L 0x22
75
76
77 #define ITG3200_REG_POWER_MANAGEMENT 0x3E
78
79
80 #define ITG3200_RESET 0x80
81
82 #define ITG3200_SLEEP 0x40
83
84 #define ITG3200_STANDBY_GYRO_X 0x20
85 #define ITG3200_STANDBY_GYRO_Y 0x10
86 #define ITG3200_STANDBY_GYRO_Z 0x08
87
88 #define ITG3200_CLK_INTERNAL 0x00
89 #define ITG3200_CLK_GYRO_X 0x01
90 #define ITG3200_CLK_GYRO_Y 0x02
91 #define ITG3200_CLK_GYRO_Z 0x03
92 #define ITG3200_CLK_EXT_32K 0x04
93 #define ITG3200_CLK_EXT_19M 0x05
94
95
96
97
98
99
100
101 struct itg3200 {
102 struct i2c_client *i2c;
103 struct iio_trigger *trig;
104 struct iio_mount_matrix orientation;
105 };
106
107 enum ITG3200_SCAN_INDEX {
108 ITG3200_SCAN_TEMP,
109 ITG3200_SCAN_GYRO_X,
110 ITG3200_SCAN_GYRO_Y,
111 ITG3200_SCAN_GYRO_Z,
112 ITG3200_SCAN_ELEMENTS,
113 };
114
115 int itg3200_write_reg_8(struct iio_dev *indio_dev,
116 u8 reg_address, u8 val);
117
118 int itg3200_read_reg_8(struct iio_dev *indio_dev,
119 u8 reg_address, u8 *val);
120
121
122 #ifdef CONFIG_IIO_BUFFER
123
124 void itg3200_remove_trigger(struct iio_dev *indio_dev);
125 int itg3200_probe_trigger(struct iio_dev *indio_dev);
126
127 int itg3200_buffer_configure(struct iio_dev *indio_dev);
128 void itg3200_buffer_unconfigure(struct iio_dev *indio_dev);
129
130 #else
131
132 static inline void itg3200_remove_trigger(struct iio_dev *indio_dev)
133 {
134 }
135
136 static inline int itg3200_probe_trigger(struct iio_dev *indio_dev)
137 {
138 return 0;
139 }
140
141 static inline int itg3200_buffer_configure(struct iio_dev *indio_dev)
142 {
143 return 0;
144 }
145
146 static inline void itg3200_buffer_unconfigure(struct iio_dev *indio_dev)
147 {
148 }
149
150 #endif
151
152 #endif