Subversion Repositories HomeAutomation

Rev

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

Rev 671 Rev 673
Line 79... Line 79...
79
#endif
79
#endif
80
   
80
   
81
    uint32_t timeStamp = 0;
81
    uint32_t timeStamp = 0;
82
   
82
   
83
    Can_Message_t txMsg;
83
    Can_Message_t txMsg;
84
    Can_Message_t rxMsg;
-
 
85
    txMsg.RemoteFlag = 0;
84
    txMsg.RemoteFlag = 0;
86
    txMsg.ExtendedFlag = 1;
85
    txMsg.ExtendedFlag = 1;
87
    txMsg.Id = SENDING_ID;
86
    txMsg.Id = SENDING_ID;
88
    txMsg.DataLength = 2;
87
    txMsg.DataLength = 2;
89
    txMsg.Data.bytes[0] = 0x12;
88
    txMsg.Data.bytes[0] = 0x12;
Line 95... Line 94...
95
        if (Timebase_PassedTimeMillis(timeStamp) >= 1000) {
94
        if (Timebase_PassedTimeMillis(timeStamp) >= 1000) {
96
            timeStamp = Timebase_CurrentTime();
95
            timeStamp = Timebase_CurrentTime();
97
            /* send txMsg */
96
            /* send txMsg */
98
            txMsg.Id = SENDING_ID;
97
            txMsg.Id = SENDING_ID;
99
            Can_Send(&txMsg);
98
            Can_Send(&txMsg);
-
 
99
#if defined(UART_OUTPUT)
-
 
100
            printf("\nSending: %#lx", txMsg.Id);
-
 
101
#endif
100
        }
102
        }
101
       
103
       
102
        /* check if any messages have been received */
104
        /* check if any messages have been received */
103
        if (rxMsgFull) {
105
        if (rxMsgFull) {
104
#if defined(UART_OUTPUT)
106
#if defined(UART_OUTPUT)
Line 109... Line 111...
109
            }
111
            }
110
#endif
112
#endif
111
            /* Echo function */
113
            /* Echo function */
112
            if(rxMsg.Id == ECHO_RECEIVE_ID){
114
            if(rxMsg.Id == ECHO_RECEIVE_ID){
113
#if defined(UART_OUTPUT)
115
#if defined(UART_OUTPUT)
114
                printf("\n\"ping\" received");
116
                printf("\n\"ping\" received: %#lx", rxMsg.Id);
115
                txMsg.Id = ECHO_SENDING_ID;
117
                txMsg.Id = ECHO_SENDING_ID;
116
                /* Send reply */
118
                /* Send reply */
117
                Can_Send(&txMsg);
119
                Can_Send(&txMsg);
118
                printf("\nreply sent");
120
                printf("\nreply sent, ID: %#lx", txMsg.Id);
119
#else
121
#else
120
                txMsg.Id = ECHO_SENDING_ID;
122
                txMsg.Id = ECHO_SENDING_ID;
121
                /* Send reply */
123
                /* Send reply */
122
                Can_Send(&txMsg);
124
                Can_Send(&txMsg);
123
#endif
125
#endif