Skip to content

Commit aa33176

Browse files
authored
Merge pull request #43 from nikitos1550/issue-37
vars declarations moved from header to code
2 parents ffff72a + 4d0dad8 commit aa33176

File tree

3 files changed

+104
-105
lines changed

3 files changed

+104
-105
lines changed

src/util/ICM_20948_C.c

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,110 @@
22
#include "ICM_20948_REGISTERS.h"
33
#include "AK09916_REGISTERS.h"
44

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+
5109
const ICM_20948_Serif_t NullSerif = {
6110
NULL, // write
7111
NULL, // read

src/util/ICM_20948_C.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,6 @@ extern int memcmp(const void *, const void *, size_t); // Avoid compiler warning
170170
uint32_t _enabled_Android_intr_1; // Keep track of which Android sensor interrupts are enabled: 32-
171171
} ICM_20948_Device_t; // Definition of device struct type
172172

173-
/*
174-
* Icm20948 device require a DMP image to be loaded on init
175-
* Provide such images by mean of a byte array
176-
*/
177-
#if defined(ICM_20948_USE_DMP) // Only include the 93KBytes of DMP if ICM_20948_USE_DMP is defined
178-
const uint8_t dmp3_image[] = {
179-
#include "icm20948_img.dmp3a.h"
180-
};
181-
#endif
182-
183-
184173
// ICM_20948_Status_e ICM_20948_Startup( ICM_20948_Device_t* pdev ); // For the time being this performs a standardized startup routine
185174

186175
ICM_20948_Status_e ICM_20948_link_serif(ICM_20948_Device_t *pdev, const ICM_20948_Serif_t *s); // Links a SERIF structure to the device

src/util/ICM_20948_DMP.h

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -485,74 +485,6 @@ enum DMP_Header2_Bitmap
485485
DMP_header2_bitmap_Accel_Accuracy = 0x4000
486486
};
487487

