Subversion Repositories FlightCtrl

Rev

Rev 707 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 707 Rev 726
Line 65... Line 65...
65
 
65
 
66
 
66
 
67
/*********************************************/
67
/*********************************************/
68
/*  Initialize Interface to MM3 Compass      */
68
/*  Initialize Interface to MM3 Compass      */
69
/*********************************************/
69
/*********************************************/
70
void MM3_init(void)
70
void MM3_Init(void)
Line 71... Line 71...
71
{
71
{
Line 112... Line 112...
112
 
112
 
113
 
113
 
114
/*********************************************/
114
/*********************************************/
115
/*  Get Data from MM3                        */
115
/*  Get Data from MM3                        */
116
/*********************************************/
116
/*********************************************/
117
void MM3_timer0() // called every 102.4 ms by timer 0 ISR
117
void MM3_Update() // called every 102.4 ms by timer 0 ISR
118
{
118
{
119
        switch (MM3.STATE)
119
        switch (MM3.STATE)
120
        {
120
        {
Line 200... Line 200...
200
 
200
 
201
 
201
 
202
/*********************************************/
202
/*********************************************/
203
/*  Calibrate Compass                        */
203
/*  Calibrate Compass                        */
204
/*********************************************/
204
/*********************************************/
205
void MM3_calibrate(void)
205
void MM3_Calibrate(void)
206
{
206
{
207
        int16_t x_min = 0, x_max = 0, y_min = 0, y_max = 0, z_min = 0, z_max = 0;
207
        int16_t x_min = 0, x_max = 0, y_min = 0, y_max = 0, z_min = 0, z_max = 0;
Line 261... Line 261...
261
 
261
 
262
 
262
 
263
/*********************************************/
263
/*********************************************/
264
/*  Calculate north direction (heading)      */
264
/*  Calculate north direction (heading)      */
265
/*********************************************/
265
/*********************************************/
266
int16_t MM3_heading(void)
266
int16_t MM3_Heading(void)
267
{
267
{
268
        int32_t sin_pitch, cos_pitch, sin_roll, cos_roll, sin_yaw, cos_yaw;
268
        int32_t sin_pitch, cos_pitch, sin_roll, cos_roll, sin_yaw, cos_yaw;
269
        int32_t  Hx, Hy, Hz, Hx_corr, Hy_corr;
269
        int32_t  Hx, Hy, Hz, Hx_corr, Hy_corr;