Subversion Repositories FlightCtrl

Rev

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

Rev 1969 Rev 2039
Line 63... Line 63...
63
ToMk3Mag_t toMk3Mag;
63
ToMk3Mag_t toMk3Mag;
Line 64... Line 64...
64
 
64
 
65
/*********************************************/
65
/*********************************************/
66
/*  Initialize Interface to MK3MAG Compass   */
66
/*  Initialize Interface to MK3MAG Compass   */
67
/*********************************************/
67
/*********************************************/
68
void MK3MAG_Init(void) {
68
void MK3MAG_init(void) {
69
        // Port PC4 connected to PWM output from compass module
69
        // Port PC4 connected to PWM output from compass module
70
        DDRC &= ~(1 << DDC4); // set as input
70
        DDRC &= ~(1 << DDC4); // set as input
71
        PORTC |= (1 << PORTC4); // pull up  to increase PWM counter also if nothing is connected
-
 
72
 
71
        PORTC |= (1 << PORTC4); // pull up  to increase PWM counter also if nothing is connected
73
        PWMTimeout = 0;
-
 
74
 
72
        PWMTimeout = 0;
75
        toMk3Mag.CalState = 0;
73
        toMk3Mag.calState = 0;
76
        toMk3Mag.Orientation = 1;
74
        toMk3Mag.orientation = 1;
Line 77... Line 75...
77
}
75
}
78
 
76
 
79
/*********************************************/
77
/*********************************************/
80
/*  Get PWM from MK3MAG                      */
78
/*  Get PWM from MK3MAG                      */
81
/*********************************************/
79
/*********************************************/
82
void MK3MAG_Update(void) {// called every 102.4 us by timer 0 ISR
80
void MK3MAG_periodicTask(void) {// called every 102.4 us by timer 0 ISR
83
        static uint16_t PWMCount = 0;
81
        static uint16_t PWMCount = 0;
84
        static uint16_t beepDelay = 0;
82
        static uint16_t beepDelay = 0;
85
        static uint16_t debugCounter = 0;
83
        static uint16_t debugCounter = 0;