Subversion Repositories HomeAutomation

Rev

Rev 168 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 168 Rev 200
Line 29... Line 29...
29
 *---------------------------------------------------------------------------*/
29
 *---------------------------------------------------------------------------*/
30
int main(void) {
30
int main(void) {
31
    Timebase_Init();
31
    Timebase_Init();
32
    Serial_Init();
32
    Serial_Init();
33
    sei();
33
    sei();
-
 
34
   
-
 
35
    #if defined(__AVR_ATmega88__)
-
 
36
    // set the clock speed to 8MHz
-
 
37
    // set the clock prescaler. First write CLKPCE to enable setting of clock the
-
 
38
    // next four instructions.
-
 
39
    CLKPR=(1<<CLKPCE);
-
 
40
    CLKPR=0; // 8 MHZ
-
 
41
    #endif
34
   
42
   
35
    IRDDR &= ~(1<<IRBIT);
43
    IRDDR &= ~(1<<IRBIT);
36
   
44
   
37
    printf("\n------------------------------------------------------------\n");
45
    printf("\n------------------------------------------------------------\n");
38
    printf(  "   CAN Test: Periodic Transmission\n");
46
    printf(  "   CAN Test: Periodic Transmission\n");
Line 77... Line 85...
77
            if (Timebase_PassedTimeMillis(irTimeoutTimeStamp) >= 105) {     //getLastProtoTimeout()
85
            if (Timebase_PassedTimeMillis(irTimeoutTimeStamp) >= 105) {     //getLastProtoTimeout()
78
                state = STATE_IDLE;
86
                state = STATE_IDLE;
79
                txMsg.Data.bytes[0] = 0x0f;
87
                txMsg.Data.bytes[0] = 0x0f;
80
                Can_Send(&txMsg);
88
                Can_Send(&txMsg);
81
            }
89
            }
82
            if (!(IRPIN & (1<<IRBIT))) {        //funktion som borde finnas i irreceiver.c
90
            if (checkIrIdle() == IR_OK) {       //funktion som borde finnas i irreceiver.c
83
                irTimeoutTimeStamp = Timebase_CurrentTime();
91
                irTimeoutTimeStamp = Timebase_CurrentTime();
84
            }
92
            }
85
        }
93
        }
86
       
94
       
87
   
95