Subversion Repositories NaviCtrl

Rev

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

Rev 153 Rev 154
Line 72... Line 72...
72
#include "fat16.h"
72
#include "fat16.h"
73
#include "usb.h"
73
#include "usb.h"
74
#include "sdc.h"
74
#include "sdc.h"
75
#include "logging.h"
75
#include "logging.h"
76
#include "settings.h"
76
#include "settings.h"
-
 
77
#include "config.h"
77
#include "main.h"
78
#include "main.h"
Line 78... Line 79...
78
 
79
 
79
u32 TimerCheckError;
80
u32 TimerCheckError;
80
u32 ErrorCode = 0;
81
u32 ErrorCode = 0;
Line 182... Line 183...
182
                StopNavigation = 0;
183
                StopNavigation = 0;
183
                LED_RED_OFF;
184
                LED_RED_OFF;
184
        }
185
        }
185
}
186
}
Line -... Line 187...
-
 
187
 
-
 
188
// the handler will be cyclic called by the timer 1 ISR
-
 
189
// used is for critical timing parts that normaly would handled 
-
 
190
// within the main loop that could block longer at logging activities
-
 
191
void EXTIT3_IRQHandler(void)
-
 
192
{
-
 
193
        VIC_ITCmd(EXTIT3_ITLine,DISABLE); // disable irq
-
 
194
 
-
 
195
        I2C1_UpdateCompass();   // update compass communication
-
 
196
        UART0_ProcessRxData();  // process request
-
 
197
        UART1_ProcessRxData();  // process request
Line -... Line 198...
-
 
198
        USB_ProcessRxData();    // process request
-
 
199
 
-
 
200
        SPI0_UpdateBuffer();    // handle new SPI Data  
-
 
201
        Analog_Update();                // get new ADC values
-
 
202
 
-
 
203
        VIC_SWITCmd(EXTIT3_ITLine,DISABLE); // clear pending bit
Line 186... Line 204...
186
 
204
        VIC_ITCmd(EXTIT3_ITLine, ENABLE); // enable irq
187
 
205
}
188
 
206
 
189
//----------------------------------------------------------------------------------------------------
207
//----------------------------------------------------------------------------------------------------
Line 248... Line 266...
248
        }
266
        }
Line 249... Line 267...
249
 
267
 
Line 250... Line 268...
250
        UART0_GetMKOSDVersion();
268
        UART0_GetMKOSDVersion();
-
 
269
 
-
 
270
        UART1_PutString("\r\n---------------------------------------------\r\n\r\n");
-
 
271
   
-
 
272
        // ---------- Prepare the isr driven 
-
 
273
        // set to absolute lowest priority
-
 
274
    VIC_Config(EXTIT3_ITLine, VIC_IRQ, PRIORITY_SW);
Line 251... Line 275...
251
 
275
        // enanble interrupts
252
        UART1_PutString("\r\n---------------------------------------------\r\n\r\n");
276
    VIC_ITCmd(EXTIT3_ITLine, ENABLE);
253
 
-
 
254
        for (;;)
-
 
255
        {
-
 
256
                UART1_ProcessRxData();  // process request
-
 
257
                UART1_TransmitTxData(); // send answer
277
 
258
 
-
 
259
                UART0_ProcessRxData();  // process request
278
        for (;;) // the endless main loop
260
                UART0_TransmitTxData(); // send answer
279
        {
Line 261... Line -...
261
 
-
 
262
                USB_ProcessRxData();    // process request
-
 
263
                USB_TransmitTxData();   // send answer
-
 
264
 
-
 
265
                SPI0_UpdateBuffer();    // handle new SPI Data
280
                UART0_TransmitTxData(); // send answer
266
 
281
                UART1_TransmitTxData(); // send answer
267
                //I2C1_UpdateCompass(); moved to Timer1 ISR to avoid timing problems
282
                USB_TransmitTxData();   // send answer
268
 
283
 
269
                // ---------------- Error Check Timing ----------------------------
284
                // ---------------- Error Check Timing ----------------------------
Line 280... Line 295...
280
                        else NCFlags &= ~NC_FLAG_NOSERIALLINK;
295
                        else NCFlags &= ~NC_FLAG_NOSERIALLINK;
281
                }
296
                }
282
                // ---------------- Logging  ---------------------------------------
297
                // ---------------- Logging  ---------------------------------------
283
                Logging_Update();  // could be block some time for at max. 2 seconds, therefore move time critical part of the mainloop into the ISR of timer 1
298
                Logging_Update();  // could be block some time for at max. 2 seconds, therefore move time critical part of the mainloop into the ISR of timer 1
284
                // ---------------- ADC readings -----------------------------------
299
                // ---------------- ADC readings -----------------------------------
285
                Analog_Update();
-
 
286
        }
300
        }
287
}
301
}