488-
const uint16_t inv_androidSensor_to_control_bits[ANDROID_SENSOR_NUM_MAX]=
489-
{
490-
// Data output control 1 register bit definition
491-
// 16-bit accel 0x8000
492-
// 16-bit gyro 0x4000
493-
// 16-bit compass 0x2000
494-
// 16-bit ALS 0x1000
495-
// 32-bit 6-axis quaternion 0x0800
496-
// 32-bit 9-axis quaternion + heading accuracy 0x0400
497-
// 16-bit pedometer quaternion 0x0200
498-
// 32-bit Geomag rv + heading accuracy 0x0100
499-
// 16-bit Pressure 0x0080
500-
// 32-bit calibrated gyro 0x0040
501-
// 32-bit calibrated compass 0x0020
502-
// Pedometer Step Detector 0x0010
503-
// Header 2 0x0008
504-
// Pedometer Step Indicator Bit 2 0x0004
505-
// Pedometer Step Indicator Bit 1 0x0002
506-
// Pedometer Step Indicator Bit 0 0x0001
507-
// Unsupported Sensors are 0xFFFF
508-
509-
0xFFFF, // 0 Meta Data
510-
0x8008, // 1 Accelerometer
511-
0x0028, // 2 Magnetic Field
512-
0x0408, // 3 Orientation
513-
0x4048, // 4 Gyroscope
514-
0x1008, // 5 Light
515-
0x0088, // 6 Pressure
516-
0xFFFF, // 7 Temperature
517-
0xFFFF, // 8 Proximity <----------- fixme
518-
0x0808, // 9 Gravity
519-
0x8808, // 10 Linear Acceleration
520-
0x0408, // 11 Rotation Vector
521-
0xFFFF, // 12 Humidity
522-
0xFFFF, // 13 Ambient Temperature
523-
0x2008, // 14 Magnetic Field Uncalibrated
524-
0x0808, // 15 Game Rotation Vector
525-
0x4008, // 16 Gyroscope Uncalibrated
526-
0x0000, // 17 Significant Motion
527-
0x0018, // 18 Step Detector
528-
0x0010, // 19 Step Counter <----------- fixme
529-
0x0108, // 20 Geomagnetic Rotation Vector
530-
0xFFFF, // 21 ANDROID_SENSOR_HEART_RATE,
531-
0xFFFF, // 22 ANDROID_SENSOR_PROXIMITY,
532-
533-
0x8008, // 23 ANDROID_SENSOR_WAKEUP_ACCELEROMETER,
534-
0x0028, // 24 ANDROID_SENSOR_WAKEUP_MAGNETIC_FIELD,
535-
0x0408, // 25 ANDROID_SENSOR_WAKEUP_ORIENTATION,
536-
0x4048, // 26 ANDROID_SENSOR_WAKEUP_GYROSCOPE,
537-
0x1008, // 27 ANDROID_SENSOR_WAKEUP_LIGHT,
538-
0x0088, // 28 ANDROID_SENSOR_WAKEUP_PRESSURE,
539-
0x0808, // 29 ANDROID_SENSOR_WAKEUP_GRAVITY,
540-
0x8808, // 30 ANDROID_SENSOR_WAKEUP_LINEAR_ACCELERATION,
541-
0x0408, // 31 ANDROID_SENSOR_WAKEUP_ROTATION_VECTOR,
542-
0xFFFF, // 32 ANDROID_SENSOR_WAKEUP_RELATIVE_HUMIDITY,
543-
0xFFFF, // 33 ANDROID_SENSOR_WAKEUP_AMBIENT_TEMPERATURE,
544-
0x2008, // 34 ANDROID_SENSOR_WAKEUP_MAGNETIC_FIELD_UNCALIBRATED,
545-
0x0808, // 35 ANDROID_SENSOR_WAKEUP_GAME_ROTATION_VECTOR,
546-
0x4008, // 36 ANDROID_SENSOR_WAKEUP_GYROSCOPE_UNCALIBRATED,
547-
0x0018, // 37 ANDROID_SENSOR_WAKEUP_STEP_DETECTOR,
548-
0x0010, // 38 ANDROID_SENSOR_WAKEUP_STEP_COUNTER,
549-
0x0108, // 39 ANDROID_SENSOR_WAKEUP_GEOMAGNETIC_ROTATION_VECTOR
550-
0xFFFF, // 40 ANDROID_SENSOR_WAKEUP_HEART_RATE,
551-
0x0000, // 41 ANDROID_SENSOR_WAKEUP_TILT_DETECTOR,
552-
0x8008, // 42 Raw Acc
553-
0x4048, // 43 Raw Gyr
554-
};
555-
556488
typedef struct // DMP Activity Recognition data
557489
{
558490
uint8_t Drive : 1;
@@ -601,32 +533,6 @@ typedef struct // DMP Secondary On/Off data
601533
#define icm_20948_DMP_Footer_Bytes 2
602534
#define icm_20948_DMP_Maximum_Bytes 14 // The most bytes we will attempt to read from the FIFO in one go
603535

604-
// ICM-20948 data is big-endian. We need to make it little-endian when writing into icm_20948_DMP_data_t
605-
const int DMP_Quat9_Byte_Ordering[icm_20948_DMP_Quat9_Bytes] =
606-
{
607-
3,2,1,0,7,6,5,4,11,10,9,8,13,12 // Also used for Geomag
608-
};
609-
const int DMP_Quat6_Byte_Ordering[icm_20948_DMP_Quat6_Bytes] =
610-
{
611-
3,2,1,0,7,6,5,4,11,10,9,8 // Also used for Gyro_Calibr, Compass_Calibr
612-
};
613-
const int DMP_PQuat6_Byte_Ordering[icm_20948_DMP_PQuat6_Bytes] =
614-
{
615-
1,0,3,2,5,4 // Also used for Raw_Accel, Compass
616-
};
617-
const int DMP_Raw_Gyro_Byte_Ordering[icm_20948_DMP_Raw_Gyro_Bytes + icm_20948_DMP_Gyro_Bias_Bytes] =
618-
{
619-
1,0,3,2,5,4,7,6,9,8,11,10
620-
};
621-
const int DMP_Activity_Recognition_Byte_Ordering[icm_20948_DMP_Activity_Recognition_Bytes] =
622-
{
623-
0,1,5,4,3,2
624-
};
625-
const int DMP_Secondary_On_Off_Byte_Ordering[icm_20948_DMP_Secondary_On_Off_Bytes] =
626-
{
627-
1,0
628-
};
629-
630536
typedef struct
631537
{
632538
uint16_t header;

0 commit comments

Comments
 (0)