Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 1 | #ifndef SPI_ADIS16209_H_ |
| 2 | #define SPI_ADIS16209_H_ |
| 3 | |
| 4 | #define ADIS16209_STARTUP_DELAY 220 /* ms */ |
| 5 | |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 6 | /* Flash memory write count */ |
| 7 | #define ADIS16209_FLASH_CNT 0x00 |
| 8 | /* Output, power supply */ |
| 9 | #define ADIS16209_SUPPLY_OUT 0x02 |
| 10 | /* Output, x-axis accelerometer */ |
| 11 | #define ADIS16209_XACCL_OUT 0x04 |
| 12 | /* Output, y-axis accelerometer */ |
| 13 | #define ADIS16209_YACCL_OUT 0x06 |
| 14 | /* Output, auxiliary ADC input */ |
| 15 | #define ADIS16209_AUX_ADC 0x08 |
| 16 | /* Output, temperature */ |
| 17 | #define ADIS16209_TEMP_OUT 0x0A |
| 18 | /* Output, x-axis inclination */ |
| 19 | #define ADIS16209_XINCL_OUT 0x0C |
| 20 | /* Output, y-axis inclination */ |
| 21 | #define ADIS16209_YINCL_OUT 0x0E |
| 22 | /* Output, +/-180 vertical rotational position */ |
| 23 | #define ADIS16209_ROT_OUT 0x10 |
| 24 | /* Calibration, x-axis acceleration offset null */ |
| 25 | #define ADIS16209_XACCL_NULL 0x12 |
| 26 | /* Calibration, y-axis acceleration offset null */ |
| 27 | #define ADIS16209_YACCL_NULL 0x14 |
| 28 | /* Calibration, x-axis inclination offset null */ |
| 29 | #define ADIS16209_XINCL_NULL 0x16 |
| 30 | /* Calibration, y-axis inclination offset null */ |
| 31 | #define ADIS16209_YINCL_NULL 0x18 |
| 32 | /* Calibration, vertical rotation offset null */ |
| 33 | #define ADIS16209_ROT_NULL 0x1A |
| 34 | /* Alarm 1 amplitude threshold */ |
| 35 | #define ADIS16209_ALM_MAG1 0x20 |
| 36 | /* Alarm 2 amplitude threshold */ |
| 37 | #define ADIS16209_ALM_MAG2 0x22 |
| 38 | /* Alarm 1, sample period */ |
| 39 | #define ADIS16209_ALM_SMPL1 0x24 |
| 40 | /* Alarm 2, sample period */ |
| 41 | #define ADIS16209_ALM_SMPL2 0x26 |
| 42 | /* Alarm control */ |
| 43 | #define ADIS16209_ALM_CTRL 0x28 |
| 44 | /* Auxiliary DAC data */ |
| 45 | #define ADIS16209_AUX_DAC 0x30 |
| 46 | /* General-purpose digital input/output control */ |
| 47 | #define ADIS16209_GPIO_CTRL 0x32 |
| 48 | /* Miscellaneous control */ |
| 49 | #define ADIS16209_MSC_CTRL 0x34 |
| 50 | /* Internal sample period (rate) control */ |
| 51 | #define ADIS16209_SMPL_PRD 0x36 |
| 52 | /* Operation, filter configuration */ |
| 53 | #define ADIS16209_AVG_CNT 0x38 |
| 54 | /* Operation, sleep mode control */ |
| 55 | #define ADIS16209_SLP_CNT 0x3A |
| 56 | /* Diagnostics, system status register */ |
| 57 | #define ADIS16209_DIAG_STAT 0x3C |
| 58 | /* Operation, system command register */ |
| 59 | #define ADIS16209_GLOB_CMD 0x3E |
| 60 | |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 61 | /* MSC_CTRL */ |
| 62 | /* Self-test at power-on: 1 = disabled, 0 = enabled */ |
Haneen Mohammed | 0c76706 | 2015-03-22 21:23:23 +0300 | [diff] [blame] | 63 | #define ADIS16209_MSC_CTRL_PWRUP_SELF_TEST BIT(10) |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 64 | /* Self-test enable */ |
Haneen Mohammed | 0c76706 | 2015-03-22 21:23:23 +0300 | [diff] [blame] | 65 | #define ADIS16209_MSC_CTRL_SELF_TEST_EN BIT(8) |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 66 | /* Data-ready enable: 1 = enabled, 0 = disabled */ |
Haneen Mohammed | 0c76706 | 2015-03-22 21:23:23 +0300 | [diff] [blame] | 67 | #define ADIS16209_MSC_CTRL_DATA_RDY_EN BIT(2) |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 68 | /* Data-ready polarity: 1 = active high, 0 = active low */ |
Haneen Mohammed | 0c76706 | 2015-03-22 21:23:23 +0300 | [diff] [blame] | 69 | #define ADIS16209_MSC_CTRL_ACTIVE_HIGH BIT(1) |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 70 | /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */ |
Haneen Mohammed | 0c76706 | 2015-03-22 21:23:23 +0300 | [diff] [blame] | 71 | #define ADIS16209_MSC_CTRL_DATA_RDY_DIO2 BIT(0) |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 72 | |
| 73 | /* DIAG_STAT */ |
| 74 | /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */ |
Haneen Mohammed | 0c76706 | 2015-03-22 21:23:23 +0300 | [diff] [blame] | 75 | #define ADIS16209_DIAG_STAT_ALARM2 BIT(9) |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 76 | /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */ |
Haneen Mohammed | 0c76706 | 2015-03-22 21:23:23 +0300 | [diff] [blame] | 77 | #define ADIS16209_DIAG_STAT_ALARM1 BIT(8) |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 78 | /* Self-test diagnostic error flag: 1 = error condition, 0 = normal operation */ |
Lars-Peter Clausen | 511fb29 | 2012-11-13 13:28:00 +0000 | [diff] [blame] | 79 | #define ADIS16209_DIAG_STAT_SELFTEST_FAIL_BIT 5 |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 80 | /* SPI communications failure */ |
Lars-Peter Clausen | 511fb29 | 2012-11-13 13:28:00 +0000 | [diff] [blame] | 81 | #define ADIS16209_DIAG_STAT_SPI_FAIL_BIT 3 |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 82 | /* Flash update failure */ |
Lars-Peter Clausen | 511fb29 | 2012-11-13 13:28:00 +0000 | [diff] [blame] | 83 | #define ADIS16209_DIAG_STAT_FLASH_UPT_BIT 2 |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 84 | /* Power supply above 3.625 V */ |
Lars-Peter Clausen | 511fb29 | 2012-11-13 13:28:00 +0000 | [diff] [blame] | 85 | #define ADIS16209_DIAG_STAT_POWER_HIGH_BIT 1 |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 86 | /* Power supply below 3.15 V */ |
Lars-Peter Clausen | 511fb29 | 2012-11-13 13:28:00 +0000 | [diff] [blame] | 87 | #define ADIS16209_DIAG_STAT_POWER_LOW_BIT 0 |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 88 | |
| 89 | /* GLOB_CMD */ |
Haneen Mohammed | 0c76706 | 2015-03-22 21:23:23 +0300 | [diff] [blame] | 90 | #define ADIS16209_GLOB_CMD_SW_RESET BIT(7) |
| 91 | #define ADIS16209_GLOB_CMD_CLEAR_STAT BIT(4) |
| 92 | #define ADIS16209_GLOB_CMD_FACTORY_CAL BIT(1) |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 93 | |
Haneen Mohammed | 0c76706 | 2015-03-22 21:23:23 +0300 | [diff] [blame] | 94 | #define ADIS16209_ERROR_ACTIVE BIT(14) |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 95 | |
Jonathan Cameron | 69584bd | 2010-07-11 16:39:15 +0100 | [diff] [blame] | 96 | #define ADIS16209_SCAN_SUPPLY 0 |
| 97 | #define ADIS16209_SCAN_ACC_X 1 |
| 98 | #define ADIS16209_SCAN_ACC_Y 2 |
| 99 | #define ADIS16209_SCAN_AUX_ADC 3 |
| 100 | #define ADIS16209_SCAN_TEMP 4 |
| 101 | #define ADIS16209_SCAN_INCLI_X 5 |
| 102 | #define ADIS16209_SCAN_INCLI_Y 6 |
| 103 | #define ADIS16209_SCAN_ROT 7 |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 104 | |
Barry Song | 671ece1 | 2010-05-07 15:38:59 +0100 | [diff] [blame] | 105 | #endif /* SPI_ADIS16209_H_ */ |