Subversion Repositories HomeAutomation

Rev

Rev 56 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 56 Rev 64
Line 23... Line 23...
23
#endif
23
#endif
24
 
24
 
25
 
25
 
26
 
26
 
27
static void mainInit(void);
27
static void mainInit(void);
28
 
-
 
29
 
28
 
30
void main()
29
void main()
31
{
30
{
32
    static TICK t = 0;
31
    static TICK t = 0;
33
 
32
 
Line 35... Line 34...
35
 
34
 
36
    mainInit();
35
    mainInit();
37
 
36
 
38
    #ifdef USE_CAN
37
    #ifdef USE_CAN
39
        canInit();
38
        canInit();
40
    #endif
39
    #endif
41
 
40
 
42
    #ifdef USE_UART
41
    #ifdef USE_UART
43
        uartInit();
42
        uartInit();
44
    #endif
43
    #endif
45
 
44
 
46
    tickInit();
45
    tickInit();
-
 
46
 
-
 
47
   
47
 
48
 
48
    while(1)
49
    while(1)
49
    {
50
    {  
50
    }
51
    }
51
 
52
 
52
}
53
}
53
 
54
 
54
 
55
 
55
#pragma interruptlow HighISR
56
#pragma interruptlow HighISR
56
void HighISR(void)
57
void HighISR(void)
57
{
58
{
58
 
59
 
59
 
60
 
60
    #ifdef USE_UART
61
    #ifdef USE_UART
61
        uartISR();
62
        uartISR();
62
    #endif
63
    #endif
63
 
64
 
64
    #ifdef USE_CAN
65
    #ifdef USE_CAN
65
        canISR();
66
        canISR();
66
    #endif
67
    #endif
67
 
68
 
68
 
69
 
Line 92... Line 93...
92
 
93
 
93
/*
94
/*
94
*   Function: mainInit
95
*   Function: mainInit
95
*
96
*
96
*   Input:  none
97
*   Input:  none
97
*   Output: none
98
*   Output: none
98
*   Pre-conditions: none
99
*   Pre-conditions: none
99
*   Affects: Se code
100
*   Affects: Se code
100
*   Depends: none.
101
*   Depends: none.
101
*/
102
*/
102
void mainInit()
103
void mainInit()
Line 162... Line 163...
162
    unsigned int wait = 0;
163
    unsigned int wait = 0;
163
    CAN_MESSAGE cm;
164
    CAN_MESSAGE cm;
164
    static BOOL waitingMessage = FALSE;
165
    static BOOL waitingMessage = FALSE;
165
    static TICK timeout=0;
166
    static TICK timeout=0;
166
    static BYTE count=0;
167
    static BYTE count=0;
167
 
-
 
168
 
168
 
169
    if (waitingMessage==TRUE && (tickGet()-timeout)>TICK_SECOND/20)
169
    if (waitingMessage==TRUE && (tickGet()-timeout)>TICK_SECOND/20)
170
    {
170
    {
171
        waitingMessage=FALSE;
171
        waitingMessage=FALSE;
172
    }
172
    }
Line 182... Line 182...
182
        if(count>=15)
182
        if(count>=15)
183
        {
183
        {
184
            if (c==UART_END_BYTE)
184
            if (c==UART_END_BYTE)
185
            {
185
            {
186
                LED0_IO=~LED0_IO;
186
                LED0_IO=~LED0_IO;
-
 
187
                //canParse(cm);
187
                while(!canSendMessage(cm,PRIO_LOWEST));
188
                while(!canSendMessage(cm,PRIO_HIGEST));
188
            }
189
            }
189
            waitingMessage=FALSE;
190
            waitingMessage=FALSE;
190
            return;
191
            return;
191
        }
192
        }
192
 
193