annotate src/compass.h @ 631:185ba2f91f59

3.09 beta 1 release
author heinrichsweikamp
date Fri, 28 Feb 2020 15:45:07 +0100
parents c40025d8e750
children bc214815deb2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 //////////////////////////////////////////////////////////////////////////////
heinrichsweikamp
parents:
diff changeset
2 // HISTORY
heinrichsweikamp
parents:
diff changeset
3 // 2013-03-29 [jDG] Creation for tests.
heinrichsweikamp
parents:
diff changeset
4
heinrichsweikamp
parents:
diff changeset
5 //---- Storage classes -------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
6 // Declaring PIC18 and VC++/G++ functions.
heinrichsweikamp
parents:
diff changeset
7 #ifdef UNIX
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
8 # define PARAMETER
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
9 # define OVERLAY
0
heinrichsweikamp
parents:
diff changeset
10 #else
heinrichsweikamp
parents:
diff changeset
11 //---- Bank 9 parameters -----------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
12 # pragma udata overlay bank9_compass = 0x900
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
13 # define PARAMETER static
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
14 # define OVERLAY overlay
0
heinrichsweikamp
parents:
diff changeset
15 #endif
heinrichsweikamp
parents:
diff changeset
16
heinrichsweikamp
parents:
diff changeset
17 //////////////////////////////////////////////////////////////////////////////
heinrichsweikamp
parents:
diff changeset
18
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
19 #define Q_PI (18000)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
20 #define Q_PIO2 (9000)
0
heinrichsweikamp
parents:
diff changeset
21
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
22 typedef short int Int16;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
23 typedef signed char Int8;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
24 typedef Int16 Angle;
0
heinrichsweikamp
parents:
diff changeset
25
heinrichsweikamp
parents:
diff changeset
26 // The (filtered) components of the magnetometer sensor:
heinrichsweikamp
parents:
diff changeset
27 extern Int16 compass_DX_f;
heinrichsweikamp
parents:
diff changeset
28 extern Int16 compass_DY_f;
heinrichsweikamp
parents:
diff changeset
29 extern Int16 compass_DZ_f;
heinrichsweikamp
parents:
diff changeset
30
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
31 // Found soft-iron calibration values, deduced from already filtered values:
0
heinrichsweikamp
parents:
diff changeset
32 extern Int16 compass_CX_f;
heinrichsweikamp
parents:
diff changeset
33 extern Int16 compass_CY_f;
heinrichsweikamp
parents:
diff changeset
34 extern Int16 compass_CZ_f;
heinrichsweikamp
parents:
diff changeset
35
heinrichsweikamp
parents:
diff changeset
36 // The (filtered) components of the accelerometer sensor:
heinrichsweikamp
parents:
diff changeset
37 extern Int16 accel_DX_f;
heinrichsweikamp
parents:
diff changeset
38 extern Int16 accel_DY_f;
heinrichsweikamp
parents:
diff changeset
39 extern Int16 accel_DZ_f;
heinrichsweikamp
parents:
diff changeset
40
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
41 // The compass result value:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
42 extern Int16 compass_heading_new;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
43 //extern Int16 compass_roll;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
44 //extern Int16 compass_pitch;
0
heinrichsweikamp
parents:
diff changeset
45
heinrichsweikamp
parents:
diff changeset
46 extern Int16 umul(PARAMETER Int16 a, PARAMETER Int16 b);
heinrichsweikamp
parents:
diff changeset
47 extern Int16 imul(PARAMETER Int16 a, PARAMETER Int16 b);
heinrichsweikamp
parents:
diff changeset
48 extern Int16 udiv(PARAMETER Int16 a, PARAMETER Int16 b);
heinrichsweikamp
parents:
diff changeset
49 extern Angle utan(PARAMETER Int16 a, PARAMETER Int16 b);
heinrichsweikamp
parents:
diff changeset
50 extern Angle itan(PARAMETER Int16 a, PARAMETER Int16 b);
heinrichsweikamp
parents:
diff changeset
51 extern Angle cosxh(PARAMETER Int16 a, PARAMETER Int16 b);
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
52
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
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);