Subversion Repositories NaviCtrl

Rev

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

Rev 679 Rev 702
Line 57... Line 57...
57
#include "timer1.h"
57
#include "timer1.h"
58
#include "uart1.h"
58
#include "uart1.h"
59
#include "config.h"
59
#include "config.h"
60
#include "main.h"
60
#include "main.h"
61
#include "led.h"
61
#include "led.h"
-
 
62
#include "triggerlog.h"
Line 62... Line 63...
62
 
63
 
63
u32 CountMilliseconds;
64
u32 CountMilliseconds;
64
DateTime_t SystemTime;
65
DateTime_t SystemTime;
65
/*
66
/*
Line 70... Line 71...
70
 if(!PIN6_4) { if(p64) DebugOut.Analog[]++; p64 = 0; } else p64 = 1;
71
 if(!PIN6_4) { if(p64) DebugOut.Analog[]++; p64 = 0; } else p64 = 1;
71
 if(!PIN6_5) { if(p65) DebugOut.Analog[]++; p65 = 0; } else p65 = 1;
72
 if(!PIN6_5) { if(p65) DebugOut.Analog[]++; p65 = 0; } else p65 = 1;
72
}
73
}
73
*/
74
*/
Line -... Line 75...
-
 
75
 
74
 
76
 
75
//----------------------------------------------------------------------------------------------------
77
//----------------------------------------------------------------------------------------------------
76
void TIM1_IRQHandler(void)
78
void TIM1_IRQHandler(void)
77
{
79
{
78
//      IENABLE;
80
 static u8 p63 = 1, Entprell63 = 100;
79
        if(TIM_GetFlagStatus(TIM1, TIM_FLAG_OC1) == SET)
81
        if(TIM_GetFlagStatus(TIM1, TIM_FLAG_OC1) == SET)
80
        {
82
        {
81
                TIM_ClearFlag(TIM1, TIM_FLAG_OC1); // clear irq pending bit
83
                TIM_ClearFlag(TIM1, TIM_FLAG_OC1); // clear irq pending bit
82
                TIM1->OC1R += 200;    // Timerfreq is 200kHz, generate an interrupt every 1ms
84
                TIM1->OC1R += 200;    // Timerfreq is 200kHz, generate an interrupt every 1ms
83
                CountMilliseconds++;
85
                CountMilliseconds++;
84
        if(SD_WatchDog) SD_WatchDog--;
86
        if(SD_WatchDog) SD_WatchDog--;
85
                if(SPIWatchDog) SPIWatchDog--;
87
                if(SPIWatchDog) SPIWatchDog--;
86
                if(PollingTimeout) PollingTimeout--;
88
                if(PollingTimeout) PollingTimeout--;
-
 
89
//CountInput();
-
 
90
                if((UART_VersionInfo.HWMajor >= 30) && !Entprell63)
-
 
91
                  {
-
 
92
                   if((!TRIGGER_PP_EXTERN && BlitzSchuhConnected) || (!TRIGGER_PP_INTERN && !BlitzSchuhConnected)) // either internal or external Trigger event
-
 
93
                     {
-
 
94
                          if(p63)
-
 
95
                            {
-
 
96
                                  TriggerInput();
-
 
97
                                  Entprell63 = 50;
-
 
98
                                  p63 = 0;
-
 
99
                                 }
-
 
100
                          }
-
 
101
                        else p63 = 1;
87
//CountInput();
102
                   } else Entprell63--;
88
                // generate SW Interrupt to make a regular timing 
103
                // generate SW Interrupt to make a regular timing 
89
                // independent from the mainloop at the lowest IRQ priority
104
                // independent from the mainloop at the lowest IRQ priority
90
                VIC_SWITCmd(EXTIT3_ITLine, ENABLE);    
105
                VIC_SWITCmd(EXTIT3_ITLine, ENABLE);    
91
        }
-
 
92
//      IDISABLE;
-
 
93
       
106
        }
94
        VIC0->VAR = 0xFF; // write any value to VIC0 Vector address register
107
        VIC0->VAR = 0xFF; // write any value to VIC0 Vector address register
Line 95... Line 108...
95
}
108
}
96
 
109
 
Line 159... Line 172...
159
        if(delay & 0x80000000) delay = 0; // avoid negative delay values
172
        if(delay & 0x80000000) delay = 0; // avoid negative delay values
160
        return(delay);
173
        return(delay);
161
}
174
}
Line 162... Line 175...
162
 
175
 
-
 
176
// -----------------------------------------------------------------------
163
// -----------------------------------------------------------------------
177
/*
164
void Delay_ms(u32 w)
178
void Delay_ms(u32 w)
165
{
179
{
166
        u32 akt;
180
        u32 akt;
167
        akt = CountMilliseconds + w;
181
        akt = SetDelay(w);
168
        while(1)
-
 
169
        {
-
 
170
                if(akt<=CountMilliseconds) return;
-
 
171
        }
182
        while(!CheckDelay(akt));
-
 
183
}