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
8 /* Output, power supply */
9 #define ADIS16240_SUPPLY_OUT 0x02
10 /* Output, x-axis accelerometer */
11 #define ADIS16240_XACCL_OUT 0x04
12 /* Output, y-axis accelerometer */
13 #define ADIS16240_YACCL_OUT 0x06
14 /* Output, z-axis accelerometer */
15 #define ADIS16240_ZACCL_OUT 0x08
16 /* Output, auxiliary ADC input */
17 #define ADIS16240_AUX_ADC 0x0A
18 /* Output, temperature */
19 #define ADIS16240_TEMP_OUT 0x0C
20 /* Output, x-axis acceleration peak */
21 #define ADIS16240_XPEAK_OUT 0x0E
22 /* Output, y-axis acceleration peak */
23 #define ADIS16240_YPEAK_OUT 0x10
24 /* Output, z-axis acceleration peak */
25 #define ADIS16240_ZPEAK_OUT 0x12
26 /* Output, sum-of-squares acceleration peak */
27 #define ADIS16240_XYZPEAK_OUT 0x14
28 /* Output, Capture Buffer 1, X and Y acceleration */
29 #define ADIS16240_CAPT_BUF1 0x16
30 /* Output, Capture Buffer 2, Z acceleration */
31 #define ADIS16240_CAPT_BUF2 0x18
32 /* Diagnostic, error flags */
33 #define ADIS16240_DIAG_STAT 0x1A
34 /* Diagnostic, event counter */
35 #define ADIS16240_EVNT_CNTR 0x1C
36 /* Diagnostic, check sum value from firmware test */
37 #define ADIS16240_CHK_SUM 0x1E
38 /* Calibration, x-axis acceleration offset adjustment */
39 #define ADIS16240_XACCL_OFF 0x20
40 /* Calibration, y-axis acceleration offset adjustment */
41 #define ADIS16240_YACCL_OFF 0x22
42 /* Calibration, z-axis acceleration offset adjustment */
43 #define ADIS16240_ZACCL_OFF 0x24
44 /* Clock, hour and minute */
45 #define ADIS16240_CLK_TIME 0x2E
46 /* Clock, month and day */
47 #define ADIS16240_CLK_DATE 0x30
49 #define ADIS16240_CLK_YEAR 0x32
50 /* Wake-up setting, hour and minute */
51 #define ADIS16240_WAKE_TIME 0x34
52 /* Wake-up setting, month and day */
53 #define ADIS16240_WAKE_DATE 0x36
54 /* Alarm 1 amplitude threshold */
55 #define ADIS16240_ALM_MAG1 0x38
56 /* Alarm 2 amplitude threshold */
57 #define ADIS16240_ALM_MAG2 0x3A
59 #define ADIS16240_ALM_CTRL 0x3C
60 /* Capture, external trigger control */
61 #define ADIS16240_XTRIG_CTRL 0x3E
62 /* Capture, address pointer */
63 #define ADIS16240_CAPT_PNTR 0x40
64 /* Capture, configuration and control */
65 #define ADIS16240_CAPT_CTRL 0x42
66 /* General-purpose digital input/output control */
67 #define ADIS16240_GPIO_CTRL 0x44
68 /* Miscellaneous control */
69 #define ADIS16240_MSC_CTRL 0x46
70 /* Internal sample period (rate) control */
71 #define ADIS16240_SMPL_PRD 0x48
73 #define ADIS16240_GLOB_CMD 0x4A
76 /* Enables sum-of-squares output (XYZPEAK_OUT) */
77 #define ADIS16240_MSC_CTRL_XYZPEAK_OUT_EN BIT(15)
78 /* Enables peak tracking output (XPEAK_OUT, YPEAK_OUT, and ZPEAK_OUT) */
79 #define ADIS16240_MSC_CTRL_X_Y_ZPEAK_OUT_EN BIT(14)
80 /* Self-test enable: 1 = apply electrostatic force, 0 = disabled */
81 #define ADIS16240_MSC_CTRL_SELF_TEST_EN BIT(8)
82 /* Data-ready enable: 1 = enabled, 0 = disabled */
83 #define ADIS16240_MSC_CTRL_DATA_RDY_EN BIT(2)
84 /* Data-ready polarity: 1 = active high, 0 = active low */
85 #define ADIS16240_MSC_CTRL_ACTIVE_HIGH BIT(1)
86 /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */
87 #define ADIS16240_MSC_CTRL_DATA_RDY_DIO2 BIT(0)
90 /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */
91 #define ADIS16240_DIAG_STAT_ALARM2 BIT(9)
92 /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */
93 #define ADIS16240_DIAG_STAT_ALARM1 BIT(8)
94 /* Capture buffer full: 1 = capture buffer is full */
95 #define ADIS16240_DIAG_STAT_CPT_BUF_FUL BIT(7)
96 /* Flash test, checksum flag: 1 = mismatch, 0 = match */
97 #define ADIS16240_DIAG_STAT_CHKSUM BIT(6)
98 /* Power-on, self-test flag: 1 = failure, 0 = pass */
99 #define ADIS16240_DIAG_STAT_PWRON_FAIL_BIT 5
100 /* Power-on self-test: 1 = in-progress, 0 = complete */
101 #define ADIS16240_DIAG_STAT_PWRON_BUSY BIT(4)
102 /* SPI communications failure */
103 #define ADIS16240_DIAG_STAT_SPI_FAIL_BIT 3
104 /* Flash update failure */
105 #define ADIS16240_DIAG_STAT_FLASH_UPT_BIT 2
106 /* Power supply above 3.625 V */
107 #define ADIS16240_DIAG_STAT_POWER_HIGH_BIT 1
108 /* Power supply below 3.15 V */
109 #define ADIS16240_DIAG_STAT_POWER_LOW_BIT 0
112 #define ADIS16240_GLOB_CMD_RESUME BIT(8)
113 #define ADIS16240_GLOB_CMD_SW_RESET BIT(7)
114 #define ADIS16240_GLOB_CMD_STANDBY BIT(2)
116 #define ADIS16240_ERROR_ACTIVE BIT(14)
118 /* At the moment triggers are only used for ring buffer
119 * filling. This may change!
122 #define ADIS16240_SCAN_ACC_X 0
123 #define ADIS16240_SCAN_ACC_Y 1
124 #define ADIS16240_SCAN_ACC_Z 2
125 #define ADIS16240_SCAN_SUPPLY 3
126 #define ADIS16240_SCAN_AUX_ADC 4
127 #define ADIS16240_SCAN_TEMP 5
129 #endif /* SPI_ADIS16240_H_ */