1#ifndef SPI_ADIS16201_H_
2#define SPI_ADIS16201_H_
3
4#define ADIS16201_STARTUP_DELAY	220 /* ms */
5
6#define ADIS16201_FLASH_CNT      0x00 /* Flash memory write count */
7#define ADIS16201_SUPPLY_OUT     0x02 /* Output, power supply */
8#define ADIS16201_XACCL_OUT      0x04 /* Output, x-axis accelerometer */
9#define ADIS16201_YACCL_OUT      0x06 /* Output, y-axis accelerometer */
10#define ADIS16201_AUX_ADC        0x08 /* Output, auxiliary ADC input */
11#define ADIS16201_TEMP_OUT       0x0A /* Output, temperature */
12#define ADIS16201_XINCL_OUT      0x0C /* Output, x-axis inclination */
13#define ADIS16201_YINCL_OUT      0x0E /* Output, y-axis inclination */
14#define ADIS16201_XACCL_OFFS     0x10 /* Calibration, x-axis acceleration offset */
15#define ADIS16201_YACCL_OFFS     0x12 /* Calibration, y-axis acceleration offset */
16#define ADIS16201_XACCL_SCALE    0x14 /* x-axis acceleration scale factor */
17#define ADIS16201_YACCL_SCALE    0x16 /* y-axis acceleration scale factor */
18#define ADIS16201_XINCL_OFFS     0x18 /* Calibration, x-axis inclination offset */
19#define ADIS16201_YINCL_OFFS     0x1A /* Calibration, y-axis inclination offset */
20#define ADIS16201_XINCL_SCALE    0x1C /* x-axis inclination scale factor */
21#define ADIS16201_YINCL_SCALE    0x1E /* y-axis inclination scale factor */
22#define ADIS16201_ALM_MAG1       0x20 /* Alarm 1 amplitude threshold */
23#define ADIS16201_ALM_MAG2       0x22 /* Alarm 2 amplitude threshold */
24#define ADIS16201_ALM_SMPL1      0x24 /* Alarm 1, sample period */
25#define ADIS16201_ALM_SMPL2      0x26 /* Alarm 2, sample period */
26#define ADIS16201_ALM_CTRL       0x28 /* Alarm control */
27#define ADIS16201_AUX_DAC        0x30 /* Auxiliary DAC data */
28#define ADIS16201_GPIO_CTRL      0x32 /* General-purpose digital input/output control */
29#define ADIS16201_MSC_CTRL       0x34 /* Miscellaneous control */
30#define ADIS16201_SMPL_PRD       0x36 /* Internal sample period (rate) control */
31#define ADIS16201_AVG_CNT        0x38 /* Operation, filter configuration */
32#define ADIS16201_SLP_CNT        0x3A /* Operation, sleep mode control */
33#define ADIS16201_DIAG_STAT      0x3C /* Diagnostics, system status register */
34#define ADIS16201_GLOB_CMD       0x3E /* Operation, system command register */
35
36/* MSC_CTRL */
37#define ADIS16201_MSC_CTRL_SELF_TEST_EN	        (1 << 8)  /* Self-test enable */
38#define ADIS16201_MSC_CTRL_DATA_RDY_EN	        (1 << 2)  /* Data-ready enable: 1 = enabled, 0 = disabled */
39#define ADIS16201_MSC_CTRL_ACTIVE_HIGH	        (1 << 1)  /* Data-ready polarity: 1 = active high, 0 = active low */
40#define ADIS16201_MSC_CTRL_DATA_RDY_DIO1	(1 << 0)  /* Data-ready line selection: 1 = DIO1, 0 = DIO0 */
41
42/* DIAG_STAT */
43#define ADIS16201_DIAG_STAT_ALARM2        (1<<9) /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */
44#define ADIS16201_DIAG_STAT_ALARM1        (1<<8) /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */
45#define ADIS16201_DIAG_STAT_SPI_FAIL_BIT   3 /* SPI communications failure */
46#define ADIS16201_DIAG_STAT_FLASH_UPT_BIT  2 /* Flash update failure */
47#define ADIS16201_DIAG_STAT_POWER_HIGH_BIT 1 /* Power supply above 3.625 V */
48#define ADIS16201_DIAG_STAT_POWER_LOW_BIT  0 /* Power supply below 3.15 V */
49
50/* GLOB_CMD */
51#define ADIS16201_GLOB_CMD_SW_RESET	(1<<7)
52#define ADIS16201_GLOB_CMD_FACTORY_CAL	(1<<1)
53
54#define ADIS16201_ERROR_ACTIVE          (1<<14)
55
56enum adis16201_scan {
57	ADIS16201_SCAN_ACC_X,
58	ADIS16201_SCAN_ACC_Y,
59	ADIS16201_SCAN_INCLI_X,
60	ADIS16201_SCAN_INCLI_Y,
61	ADIS16201_SCAN_SUPPLY,
62	ADIS16201_SCAN_AUX_ADC,
63	ADIS16201_SCAN_TEMP,
64};
65
66#endif /* SPI_ADIS16201_H_ */
67