Mercurial > public > hwos_code
annotate src/compass.h @ 656:8af5aefbcdaf default tip
Update to 3.31 beta
| author | heinrichsweikamp |
|---|---|
| date | Thu, 27 Nov 2025 18:32:58 +0100 |
| parents | bc214815deb2 |
| children |
| rev | line source |
|---|---|
| 0 | 1 ////////////////////////////////////////////////////////////////////////////// |
| 2 // HISTORY | |
| 3 // 2013-03-29 [jDG] Creation for tests. | |
| 4 | |
| 5 //---- Storage classes ------------------------------------------------------- | |
| 6 // Declaring PIC18 and VC++/G++ functions. | |
| 7 #ifdef UNIX | |
| 604 | 8 # define PARAMETER |
| 9 # define OVERLAY | |
| 0 | 10 #else |
| 604 | 11 # define PARAMETER static |
| 12 # define OVERLAY overlay | |
| 0 | 13 #endif |
| 14 | |
| 15 ////////////////////////////////////////////////////////////////////////////// | |
| 16 | |
| 604 | 17 #define Q_PI (18000) |
| 18 #define Q_PIO2 (9000) | |
| 0 | 19 |
| 604 | 20 typedef short int Int16; |
| 21 typedef signed char Int8; | |
| 22 typedef Int16 Angle; | |
| 0 | 23 |
| 24 // The (filtered) components of the magnetometer sensor: | |
| 25 extern Int16 compass_DX_f; | |
| 26 extern Int16 compass_DY_f; | |
| 27 extern Int16 compass_DZ_f; | |
| 28 | |
| 623 | 29 // Found soft-iron calibration values, deduced from already filtered values: |
| 0 | 30 extern Int16 compass_CX_f; |
| 31 extern Int16 compass_CY_f; | |
| 32 extern Int16 compass_CZ_f; | |
| 33 | |
| 34 // The (filtered) components of the accelerometer sensor: | |
| 35 extern Int16 accel_DX_f; | |
| 36 extern Int16 accel_DY_f; | |
| 37 extern Int16 accel_DZ_f; | |
| 38 | |
| 623 | 39 // The compass result value: |
| 40 extern Int16 compass_heading_new; | |
| 41 //extern Int16 compass_roll; | |
| 42 //extern Int16 compass_pitch; | |
| 0 | 43 |
| 650 | 44 extern Int16 umul (PARAMETER Int16 a, PARAMETER Int16 b); |
| 45 extern Int16 imul (PARAMETER Int16 a, PARAMETER Int16 b); | |
| 46 extern Int16 udiv (PARAMETER Int16 a, PARAMETER Int16 b); | |
| 47 extern Angle utan (PARAMETER Int16 a, PARAMETER Int16 b); | |
| 48 extern Angle itan (PARAMETER Int16 a, PARAMETER Int16 b); | |
| 0 | 49 extern Angle cosxh(PARAMETER Int16 a, PARAMETER Int16 b); |
| 604 | 50 |
| 51 extern void sincos(PARAMETER Int16 a, PARAMETER Int16 b, Int16* sin, Int16* cos); | |
|
282
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
52 |
|
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
53 ////////////////////////////////////////////////////////////////////////////// |
|
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
54 // The user functions |
| 650 | 55 extern void compass (void); |
|
282
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
56 extern void compass_reset_calibration(void); |
| 650 | 57 extern void compass_add_calibration (void); |
|
282
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
58 extern void compass_solve_calibration(void); |
