Rev 1868 | Rev 1969 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1868 | Rev 1887 | ||
---|---|---|---|
Line 79... | Line 79... | ||
79 | /*********************************************/ |
79 | /*********************************************/ |
80 | /* Get PWM from MK3MAG */ |
80 | /* Get PWM from MK3MAG */ |
81 | /*********************************************/ |
81 | /*********************************************/ |
82 | void MK3MAG_Update(void) {// called every 102.4 us by timer 0 ISR |
82 | void MK3MAG_Update(void) {// called every 102.4 us by timer 0 ISR |
83 | static uint16_t PWMCount = 0; |
83 | static uint16_t PWMCount = 0; |
84 | static uint16_t BeepDelay = 0; |
84 | static uint16_t beepDelay = 0; |
85 | static uint16_t debugCounter = 0; |
85 | static uint16_t debugCounter = 0; |
86 | // The pulse width varies from 1ms (0°) to 36.99ms (359.9°) |
86 | // The pulse width varies from 1ms (0°) to 36.99ms (359.9°) |
87 | // in other words 100us/° with a +1ms offset. |
87 | // in other words 100us/° with a +1ms offset. |
88 | // The signal goes low for 65ms between pulses, |
88 | // The signal goes low for 65ms between pulses, |
89 | // so the cycle time is 65mS + the pulse width. |
89 | // so the cycle time is 65mS + the pulse width. |
Line 127... | Line 127... | ||
127 | // 12 * 362 counts * 102.4 us |
127 | // 12 * 362 counts * 102.4 us |
128 | } |
128 | } |
129 | PWMCount = 0; // reset pwm counter |
129 | PWMCount = 0; // reset pwm counter |
130 | } |
130 | } |
131 | if (!PWMTimeout) { |
131 | if (!PWMTimeout) { |
132 | if (CheckDelay(BeepDelay)) { |
132 | if (checkDelay(beepDelay)) { |
133 | if (!BeepTime) |
133 | if (!beepTime) |
134 | BeepTime = 100; // make noise with 10Hz to signal the compass problem |
134 | beepTime = 100; // make noise with 10Hz to signal the compass problem |
135 | BeepDelay = SetDelay(100); |
135 | beepDelay = setDelay(100); |
136 | } |
136 | } |
137 | } |
137 | } |
138 | } |
138 | } |