-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathmacrodefs.h
56 lines (39 loc) · 1.32 KB
/
macrodefs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef MACRODEFS_H
#define MACRODEFS_H
// CAN Frame Micro Defines
#define GYRO_X_Y 0x00000066
#define GYRO_Z_Temp 0x00000067
#define ACCEL_X_Y_Z 0x00000069
#define GYRO_FULL_32_BIT ((unsigned int)(0xFFFFFFFF))
#define ACCEL_FULL_16_BIT ((unsigned int)(0xFFFF))
#define GYRO_RATE_LSB 0.001
#define ACCEL_RATE_LSB 0.0001
#define TEMP_IMU_LSB 1
/* Blow macros are imported from http://mbed.org/cookbook/IMU and may not be used
*/
//Gravity at Earth's surface in m/s/s
#define g0 9.812865328
//Number of samples to average.
#define SAMPLES 4
//Number of samples to be averaged for a null bias calculation
//during calibration.
#define CALIBRATION_SAMPLES 128
//Convert from radians to degrees.
#define toDegrees(x) (x * 57.2957795)
//Convert from degrees to radians.
#define toRadians(x) (x * 0.01745329252)
//ITG-3200 sensitivity is 14.375 LSB/(degrees/sec).
#define GYROSCOPE_GAIN (1 / 14.375)
//Full scale resolution on the ADXL345 is 4mg/LSB.
#define ACCELEROMETER_GAIN (0.004 * g0)
//Sampling gyroscope at 200Hz.
#define GYRO_RATE 0.005
//Sampling accelerometer at 200Hz.
#define ACC_RATE 0.005
//Updating filter at 1/FILTER_RATE Hz.
#define FILTER_RATE 0.01
// Timer Interval, namely 1000*FILTER_RATE
#define TIMER_INTERVAL 10
// Sample Frames for Calibration
#define SAMPLE_FRAMES_FOR_CALIBRATION 10000
#endif // MACRODEFS_H