Mercurial > public > hwos_code
annotate src/compass.h @ 628:cd58f7fc86db
3.05 stable work
author | heinrichsweikamp |
---|---|
date | Thu, 19 Sep 2019 12:01:29 +0200 |
parents | c40025d8e750 |
children | bc214815deb2 |
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 |
11 //---- Bank 9 parameters ----------------------------------------------------- | |
604 | 12 # pragma udata overlay bank9_compass = 0x900 |
13 # define PARAMETER static | |
14 # define OVERLAY overlay | |
0 | 15 #endif |
16 | |
17 ////////////////////////////////////////////////////////////////////////////// | |
18 | |
604 | 19 #define Q_PI (18000) |
20 #define Q_PIO2 (9000) | |
0 | 21 |
604 | 22 typedef short int Int16; |
23 typedef signed char Int8; | |
24 typedef Int16 Angle; | |
0 | 25 |
26 // The (filtered) components of the magnetometer sensor: | |
27 extern Int16 compass_DX_f; | |
28 extern Int16 compass_DY_f; | |
29 extern Int16 compass_DZ_f; | |
30 | |
623 | 31 // Found soft-iron calibration values, deduced from already filtered values: |
0 | 32 extern Int16 compass_CX_f; |
33 extern Int16 compass_CY_f; | |
34 extern Int16 compass_CZ_f; | |
35 | |
36 // The (filtered) components of the accelerometer sensor: | |
37 extern Int16 accel_DX_f; | |
38 extern Int16 accel_DY_f; | |
39 extern Int16 accel_DZ_f; | |
40 | |
623 | 41 // The compass result value: |
42 extern Int16 compass_heading_new; | |
43 //extern Int16 compass_roll; | |
44 //extern Int16 compass_pitch; | |
0 | 45 |
46 extern Int16 umul(PARAMETER Int16 a, PARAMETER Int16 b); | |
47 extern Int16 imul(PARAMETER Int16 a, PARAMETER Int16 b); | |
48 extern Int16 udiv(PARAMETER Int16 a, PARAMETER Int16 b); | |
49 extern Angle utan(PARAMETER Int16 a, PARAMETER Int16 b); | |
50 extern Angle itan(PARAMETER Int16 a, PARAMETER Int16 b); | |
51 extern Angle cosxh(PARAMETER Int16 a, PARAMETER Int16 b); | |
604 | 52 |
53 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
|
54 |
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
55 ////////////////////////////////////////////////////////////////////////////// |
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
56 // The user functions |
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
57 extern void compass(void); |
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
58 extern void compass_reset_calibration(void); |
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
59 extern void compass_add_calibration(void); |
7d9edd3b8c86
Make a more compact COMPASS calibration code (<7KB), and add more tests.
jDG
parents:
0
diff
changeset
|
60 extern void compass_solve_calibration(void); |