|
2 | 2 | #include "ICM_20948_REGISTERS.h" |
3 | 3 | #include "AK09916_REGISTERS.h" |
4 | 4 |
|
| 5 | +/* |
| 6 | + * Icm20948 device require a DMP image to be loaded on init |
| 7 | + * Provide such images by mean of a byte array |
| 8 | +*/ |
| 9 | +#if defined(ICM_20948_USE_DMP) // Only include the 93KBytes of DMP if ICM_20948_USE_DMP is defined |
| 10 | + const uint8_t dmp3_image[] = { |
| 11 | + #include "icm20948_img.dmp3a.h" |
| 12 | + }; |
| 13 | +#endif |
| 14 | + |
| 15 | +// ICM-20948 data is big-endian. We need to make it little-endian when writing into icm_20948_DMP_data_t |
| 16 | +const int DMP_Quat9_Byte_Ordering[icm_20948_DMP_Quat9_Bytes] = |
| 17 | +{ |
| 18 | + 3,2,1,0,7,6,5,4,11,10,9,8,13,12 // Also used for Geomag |
| 19 | +}; |
| 20 | +const int DMP_Quat6_Byte_Ordering[icm_20948_DMP_Quat6_Bytes] = |
| 21 | +{ |
| 22 | + 3,2,1,0,7,6,5,4,11,10,9,8 // Also used for Gyro_Calibr, Compass_Calibr |
| 23 | +}; |
| 24 | +const int DMP_PQuat6_Byte_Ordering[icm_20948_DMP_PQuat6_Bytes] = |
| 25 | +{ |
| 26 | + 1,0,3,2,5,4 // Also used for Raw_Accel, Compass |
| 27 | +}; |
| 28 | +const int DMP_Raw_Gyro_Byte_Ordering[icm_20948_DMP_Raw_Gyro_Bytes + icm_20948_DMP_Gyro_Bias_Bytes] = |
| 29 | +{ |
| 30 | + 1,0,3,2,5,4,7,6,9,8,11,10 |
| 31 | +}; |
| 32 | +const int DMP_Activity_Recognition_Byte_Ordering[icm_20948_DMP_Activity_Recognition_Bytes] = |
| 33 | +{ |
| 34 | + 0,1,5,4,3,2 |
| 35 | +}; |
| 36 | +const int DMP_Secondary_On_Off_Byte_Ordering[icm_20948_DMP_Secondary_On_Off_Bytes] = |
| 37 | +{ |
| 38 | + 1,0 |
| 39 | +}; |
| 40 | + |
| 41 | +const uint16_t inv_androidSensor_to_control_bits[ANDROID_SENSOR_NUM_MAX]= |
| 42 | +{ |
| 43 | + // Data output control 1 register bit definition |
| 44 | + // 16-bit accel 0x8000 |
| 45 | + // 16-bit gyro 0x4000 |
| 46 | + // 16-bit compass 0x2000 |
| 47 | + // 16-bit ALS 0x1000 |
| 48 | + // 32-bit 6-axis quaternion 0x0800 |
| 49 | + // 32-bit 9-axis quaternion + heading accuracy 0x0400 |
| 50 | + // 16-bit pedometer quaternion 0x0200 |
| 51 | + // 32-bit Geomag rv + heading accuracy 0x0100 |
| 52 | + // 16-bit Pressure 0x0080 |
| 53 | + // 32-bit calibrated gyro 0x0040 |
| 54 | + // 32-bit calibrated compass 0x0020 |
| 55 | + // Pedometer Step Detector 0x0010 |
| 56 | + // Header 2 0x0008 |
| 57 | + // Pedometer Step Indicator Bit 2 0x0004 |
| 58 | + // Pedometer Step Indicator Bit 1 0x0002 |
| 59 | + // Pedometer Step Indicator Bit 0 0x0001 |
| 60 | + // Unsupported Sensors are 0xFFFF |
| 61 | + |
| 62 | + 0xFFFF, // 0 Meta Data |
| 63 | + 0x8008, // 1 Accelerometer |
| 64 | + 0x0028, // 2 Magnetic Field |
| 65 | + 0x0408, // 3 Orientation |
| 66 | + 0x4048, // 4 Gyroscope |
| 67 | + 0x1008, // 5 Light |
| 68 | + 0x0088, // 6 Pressure |
| 69 | + 0xFFFF, // 7 Temperature |
| 70 | + 0xFFFF, // 8 Proximity <----------- fixme |
| 71 | + 0x0808, // 9 Gravity |
| 72 | + 0x8808, // 10 Linear Acceleration |
| 73 | + 0x0408, // 11 Rotation Vector |
| 74 | + 0xFFFF, // 12 Humidity |
| 75 | + 0xFFFF, // 13 Ambient Temperature |
| 76 | + 0x2008, // 14 Magnetic Field Uncalibrated |
| 77 | + 0x0808, // 15 Game Rotation Vector |
| 78 | + 0x4008, // 16 Gyroscope Uncalibrated |
| 79 | + 0x0000, // 17 Significant Motion |
| 80 | + 0x0018, // 18 Step Detector |
| 81 | + 0x0010, // 19 Step Counter <----------- fixme |
| 82 | + 0x0108, // 20 Geomagnetic Rotation Vector |
| 83 | + 0xFFFF, // 21 ANDROID_SENSOR_HEART_RATE, |
| 84 | + 0xFFFF, // 22 ANDROID_SENSOR_PROXIMITY, |
| 85 | + |
| 86 | + 0x8008, // 23 ANDROID_SENSOR_WAKEUP_ACCELEROMETER, |
| 87 | + 0x0028, // 24 ANDROID_SENSOR_WAKEUP_MAGNETIC_FIELD, |
| 88 | + 0x0408, // 25 ANDROID_SENSOR_WAKEUP_ORIENTATION, |
| 89 | + 0x4048, // 26 ANDROID_SENSOR_WAKEUP_GYROSCOPE, |
| 90 | + 0x1008, // 27 ANDROID_SENSOR_WAKEUP_LIGHT, |
| 91 | + 0x0088, // 28 ANDROID_SENSOR_WAKEUP_PRESSURE, |
| 92 | + 0x0808, // 29 ANDROID_SENSOR_WAKEUP_GRAVITY, |
| 93 | + 0x8808, // 30 ANDROID_SENSOR_WAKEUP_LINEAR_ACCELERATION, |
| 94 | + 0x0408, // 31 ANDROID_SENSOR_WAKEUP_ROTATION_VECTOR, |
| 95 | + 0xFFFF, // 32 ANDROID_SENSOR_WAKEUP_RELATIVE_HUMIDITY, |
| 96 | + 0xFFFF, // 33 ANDROID_SENSOR_WAKEUP_AMBIENT_TEMPERATURE, |
| 97 | + 0x2008, // 34 ANDROID_SENSOR_WAKEUP_MAGNETIC_FIELD_UNCALIBRATED, |
| 98 | + 0x0808, // 35 ANDROID_SENSOR_WAKEUP_GAME_ROTATION_VECTOR, |
| 99 | + 0x4008, // 36 ANDROID_SENSOR_WAKEUP_GYROSCOPE_UNCALIBRATED, |
| 100 | + 0x0018, // 37 ANDROID_SENSOR_WAKEUP_STEP_DETECTOR, |
| 101 | + 0x0010, // 38 ANDROID_SENSOR_WAKEUP_STEP_COUNTER, |
| 102 | + 0x0108, // 39 ANDROID_SENSOR_WAKEUP_GEOMAGNETIC_ROTATION_VECTOR |
| 103 | + 0xFFFF, // 40 ANDROID_SENSOR_WAKEUP_HEART_RATE, |
| 104 | + 0x0000, // 41 ANDROID_SENSOR_WAKEUP_TILT_DETECTOR, |
| 105 | + 0x8008, // 42 Raw Acc |
| 106 | + 0x4048, // 43 Raw Gyr |
| 107 | +}; |
| 108 | + |
5 | 109 | const ICM_20948_Serif_t NullSerif = { |
6 | 110 | NULL, // write |
7 | 111 | NULL, // read |
|
0 commit comments