Subversion Repositories FlightCtrl

Rev

Rev 1910 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1910 Rev 2099
Line 2... Line 2...
2
#include "attitude.h"
2
#include "attitude.h"
Line 3... Line 3...
3
 
3
 
4
/*
4
/*
5
 * Angular unit scaling: Number of units per degree
5
 * Angular unit scaling: Number of units per degree
6
 */
6
 */
Line 7... Line 7...
7
#define MATH_DRG_FACTOR GYRO_DEG_FACTOR_PITCHROLL
7
#define MATH_DRG_FACTOR GYRO_DEG_FACTOR
8
 
8
 
9
/*
9
/*
10
 * Fix-point decimal scaling: Number of units for 1 (so if sin(something)
10
 * Fix-point decimal scaling: Number of units for 1 (so if sin(something)
11
 * returns UNIT_FACTOR * 0.8, the result is to be understood as 0.8)
11
 * returns UNIT_FACTOR * 0.8, the result is to be understood as 0.8)
12
 * a * sin(b) = (a * int_sin(b * DRG_FACTOR)) / UNIT_FACTOR
12
 * a * sin(b) = (a * int_sin(b * DRG_FACTOR)) / UNIT_FACTOR
13
 */
13
 */
14
//#define MATH_UNIT_FACTOR 8192
14
//#define MATH_UNIT_FACTOR 8192
15
// Changed: We want to be able to multiply 2 sines/cosines and still stay comfortably (factor 100) within 31 bits.
15
// Changed: We want to be able to multiply 2 sines/cosines and still stay comfortably (factor 100) within 31 bits.
16
// 4096 = 12 bits, square = 24 bits, 7 bits to spare.
16
// 4096 = 12 bits, square = 24 bits, 7 bits to spare.
Line 17... Line 17...
17
#define MATH_UNIT_FACTOR_LOG 12
17
#define LOG_MATH_UNIT_FACTOR 12
18
#define MATH_UNIT_FACTOR (1L<<MATH_UNIT_FACTOR_LOG)
18
#define MATH_UNIT_FACTOR (1L<<LOG_MATH_UNIT_FACTOR)
19
 
19
 
-
 
20
int16_t sin_360(int16_t arg);
-
 
21
int16_t cos_360(int16_t arg);