|
沙发
楼主 |
发表于 2022-8-8 22:35:48
|
只看该作者
static void Send_Order_To_TAG(int ID,int O1,int O2)
{
msg_f_send.destAddr[0] =(ID) &0xFF;
msg_f_send.destAddr[1] = ((ID)>>8) &0xFF;
msg_f_send.seqNum = distance_seqnum;
msg_f_send.messageData[0]='O';
{
uint8 len = 0;
uint8 LOCATION_INFO_START_IDX = 1;
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = O1;//order1
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = O2;//order2
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order3
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order4
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order5
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order6
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order7
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order8
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order9
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order10
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order11
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order12
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order13
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = 0xFF;//order14
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = '\n';
msg_f_send.messageData[LOCATION_INFO_START_IDX + (len++)] = '\r';
}
dwt_writetxdata(11 + 17,(uint8 *)&msg_f_send, 0) ; // write the frame data
dwt_writetxfctrl(11 + 17, 0);
dwt_starttx(DWT_START_TX_IMMEDIATE);//DWT_START_TX_DELAYED,DWT_START_TX_IMMEDIATE
while (!(dwt_read32bitreg(SYS_STATUS_ID) & SYS_STATUS_TXFRS))
{ };
dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_TXFRS);//清除发送完成标志
} |
|