annotate src/compass.h @ 74:067b6bee5c78

1.2RC
author heinrichsweikamp
date Mon, 10 Feb 2014 16:37:48 +0100
parents 11d4fc797f74
children 7d9edd3b8c86
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
heinrichsweikamp
parents:
diff changeset
8 # define PARAMETER
heinrichsweikamp
parents:
diff changeset
9 # define OVERLAY
heinrichsweikamp
parents:
diff changeset
10 #else
heinrichsweikamp
parents:
diff changeset
11 //---- Bank 9 parameters -----------------------------------------------------
heinrichsweikamp
parents:
diff changeset
12 # pragma udata overlay bank9_compass = 0x900
heinrichsweikamp
parents:
diff changeset
13 # define PARAMETER static
heinrichsweikamp
parents:
diff changeset
14 # define OVERLAY overlay
heinrichsweikamp
parents:
diff changeset
15 #endif
heinrichsweikamp
parents:
diff changeset
16
heinrichsweikamp
parents:
diff changeset
17 //////////////////////////////////////////////////////////////////////////////
heinrichsweikamp
parents:
diff changeset
18
heinrichsweikamp
parents:
diff changeset
19 #define Q_PI (18000)
heinrichsweikamp
parents:
diff changeset
20 #define Q_PIO2 (9000)
heinrichsweikamp
parents:
diff changeset
21
heinrichsweikamp
parents:
diff changeset
22 typedef short int Int16;
heinrichsweikamp
parents:
diff changeset
23 typedef signed char Int8;
heinrichsweikamp
parents:
diff changeset
24 typedef Int16 Angle;
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
heinrichsweikamp
parents:
diff changeset
31 // Found soft-iron calibration values, deduced from already filtered values.
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
heinrichsweikamp
parents:
diff changeset
41 // The compass result value.
heinrichsweikamp
parents:
diff changeset
42 extern Int16 compass_heading;
heinrichsweikamp
parents:
diff changeset
43 extern Int16 compass_roll;
heinrichsweikamp
parents:
diff changeset
44 extern Int16 compass_pitch;
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);
heinrichsweikamp
parents:
diff changeset
52 extern void sincos(PARAMETER Int16 a, PARAMETER Int16 b, Int16* sin, Int16* cos);