annotate src/compass.h @ 650:bc214815deb2

3.19/10.75 release
author heinrichsweikamp
date Sun, 28 Aug 2022 13:13:38 +0200
parents c40025d8e750
children
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
11 # define PARAMETER static
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
12 # define OVERLAY overlay
0
heinrichsweikamp
parents:
diff changeset
13 #endif
heinrichsweikamp
parents:
diff changeset
14
heinrichsweikamp
parents:
diff changeset
15 //////////////////////////////////////////////////////////////////////////////
heinrichsweikamp
parents:
diff changeset
16
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
17 #define Q_PI (18000)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
18 #define Q_PIO2 (9000)
0
heinrichsweikamp
parents:
diff changeset
19
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
20 typedef short int Int16;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
21 typedef signed char Int8;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
22 typedef Int16 Angle;
0
heinrichsweikamp
parents:
diff changeset
23
heinrichsweikamp
parents:
diff changeset
24 // The (filtered) components of the magnetometer sensor:
heinrichsweikamp
parents:
diff changeset
25 extern Int16 compass_DX_f;
heinrichsweikamp
parents:
diff changeset
26 extern Int16 compass_DY_f;
heinrichsweikamp
parents:
diff changeset
27 extern Int16 compass_DZ_f;
heinrichsweikamp
parents:
diff changeset
28
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
29 // Found soft-iron calibration values, deduced from already filtered values:
0
heinrichsweikamp
parents:
diff changeset
30 extern Int16 compass_CX_f;
heinrichsweikamp
parents:
diff changeset
31 extern Int16 compass_CY_f;
heinrichsweikamp
parents:
diff changeset
32 extern Int16 compass_CZ_f;
heinrichsweikamp
parents:
diff changeset
33
heinrichsweikamp
parents:
diff changeset
34 // The (filtered) components of the accelerometer sensor:
heinrichsweikamp
parents:
diff changeset
35 extern Int16 accel_DX_f;
heinrichsweikamp
parents:
diff changeset
36 extern Int16 accel_DY_f;
heinrichsweikamp
parents:
diff changeset
37 extern Int16 accel_DZ_f;
heinrichsweikamp
parents:
diff changeset
38
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
39 // The compass result value:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
40 extern Int16 compass_heading_new;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
41 //extern Int16 compass_roll;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
42 //extern Int16 compass_pitch;
0
heinrichsweikamp
parents:
diff changeset
43
650
bc214815deb2 3.19/10.75 release
heinrichsweikamp
parents: 623
diff changeset
44 extern Int16 umul (PARAMETER Int16 a, PARAMETER Int16 b);
bc214815deb2 3.19/10.75 release
heinrichsweikamp
parents: 623
diff changeset
45 extern Int16 imul (PARAMETER Int16 a, PARAMETER Int16 b);
bc214815deb2 3.19/10.75 release
heinrichsweikamp
parents: 623
diff changeset
46 extern Int16 udiv (PARAMETER Int16 a, PARAMETER Int16 b);
bc214815deb2 3.19/10.75 release
heinrichsweikamp
parents: 623
diff changeset
47 extern Angle utan (PARAMETER Int16 a, PARAMETER Int16 b);
bc214815deb2 3.19/10.75 release
heinrichsweikamp
parents: 623
diff changeset
48 extern Angle itan (PARAMETER Int16 a, PARAMETER Int16 b);
0
heinrichsweikamp
parents:
diff changeset
49 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
50
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 282
diff changeset
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
bc214815deb2 3.19/10.75 release
heinrichsweikamp
parents: 623
diff changeset
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
bc214815deb2 3.19/10.75 release
heinrichsweikamp
parents: 623
diff changeset
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);