Capstone project for Bachelor's in Mechanical Engineering 2011
Dependencies: FatFileSystem MAX3100 MODGPS MODSERIAL SDFileSystem mbed
UM6_config.h@0:0529d2d7762f, 2013-05-29 (annotated)
- Committer:
- lhiggs
- Date:
- Wed May 29 00:45:41 2013 +0000
- Revision:
- 0:0529d2d7762f
Broken, after updating all the libraries. RPC has issues with new mbed libraries.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lhiggs | 0:0529d2d7762f | 1 | /* ------------------------------------------------------------------------------ |
lhiggs | 0:0529d2d7762f | 2 | File: UM6_config.h |
lhiggs | 0:0529d2d7762f | 3 | Author: CH Robotics |
lhiggs | 0:0529d2d7762f | 4 | Version: 1.0 |
lhiggs | 0:0529d2d7762f | 5 | |
lhiggs | 0:0529d2d7762f | 6 | Description: Preprocessor definitions and function declarations for UM6 configuration |
lhiggs | 0:0529d2d7762f | 7 | ------------------------------------------------------------------------------ */ |
lhiggs | 0:0529d2d7762f | 8 | #ifndef __UM6_CONFIG_H |
lhiggs | 0:0529d2d7762f | 9 | #define __UM6_CONFIG_H |
lhiggs | 0:0529d2d7762f | 10 | |
lhiggs | 0:0529d2d7762f | 11 | //#include "CHR_matrix.h" |
lhiggs | 0:0529d2d7762f | 12 | #include "UM6_usart.h" |
lhiggs | 0:0529d2d7762f | 13 | |
lhiggs | 0:0529d2d7762f | 14 | |
lhiggs | 0:0529d2d7762f | 15 | // CONFIG_ARRAY_SIZE and DATA_ARRAY_SIZE specify the number of 32 bit configuration and data registers used by the firmware |
lhiggs | 0:0529d2d7762f | 16 | // (Note: The term "register" is used loosely here. These "registers" are not actually registers in the same sense of a |
lhiggs | 0:0529d2d7762f | 17 | // microcontroller register. They are simply index locations into arrays stored in global memory. Data and configuration |
lhiggs | 0:0529d2d7762f | 18 | // parameters are stored in arrays because it allows a common communication protocol to be used to access all data and |
lhiggs | 0:0529d2d7762f | 19 | // configuration. The software communicating with the sensor needs only specify the register address, and the communication |
lhiggs | 0:0529d2d7762f | 20 | // software running on the sensor knows exactly where to find it - it needn't know what the data is. The software communicatin |
lhiggs | 0:0529d2d7762f | 21 | // with the sensor, on the other hand, needs to know what it is asking for (naturally...) |
lhiggs | 0:0529d2d7762f | 22 | // This setup makes it easy to make more data immediately available when needed - simply increase the array size, add code in |
lhiggs | 0:0529d2d7762f | 23 | // the firmware that writes data to the new array location, and then make updates to the firmware definition on the PC side. |
lhiggs | 0:0529d2d7762f | 24 | #define CONFIG_ARRAY_SIZE 44 |
lhiggs | 0:0529d2d7762f | 25 | #define DATA_ARRAY_SIZE 33 |
lhiggs | 0:0529d2d7762f | 26 | #define COMMAND_COUNT 9 |
lhiggs | 0:0529d2d7762f | 27 | |
lhiggs | 0:0529d2d7762f | 28 | // |
lhiggs | 0:0529d2d7762f | 29 | #define CONFIG_REG_START_ADDRESS 0 |
lhiggs | 0:0529d2d7762f | 30 | #define DATA_REG_START_ADDRESS 85 |
lhiggs | 0:0529d2d7762f | 31 | #define COMMAND_START_ADDRESS 170 |
lhiggs | 0:0529d2d7762f | 32 | |
lhiggs | 0:0529d2d7762f | 33 | // These preprocessor definitions make it easier to access specific configuration parameters in code |
lhiggs | 0:0529d2d7762f | 34 | // They specify array locations associated with each register name. Note that in the comments below, many of the values are |
lhiggs | 0:0529d2d7762f | 35 | // said to be 32-bit IEEE floating point. Obviously this isn't directly the case, since the arrays are actually 32-bit unsigned |
lhiggs | 0:0529d2d7762f | 36 | // integer arrays. Bit for bit, the data does correspond to the correct floating point value. Since you can't cast ints as floats, |
lhiggs | 0:0529d2d7762f | 37 | // special conversion has to happen to copy the float data to and from the array. |
lhiggs | 0:0529d2d7762f | 38 | // Starting with configuration register locations... |
lhiggs | 0:0529d2d7762f | 39 | #define UM6_COMMUNICATION CONFIG_REG_START_ADDRESS // Stores settings in individual bits |
lhiggs | 0:0529d2d7762f | 40 | #define UM6_MISC_CONFIG (CONFIG_REG_START_ADDRESS + 1) // Stores settings in individual bits |
lhiggs | 0:0529d2d7762f | 41 | #define UM6_MAG_REF_X (CONFIG_REG_START_ADDRESS + 2) // Mag reference values are stored as 32-bit IEEE floating point values (these reflect data AFTER scale factors and compensation are applied) |
lhiggs | 0:0529d2d7762f | 42 | #define UM6_MAG_REF_Y (CONFIG_REG_START_ADDRESS + 3) |
lhiggs | 0:0529d2d7762f | 43 | #define UM6_MAG_REF_Z (CONFIG_REG_START_ADDRESS + 4) |
lhiggs | 0:0529d2d7762f | 44 | #define UM6_ACCEL_REF_X (CONFIG_REG_START_ADDRESS + 5) // Accel reference values are stored as 32-bit IEEE floating point values (these reflect data AFTER scale factors and compensation are applied) |
lhiggs | 0:0529d2d7762f | 45 | #define UM6_ACCEL_REF_Y (CONFIG_REG_START_ADDRESS + 6) |
lhiggs | 0:0529d2d7762f | 46 | #define UM6_ACCEL_REF_Z (CONFIG_REG_START_ADDRESS + 7) |
lhiggs | 0:0529d2d7762f | 47 | #define UM6_EKF_MAG_VARIANCE (CONFIG_REG_START_ADDRESS + 8) // Variances are stored as 32-bit IEEE floating point values. |
lhiggs | 0:0529d2d7762f | 48 | #define UM6_EKF_ACCEL_VARIANCE (CONFIG_REG_START_ADDRESS + 9) |
lhiggs | 0:0529d2d7762f | 49 | #define UM6_EKF_PROCESS_VARIANCE (CONFIG_REG_START_ADDRESS + 10) |
lhiggs | 0:0529d2d7762f | 50 | #define UM6_GYRO_BIAS_XY (CONFIG_REG_START_ADDRESS + 11) // Gyro biases are stored as 16-bit signed integers. Bias correction is applied BEFORE scale factors are applied |
lhiggs | 0:0529d2d7762f | 51 | #define UM6_GYRO_BIAS_Z (CONFIG_REG_START_ADDRESS + 12) |
lhiggs | 0:0529d2d7762f | 52 | #define UM6_ACCEL_BIAS_XY (CONFIG_REG_START_ADDRESS + 13) // Accel biases are stored as 16-bit signed integers. Bias correction is applied BEFORE scale factors are applied |
lhiggs | 0:0529d2d7762f | 53 | #define UM6_ACCEL_BIAS_Z (CONFIG_REG_START_ADDRESS + 14) |
lhiggs | 0:0529d2d7762f | 54 | #define UM6_MAG_BIAS_XY (CONFIG_REG_START_ADDRESS + 15) // Mag biases are stored as 16-bit signed integers. Bias correction is applied BEFORE magnetometer adjustment |
lhiggs | 0:0529d2d7762f | 55 | #define UM6_MAG_BIAS_Z (CONFIG_REG_START_ADDRESS + 16) |
lhiggs | 0:0529d2d7762f | 56 | #define UM6_ACCEL_CAL_00 (CONFIG_REG_START_ADDRESS + 17) // The accelerometer alignment matrix is a 3x3 matrix with 32-bit IEEE floating point entries |
lhiggs | 0:0529d2d7762f | 57 | #define UM6_ACCEL_CAL_01 (CONFIG_REG_START_ADDRESS + 18) |
lhiggs | 0:0529d2d7762f | 58 | #define UM6_ACCEL_CAL_02 (CONFIG_REG_START_ADDRESS + 19) |
lhiggs | 0:0529d2d7762f | 59 | #define UM6_ACCEL_CAL_10 (CONFIG_REG_START_ADDRESS + 20) |
lhiggs | 0:0529d2d7762f | 60 | #define UM6_ACCEL_CAL_11 (CONFIG_REG_START_ADDRESS + 21) |
lhiggs | 0:0529d2d7762f | 61 | #define UM6_ACCEL_CAL_12 (CONFIG_REG_START_ADDRESS + 22) |
lhiggs | 0:0529d2d7762f | 62 | #define UM6_ACCEL_CAL_20 (CONFIG_REG_START_ADDRESS + 23) |
lhiggs | 0:0529d2d7762f | 63 | #define UM6_ACCEL_CAL_21 (CONFIG_REG_START_ADDRESS + 24) |
lhiggs | 0:0529d2d7762f | 64 | #define UM6_ACCEL_CAL_22 (CONFIG_REG_START_ADDRESS + 25) |
lhiggs | 0:0529d2d7762f | 65 | #define UM6_GYRO_CAL_00 (CONFIG_REG_START_ADDRESS + 26) // The gyro alignment matrix is a 3x3 matrix with 32-bit IEEE floating point entries |
lhiggs | 0:0529d2d7762f | 66 | #define UM6_GYRO_CAL_01 (CONFIG_REG_START_ADDRESS + 27) |
lhiggs | 0:0529d2d7762f | 67 | #define UM6_GYRO_CAL_02 (CONFIG_REG_START_ADDRESS + 28) |
lhiggs | 0:0529d2d7762f | 68 | #define UM6_GYRO_CAL_10 (CONFIG_REG_START_ADDRESS + 29) |
lhiggs | 0:0529d2d7762f | 69 | #define UM6_GYRO_CAL_11 (CONFIG_REG_START_ADDRESS + 30) |
lhiggs | 0:0529d2d7762f | 70 | #define UM6_GYRO_CAL_12 (CONFIG_REG_START_ADDRESS + 31) |
lhiggs | 0:0529d2d7762f | 71 | #define UM6_GYRO_CAL_20 (CONFIG_REG_START_ADDRESS + 32) |
lhiggs | 0:0529d2d7762f | 72 | #define UM6_GYRO_CAL_21 (CONFIG_REG_START_ADDRESS + 33) |
lhiggs | 0:0529d2d7762f | 73 | #define UM6_GYRO_CAL_22 (CONFIG_REG_START_ADDRESS + 34) |
lhiggs | 0:0529d2d7762f | 74 | #define UM6_MAG_CAL_00 (CONFIG_REG_START_ADDRESS + 35) // The magnetometer calibration matrix is a 3x3 matrix with 32-bit IEEE floating point entries |
lhiggs | 0:0529d2d7762f | 75 | #define UM6_MAG_CAL_01 (CONFIG_REG_START_ADDRESS + 36) |
lhiggs | 0:0529d2d7762f | 76 | #define UM6_MAG_CAL_02 (CONFIG_REG_START_ADDRESS + 37) |
lhiggs | 0:0529d2d7762f | 77 | #define UM6_MAG_CAL_10 (CONFIG_REG_START_ADDRESS + 38) |
lhiggs | 0:0529d2d7762f | 78 | #define UM6_MAG_CAL_11 (CONFIG_REG_START_ADDRESS + 39) |
lhiggs | 0:0529d2d7762f | 79 | #define UM6_MAG_CAL_12 (CONFIG_REG_START_ADDRESS + 40) |
lhiggs | 0:0529d2d7762f | 80 | #define UM6_MAG_CAL_20 (CONFIG_REG_START_ADDRESS + 41) |
lhiggs | 0:0529d2d7762f | 81 | #define UM6_MAG_CAL_21 (CONFIG_REG_START_ADDRESS + 42) |
lhiggs | 0:0529d2d7762f | 82 | #define UM6_MAG_CAL_22 (CONFIG_REG_START_ADDRESS + 43) |
lhiggs | 0:0529d2d7762f | 83 | |
lhiggs | 0:0529d2d7762f | 84 | // Now for data register locations. |
lhiggs | 0:0529d2d7762f | 85 | // In the communication protocol, data registers are labeled with number ranging from 128 to 255. The value of 128 will be subtracted from these numbers |
lhiggs | 0:0529d2d7762f | 86 | // to produce the actual array index labeled below |
lhiggs | 0:0529d2d7762f | 87 | #define UM6_STATUS DATA_REG_START_ADDRESS // Status register defines error codes with individual bits |
lhiggs | 0:0529d2d7762f | 88 | #define UM6_GYRO_RAW_XY (DATA_REG_START_ADDRESS + 1) // Raw gyro data is stored in 16-bit signed integers |
lhiggs | 0:0529d2d7762f | 89 | #define UM6_GYRO_RAW_Z (DATA_REG_START_ADDRESS + 2) |
lhiggs | 0:0529d2d7762f | 90 | #define UM6_ACCEL_RAW_XY (DATA_REG_START_ADDRESS + 3) // Raw accel data is stored in 16-bit signed integers |
lhiggs | 0:0529d2d7762f | 91 | #define UM6_ACCEL_RAW_Z (DATA_REG_START_ADDRESS + 4) |
lhiggs | 0:0529d2d7762f | 92 | #define UM6_MAG_RAW_XY (DATA_REG_START_ADDRESS + 5) // Raw mag data is stored in 16-bit signed integers |
lhiggs | 0:0529d2d7762f | 93 | #define UM6_MAG_RAW_Z (DATA_REG_START_ADDRESS + 6) |
lhiggs | 0:0529d2d7762f | 94 | #define UM6_GYRO_PROC_XY (DATA_REG_START_ADDRESS + 7) // Processed gyro data has scale factors applied and alignment correction performed. Data is 16-bit signed integer. |
lhiggs | 0:0529d2d7762f | 95 | #define UM6_GYRO_PROC_Z (DATA_REG_START_ADDRESS + 8) |
lhiggs | 0:0529d2d7762f | 96 | #define UM6_ACCEL_PROC_XY (DATA_REG_START_ADDRESS + 9) // Processed accel data has scale factors applied and alignment correction performed. Data is 16-bit signed integer. |
lhiggs | 0:0529d2d7762f | 97 | #define UM6_ACCEL_PROC_Z (DATA_REG_START_ADDRESS + 10) |
lhiggs | 0:0529d2d7762f | 98 | #define UM6_MAG_PROC_XY (DATA_REG_START_ADDRESS + 11) // Processed mag data has scale factors applied and alignment correction performed. Data is 16-bit signed integer. |
lhiggs | 0:0529d2d7762f | 99 | #define UM6_MAG_PROC_Z (DATA_REG_START_ADDRESS + 12) |
lhiggs | 0:0529d2d7762f | 100 | #define UM6_EULER_PHI_THETA (DATA_REG_START_ADDRESS + 13) // Euler angles are 32-bit IEEE floating point |
lhiggs | 0:0529d2d7762f | 101 | #define UM6_EULER_PSI (DATA_REG_START_ADDRESS + 14) |
lhiggs | 0:0529d2d7762f | 102 | #define UM6_QUAT_AB (DATA_REG_START_ADDRESS + 15) // Quaternions are 16-bit signed integers. |
lhiggs | 0:0529d2d7762f | 103 | #define UM6_QUAT_CD (DATA_REG_START_ADDRESS + 16) |
lhiggs | 0:0529d2d7762f | 104 | #define UM6_ERROR_COV_00 (DATA_REG_START_ADDRESS + 17) // Error covariance is a 4x4 matrix of 32-bit IEEE floating point values |
lhiggs | 0:0529d2d7762f | 105 | #define UM6_ERROR_COV_01 (DATA_REG_START_ADDRESS + 18) |
lhiggs | 0:0529d2d7762f | 106 | #define UM6_ERROR_COV_02 (DATA_REG_START_ADDRESS + 19) |
lhiggs | 0:0529d2d7762f | 107 | #define UM6_ERROR_COV_03 (DATA_REG_START_ADDRESS + 20) |
lhiggs | 0:0529d2d7762f | 108 | #define UM6_ERROR_COV_10 (DATA_REG_START_ADDRESS + 21) |
lhiggs | 0:0529d2d7762f | 109 | #define UM6_ERROR_COV_11 (DATA_REG_START_ADDRESS + 22) |
lhiggs | 0:0529d2d7762f | 110 | #define UM6_ERROR_COV_12 (DATA_REG_START_ADDRESS + 23) |
lhiggs | 0:0529d2d7762f | 111 | #define UM6_ERROR_COV_13 (DATA_REG_START_ADDRESS + 24) |
lhiggs | 0:0529d2d7762f | 112 | #define UM6_ERROR_COV_20 (DATA_REG_START_ADDRESS + 25) |
lhiggs | 0:0529d2d7762f | 113 | #define UM6_ERROR_COV_21 (DATA_REG_START_ADDRESS + 26) |
lhiggs | 0:0529d2d7762f | 114 | #define UM6_ERROR_COV_22 (DATA_REG_START_ADDRESS + 27) |
lhiggs | 0:0529d2d7762f | 115 | #define UM6_ERROR_COV_23 (DATA_REG_START_ADDRESS + 28) |
lhiggs | 0:0529d2d7762f | 116 | #define UM6_ERROR_COV_30 (DATA_REG_START_ADDRESS + 29) |
lhiggs | 0:0529d2d7762f | 117 | #define UM6_ERROR_COV_31 (DATA_REG_START_ADDRESS + 30) |
lhiggs | 0:0529d2d7762f | 118 | #define UM6_ERROR_COV_32 (DATA_REG_START_ADDRESS + 31) |
lhiggs | 0:0529d2d7762f | 119 | #define UM6_ERROR_COV_33 (DATA_REG_START_ADDRESS + 32) |
lhiggs | 0:0529d2d7762f | 120 | |
lhiggs | 0:0529d2d7762f | 121 | // Finally, define some non-register registers... sometimes commands must be sent to the sensor - commands that don't involve the transmission of any data. |
lhiggs | 0:0529d2d7762f | 122 | // Like, for example, a command to zero rate gyros. Or whatever. These commands are given "register" addresses so that they can be sent using the same |
lhiggs | 0:0529d2d7762f | 123 | // communication framework used to set and read registers. The only difference is that when a command is received and no data is attached, the communication |
lhiggs | 0:0529d2d7762f | 124 | // code doesn't set any registers. |
lhiggs | 0:0529d2d7762f | 125 | // |
lhiggs | 0:0529d2d7762f | 126 | // The communication code will do two things for every packet received: |
lhiggs | 0:0529d2d7762f | 127 | // 1. Copy data to the relevant register if data was provided in the packet |
lhiggs | 0:0529d2d7762f | 128 | // 2. Call a "dispatch packet" function that performs additional functions if the packet requires it. |
lhiggs | 0:0529d2d7762f | 129 | // Step 2 is what handles commands and causes status packets to be returned. |
lhiggs | 0:0529d2d7762f | 130 | #define UM6_GET_FW_VERSION COMMAND_START_ADDRESS // Causes the UM6 to report the firmware revision |
lhiggs | 0:0529d2d7762f | 131 | #define UM6_FLASH_COMMIT (COMMAND_START_ADDRESS + 1) // Causes the UM6 to write all configuration values to FLASH |
lhiggs | 0:0529d2d7762f | 132 | #define UM6_ZERO_GYROS (COMMAND_START_ADDRESS + 2) // Causes the UM6 to start a zero gyros command |
lhiggs | 0:0529d2d7762f | 133 | #define UM6_RESET_EKF (COMMAND_START_ADDRESS + 3) // Causes the UM6 to reset the EKF |
lhiggs | 0:0529d2d7762f | 134 | #define UM6_GET_DATA (COMMAND_START_ADDRESS + 4) // Causes the UM6 to transmit a data packet containing data from all enabled channels |
lhiggs | 0:0529d2d7762f | 135 | #define UM6_SET_ACCEL_REF (COMMAND_START_ADDRESS + 5) // Causes the UM6 to set the current measured accel data to the reference vector |
lhiggs | 0:0529d2d7762f | 136 | #define UM6_SET_MAG_REF (COMMAND_START_ADDRESS + 6) // Causes the UM6 to set the current measured magnetometer data to the reference vector |
lhiggs | 0:0529d2d7762f | 137 | #define UM6_RESET_TO_FACTORY (COMMAND_START_ADDRESS + 7) // Causes the UM6 to load default factory settings |
lhiggs | 0:0529d2d7762f | 138 | |
lhiggs | 0:0529d2d7762f | 139 | #define UM6_SAVE_FACTORY (COMMAND_START_ADDRESS + 8) // Causes the UM6 to save the current settings to the factory flash location |
lhiggs | 0:0529d2d7762f | 140 | |
lhiggs | 0:0529d2d7762f | 141 | #define UM6_USE_CONFIG_ADDRESS 0 |
lhiggs | 0:0529d2d7762f | 142 | #define UM6_USE_FACTORY_ADDRESS 1 |
lhiggs | 0:0529d2d7762f | 143 | |
lhiggs | 0:0529d2d7762f | 144 | #define UM6_BAD_CHECKSUM 253 // Sent if the UM6 receives a packet with a bad checksum |
lhiggs | 0:0529d2d7762f | 145 | #define UM6_UNKNOWN_ADDRESS 254 // Sent if the UM6 receives a packet with an unknown address |
lhiggs | 0:0529d2d7762f | 146 | #define UM6_INVALID_BATCH_SIZE 255 // Sent if a requested batch read or write operation would go beyond the bounds of the config or data array |
lhiggs | 0:0529d2d7762f | 147 | |
lhiggs | 0:0529d2d7762f | 148 | // Now make even more definitions for writing data to specific registers |
lhiggs | 0:0529d2d7762f | 149 | // Start with the UM6_COMMUNICATION register. These definitions specify what individual bits in the regist mean |
lhiggs | 0:0529d2d7762f | 150 | #define UM6_BROADCAST_ENABLED (1 << 30) // Enable serial data transmission |
lhiggs | 0:0529d2d7762f | 151 | #define UM6_GYROS_RAW_ENABLED (1 << 29) // Enable transmission of raw gyro data |
lhiggs | 0:0529d2d7762f | 152 | #define UM6_ACCELS_RAW_ENABLED (1 << 28) // Enable transmission of raw accelerometer data |
lhiggs | 0:0529d2d7762f | 153 | #define UM6_MAG_RAW_ENABLED (1 << 27) // Enable transmission of raw magnetometer data |
lhiggs | 0:0529d2d7762f | 154 | #define UM6_GYROS_PROC_ENABLED (1 << 26) // Enable transmission of processed gyro data (biases removed, scale factor applied, rotation correction applied) |
lhiggs | 0:0529d2d7762f | 155 | #define UM6_ACCELS_PROC_ENABLED (1 << 25) // Enable transmission of processed accel data (biases removed, scale factor applied, rotation correction applied) |
lhiggs | 0:0529d2d7762f | 156 | #define UM6_MAG_PROC_ENABLED (1 << 24) // Enable transmission of processed mag data (biases removed, scale factor applied, rotation correction applied) |
lhiggs | 0:0529d2d7762f | 157 | #define UM6_QUAT_ENABLED (1 << 23) // Enable transmission of quaternion data |
lhiggs | 0:0529d2d7762f | 158 | #define UM6_EULER_ENABLED (1 << 22) // Enable transmission of euler angle data |
lhiggs | 0:0529d2d7762f | 159 | #define UM6_COV_ENABLED (1 << 21) // Enable transmission of state covariance data |
lhiggs | 0:0529d2d7762f | 160 | |
lhiggs | 0:0529d2d7762f | 161 | #define UM6_BAUD_RATE_MASK (0x07) // Mask specifying the number of bits used to set the serial baud rate |
lhiggs | 0:0529d2d7762f | 162 | #define UM6_BAUD_START_BIT 8 // Specifies the start location of the baud rate bits |
lhiggs | 0:0529d2d7762f | 163 | |
lhiggs | 0:0529d2d7762f | 164 | #define UM6_SERIAL_RATE_MASK (0x000FF) // Mask specifying which bits in this register are used to indicate the broadcast frequency |
lhiggs | 0:0529d2d7762f | 165 | |
lhiggs | 0:0529d2d7762f | 166 | // MISC Configuration register |
lhiggs | 0:0529d2d7762f | 167 | #define UM6_MAG_UPDATE_ENABLED (1 << 31) // Enable magnetometer-based updates in the EKF |
lhiggs | 0:0529d2d7762f | 168 | #define UM6_ACCEL_UPDATE_ENABLED (1 << 30) // Enable accelerometer-based updates in the EKF |
lhiggs | 0:0529d2d7762f | 169 | #define UM6_GYRO_STARTUP_CAL (1 << 29) // Enable automatic gyro calibration on startup |
lhiggs | 0:0529d2d7762f | 170 | #define UM6_QUAT_ESTIMATE_ENABLED (1 << 28) // Enable quaternion-based state estimation |
lhiggs | 0:0529d2d7762f | 171 | #define UM6_PPS_ENABLED (1 << 27) // Enable PPS support (requires connection to external PPS signal) |
lhiggs | 0:0529d2d7762f | 172 | |
lhiggs | 0:0529d2d7762f | 173 | // UM6 Status Register |
lhiggs | 0:0529d2d7762f | 174 | #define UM6_MAG_INIT_FAILED (1 << 31) // Indicates magnetometer initialization failed |
lhiggs | 0:0529d2d7762f | 175 | #define UM6_ACCEL_INIT_FAILED (1 << 30) // Indicates accelerometer initialization failed |
lhiggs | 0:0529d2d7762f | 176 | #define UM6_GYRO_INIT_FAILED (1 << 29) // Indicates gyro initialization failed |
lhiggs | 0:0529d2d7762f | 177 | #define UM6_GYRO_ST_FAILED_X (1 << 28) // Indicates that the x-axis gyro self test failed |
lhiggs | 0:0529d2d7762f | 178 | #define UM6_GYRO_ST_FAILED_Y (1 << 27) // Indicates that the y-axis gyro self test failed |
lhiggs | 0:0529d2d7762f | 179 | #define UM6_GYRO_ST_FAILED_Z (1 << 26) // Indicates that the z-axis gyro self test failed |
lhiggs | 0:0529d2d7762f | 180 | #define UM6_ACCEL_ST_FAILED_X (1 << 25) // Indicates that the x-axis accel self test failed |
lhiggs | 0:0529d2d7762f | 181 | #define UM6_ACCEL_ST_FAILED_Y (1 << 24) // Indicates that the y-axis accel self test failed |
lhiggs | 0:0529d2d7762f | 182 | #define UM6_ACCEL_ST_FAILED_Z (1 << 23) // Indicates that the z-axis accel self test failed |
lhiggs | 0:0529d2d7762f | 183 | #define UM6_MAG_ST_FAILED_X (1 << 22) // Indicates that the x-axis mag self test failed |
lhiggs | 0:0529d2d7762f | 184 | #define UM6_MAG_ST_FAILED_Y (1 << 21) // Indicates that the y-axis mag self test failed |
lhiggs | 0:0529d2d7762f | 185 | #define UM6_MAG_ST_FAILED_Z (1 << 20) // Indicates that the z-axis mag self test failed |
lhiggs | 0:0529d2d7762f | 186 | #define UM6_I2C_GYRO_BUS_ERROR (1 << 19) // Indicates that there was an i2c bus error while communicating with the rate gyros |
lhiggs | 0:0529d2d7762f | 187 | #define UM6_I2C_ACCEL_BUS_ERROR (1 << 18) // Indicates that there was an i2c bus error while communicating with the accelerometers |
lhiggs | 0:0529d2d7762f | 188 | #define UM6_I2C_MAG_BUS_ERROR (1 << 17) // Indicates that there was an i2c bus error while communicating with the magnetometer |
lhiggs | 0:0529d2d7762f | 189 | #define UM6_EKF_DIVERGENT (1 << 16) // Indicates that the EKF estimate failed and had to be restarted |
lhiggs | 0:0529d2d7762f | 190 | #define UM6_GYRO_UNRESPONSIVE (1 << 15) // Inidicates that the rate gyros failed to signal new data for longer than expected |
lhiggs | 0:0529d2d7762f | 191 | #define UM6_ACCEL_UNRESPONSIVE (1 << 14) // Indicates that the accelerometer failed to signal new data for longer than expected |
lhiggs | 0:0529d2d7762f | 192 | #define UM6_MAG_UNRESPONSIVE (1 << 13) // Indicates that the magnetometer failed to signal new data for longer than expected |
lhiggs | 0:0529d2d7762f | 193 | #define UM6_FLASH_WRITE_FAILED (1 << 12) // Indicates that a write to flash command failed to complete properly |
lhiggs | 0:0529d2d7762f | 194 | |
lhiggs | 0:0529d2d7762f | 195 | #define UM6_SELF_TEST_COMPLETE (1 << 0) // Indicates that a self-test was completed |
lhiggs | 0:0529d2d7762f | 196 | |
lhiggs | 0:0529d2d7762f | 197 | |
lhiggs | 0:0529d2d7762f | 198 | #define GYRO_ZERO_SAMPLE_SIZE 500 |
lhiggs | 0:0529d2d7762f | 199 | |
lhiggs | 0:0529d2d7762f | 200 | typedef struct __UM6_config { |
lhiggs | 0:0529d2d7762f | 201 | uint32_t r[CONFIG_ARRAY_SIZE]; |
lhiggs | 0:0529d2d7762f | 202 | } UM6_config; |
lhiggs | 0:0529d2d7762f | 203 | |
lhiggs | 0:0529d2d7762f | 204 | typedef struct __UM6_data { |
lhiggs | 0:0529d2d7762f | 205 | uint32_t r[DATA_ARRAY_SIZE]; |
lhiggs | 0:0529d2d7762f | 206 | } UM6_data; |
lhiggs | 0:0529d2d7762f | 207 | |
lhiggs | 0:0529d2d7762f | 208 | |
lhiggs | 0:0529d2d7762f | 209 | #endif |