optimize test_can and test_timer

This commit is contained in:
Liu_Weichao
2023-12-06 15:35:42 +08:00
parent 4de08ed386
commit 4c8df066b7
3 changed files with 37 additions and 35 deletions

View File

@@ -60,7 +60,6 @@ void TestCAN(void)
frame_send.stdid = 0x55;
frame_send.rtr=0;
frame_send.data_lenth=8;
frame_send.data = data_buff;
struct CanSendConfigure frame_recv;
uint8_t recv_buff[65U] = {0};
@@ -69,13 +68,20 @@ void TestCAN(void)
// CAN write
while (1)
{
PrivTaskDelay(500);
PrivWrite(can_fd, &frame_send, NONE);
PrivTaskDelay(500);
// PrivTaskDelay(500);
// PrivWrite(can_fd, &frame_send, NONE);
// PrivTaskDelay(500);
PrivRead(can_fd, &frame_recv, NONE);
// if any data has received,Then printf message
if(frame_recv.data_lenth > 0){
printf("ID %08x:%s\n",frame_recv.exdid,frame_recv.data);
printf("ID %08x : \n",frame_recv.exdid);
for(int i = 0; i < frame_recv.data_lenth; i ++) {
printf("0x%x ", frame_recv.data[i]);
}
printf("\n");
frame_send.data = recv_buff;
PrivWrite(can_fd, &frame_send, NONE);
}
}