Subversion Repositories HomeAutomation

Rev

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

Rev 616 Rev 1044
Line 55... Line 55...
55
        txMsg.Data.bytes[5] = (buffer[index+2]>>0)&0xff;
55
        txMsg.Data.bytes[5] = (buffer[index+2]>>0)&0xff;
56
        txMsg.Data.bytes[6] = (buffer[index+3]>>8)&0xff;
56
        txMsg.Data.bytes[6] = (buffer[index+3]>>8)&0xff;
57
        txMsg.Data.bytes[7] = (buffer[index+3]>>0)&0xff;
57
        txMsg.Data.bytes[7] = (buffer[index+3]>>0)&0xff;
58
       
58
       
59
        /* buffers will be filled when sending more than 2-3 messages, so retry until sent */
59
        /* buffers will be filled when sending more than 2-3 messages, so retry until sent */
60
        //while (BIOS_CanSend(&txMsg) != CAN_OK) {}
60
        while (BIOS_CanSend(&txMsg) != CAN_OK) {}
61
        BIOS_CanSend(&txMsg);
-
 
62
       
-
 
63
        uint16_t dummycnt = 1;
-
 
64
        while (dummycnt > 0) {
-
 
65
            dummycnt++;
-
 
66
            asm("nop");
-
 
67
            asm("nop");
-
 
68
        }
-
 
69
    }
61
    }
70
   
62
   
71
    uint8_t lastpacketcnt = len&0x03;
63
    uint8_t lastpacketcnt = len&0x03;
72
    if (lastpacketcnt > 0) {
64
    if (lastpacketcnt > 0) {
73
        txMsg.DataLength = lastpacketcnt<<1;
65
        txMsg.DataLength = lastpacketcnt<<1;
74
        for (uint8_t i = 0; i < lastpacketcnt; i++) {
66
        for (uint8_t i = 0; i < lastpacketcnt; i++) {
75
            txMsg.Data.bytes[i<<1] = (buffer[(len&0xfc)|i]>>8)&0xff;
67
            txMsg.Data.bytes[i<<1] = (buffer[(len&0xfc)|i]>>8)&0xff;
76
            txMsg.Data.bytes[(i<<1)+1] = (buffer[(len&0xfc)|i]>>0)&0xff;
68
            txMsg.Data.bytes[(i<<1)+1] = (buffer[(len&0xfc)|i]>>0)&0xff;
77
        }
69
        }
78
        /* buffers will be filled when sending more than 2-3 messages, so retry until sent */
70
        /* buffers will be filled when sending more than 2-3 messages, so retry until sent */
79
        //while (BIOS_CanSend(&txMsg) != CAN_OK) {}
71
        while (BIOS_CanSend(&txMsg) != CAN_OK) {}
80
        BIOS_CanSend(&txMsg);
72
        //BIOS_CanSend(&txMsg);
81
    }
73
    }
82
 
74
 
83
}
75
}
84
#endif
76
#endif
85
 
77