1 #ifndef SPI_ADIS16240_H_
2 #define SPI_ADIS16240_H_
4 #define ADIS16240_STARTUP_DELAY 220 /* ms */
6 /* Flash memory write count */
7 #define ADIS16240_FLASH_CNT 0x00
9 /* Output, power supply */
10 #define ADIS16240_SUPPLY_OUT 0x02
12 /* Output, x-axis accelerometer */
13 #define ADIS16240_XACCL_OUT 0x04
15 /* Output, y-axis accelerometer */
16 #define ADIS16240_YACCL_OUT 0x06
18 /* Output, z-axis accelerometer */
19 #define ADIS16240_ZACCL_OUT 0x08
21 /* Output, auxiliary ADC input */
22 #define ADIS16240_AUX_ADC 0x0A
24 /* Output, temperature */
25 #define ADIS16240_TEMP_OUT 0x0C
27 /* Output, x-axis acceleration peak */
28 #define ADIS16240_XPEAK_OUT 0x0E
30 /* Output, y-axis acceleration peak */
31 #define ADIS16240_YPEAK_OUT 0x10
33 /* Output, z-axis acceleration peak */
34 #define ADIS16240_ZPEAK_OUT 0x12
36 /* Output, sum-of-squares acceleration peak */
37 #define ADIS16240_XYZPEAK_OUT 0x14
39 /* Output, Capture Buffer 1, X and Y acceleration */
40 #define ADIS16240_CAPT_BUF1 0x16
42 /* Output, Capture Buffer 2, Z acceleration */
43 #define ADIS16240_CAPT_BUF2 0x18
45 /* Diagnostic, error flags */
46 #define ADIS16240_DIAG_STAT 0x1A
48 /* Diagnostic, event counter */
49 #define ADIS16240_EVNT_CNTR 0x1C
51 /* Diagnostic, check sum value from firmware test */
52 #define ADIS16240_CHK_SUM 0x1E
54 /* Calibration, x-axis acceleration offset adjustment */
55 #define ADIS16240_XACCL_OFF 0x20
57 /* Calibration, y-axis acceleration offset adjustment */
58 #define ADIS16240_YACCL_OFF 0x22
60 /* Calibration, z-axis acceleration offset adjustment */
61 #define ADIS16240_ZACCL_OFF 0x24
63 /* Clock, hour and minute */
64 #define ADIS16240_CLK_TIME 0x2E
66 /* Clock, month and day */
67 #define ADIS16240_CLK_DATE 0x30
70 #define ADIS16240_CLK_YEAR 0x32
72 /* Wake-up setting, hour and minute */
73 #define ADIS16240_WAKE_TIME 0x34
75 /* Wake-up setting, month and day */
76 #define ADIS16240_WAKE_DATE 0x36
78 /* Alarm 1 amplitude threshold */
79 #define ADIS16240_ALM_MAG1 0x38
81 /* Alarm 2 amplitude threshold */
82 #define ADIS16240_ALM_MAG2 0x3A
85 #define ADIS16240_ALM_CTRL 0x3C
87 /* Capture, external trigger control */
88 #define ADIS16240_XTRIG_CTRL 0x3E
90 /* Capture, address pointer */
91 #define ADIS16240_CAPT_PNTR 0x40
93 /* Capture, configuration and control */
94 #define ADIS16240_CAPT_CTRL 0x42
96 /* General-purpose digital input/output control */
97 #define ADIS16240_GPIO_CTRL 0x44
99 /* Miscellaneous control */
100 #define ADIS16240_MSC_CTRL 0x46
102 /* Internal sample period (rate) control */
103 #define ADIS16240_SMPL_PRD 0x48
106 #define ADIS16240_GLOB_CMD 0x4A
110 /* Enables sum-of-squares output (XYZPEAK_OUT) */
111 #define ADIS16240_MSC_CTRL_XYZPEAK_OUT_EN BIT(15)
113 /* Enables peak tracking output (XPEAK_OUT, YPEAK_OUT, and ZPEAK_OUT) */
114 #define ADIS16240_MSC_CTRL_X_Y_ZPEAK_OUT_EN BIT(14)
116 /* Self-test enable: 1 = apply electrostatic force, 0 = disabled */
117 #define ADIS16240_MSC_CTRL_SELF_TEST_EN BIT(8)
119 /* Data-ready enable: 1 = enabled, 0 = disabled */
120 #define ADIS16240_MSC_CTRL_DATA_RDY_EN BIT(2)
122 /* Data-ready polarity: 1 = active high, 0 = active low */
123 #define ADIS16240_MSC_CTRL_ACTIVE_HIGH BIT(1)
125 /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */
126 #define ADIS16240_MSC_CTRL_DATA_RDY_DIO2 BIT(0)
130 /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */
131 #define ADIS16240_DIAG_STAT_ALARM2 BIT(9)
133 /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */
134 #define ADIS16240_DIAG_STAT_ALARM1 BIT(8)
136 /* Capture buffer full: 1 = capture buffer is full */
137 #define ADIS16240_DIAG_STAT_CPT_BUF_FUL BIT(7)
139 /* Flash test, checksum flag: 1 = mismatch, 0 = match */
140 #define ADIS16240_DIAG_STAT_CHKSUM BIT(6)
142 /* Power-on, self-test flag: 1 = failure, 0 = pass */
143 #define ADIS16240_DIAG_STAT_PWRON_FAIL_BIT 5
145 /* Power-on self-test: 1 = in-progress, 0 = complete */
146 #define ADIS16240_DIAG_STAT_PWRON_BUSY BIT(4)
148 /* SPI communications failure */
149 #define ADIS16240_DIAG_STAT_SPI_FAIL_BIT 3
151 /* Flash update failure */
152 #define ADIS16240_DIAG_STAT_FLASH_UPT_BIT 2
154 /* Power supply above 3.625 V */
155 #define ADIS16240_DIAG_STAT_POWER_HIGH_BIT 1
157 /* Power supply below 3.15 V */
158 #define ADIS16240_DIAG_STAT_POWER_LOW_BIT 0
162 #define ADIS16240_GLOB_CMD_RESUME BIT(8)
163 #define ADIS16240_GLOB_CMD_SW_RESET BIT(7)
164 #define ADIS16240_GLOB_CMD_STANDBY BIT(2)
166 #define ADIS16240_ERROR_ACTIVE BIT(14)
168 /* At the moment triggers are only used for ring buffer
169 * filling. This may change!
172 #define ADIS16240_SCAN_ACC_X 0
173 #define ADIS16240_SCAN_ACC_Y 1
174 #define ADIS16240_SCAN_ACC_Z 2
175 #define ADIS16240_SCAN_SUPPLY 3
176 #define ADIS16240_SCAN_AUX_ADC 4
177 #define ADIS16240_SCAN_TEMP 5
179 #endif /* SPI_ADIS16240_H_ */