| | |
| | | u32 getdatatimer[TAGARRAY_LEN]; |
| | | #define DATALOSTTIME 2000 |
| | | extern float dw_vbat; |
| | | extern u8 supergroupid; |
| | | extern u16 slottime,max_slotnum,current_slotpos,tyncpoll_time; |
| | | void Tag_App(void)//å鿍¡å¼(TAGæ ç¾) |
| | | { |
| | |
| | | /* Check that the frame is the expected response from the companion "DS TWR responder" example. |
| | | * As the sequence number field of the frame is not relevant, it is cleared to simplify the validation of the frame. */ |
| | | |
| | | if ((rx_buffer[GROUP_ID_IDX]==0||rx_buffer[GROUP_ID_IDX] == group_id||group_id==0)&&rx_buffer[MESSAGE_TYPE_IDX] == RESPONSE&&!memcmp(&rx_buffer[TAG_ID_IDX],&dev_id,4)) //å¤ææ¥æ¶å°çæ°æ®æ¯å¦æ¯responseæ°æ® |
| | | if ((rx_buffer[GROUP_ID_IDX]==supergroupid||rx_buffer[GROUP_ID_IDX] == group_id||group_id==supergroupid)&&rx_buffer[MESSAGE_TYPE_IDX] == RESPONSE&&!memcmp(&rx_buffer[TAG_ID_IDX],&dev_id,4)) //å¤ææ¥æ¶å°çæ°æ®æ¯å¦æ¯responseæ°æ® |
| | | { u16 anc_id_recv,rec_com_interval; |
| | | /* Retrieve poll transmission and response reception timestamp. */ |
| | | poll_tx_ts = get_tx_timestamp_u64(); //è·å¾POLLåéæ¶é´T1 |
| | |
| | | memcpy(&usart_send[19],&checksum,2); |
| | | UART_PushFrame(usart_send,21); |
| | | } |
| | | Modbus_HoldReg[anc_id_recv*2]=hex_dist2>>16; |
| | | Modbus_HoldReg[anc_id_recv*2+1]=hex_dist2; |
| | | } |
| | | // memcpy(&Modbus_HoldReg[anc_id_recv*2],&hex_dist,4); |
| | | /* Poll DW1000 until TX frame sent event set. See NOTE 8 below. */ |
| | |
| | | // tag_recv_interval = tag_recv_timer + 65535 - tag_time_recv[tag_id_recv]; |
| | | // } |
| | | |
| | | if ((rx_buffer[GROUP_ID_IDX]==0||rx_buffer[GROUP_ID_IDX] == group_id||group_id==0)&&rx_buffer[MESSAGE_TYPE_IDX] == POLL&&(anchor_type == rx_buffer[ANC_TYPE_IDX])) //夿æ¯å¦æ¯pollå
æ°æ® |
| | | if ((rx_buffer[GROUP_ID_IDX]==supergroupid||rx_buffer[GROUP_ID_IDX] == group_id||group_id==supergroupid)&&rx_buffer[MESSAGE_TYPE_IDX] == POLL&&(anchor_type == rx_buffer[ANC_TYPE_IDX])) //夿æ¯å¦æ¯pollå
æ°æ® |
| | | { |
| | | tmp_time=TIM3->CNT; |
| | | memcpy(&tx_resp_msg[ANCTIMEMS],&sync_timer,2); |
| | |
| | | /* Check that the frame is a final message sent by "DS TWR initiator" example. |
| | | * As the sequence number field of the frame is not used in this example, it can be zeroed to ease the validation of the frame. */ |
| | | |
| | | if ((rx_buffer[GROUP_ID_IDX]==0||rx_buffer[GROUP_ID_IDX] == group_id||group_id==0)&&rx_buffer[MESSAGE_TYPE_IDX] == FINAL&&!memcmp(&rx_buffer[TAG_ID_IDX],&tag_id_recv,4)&&!memcmp(&rx_buffer[ANCHOR_ID_IDX],&dev_id,4)) //夿æ¯å¦ä¸ºFinalå
|
| | | if ((rx_buffer[GROUP_ID_IDX]==supergroupid||rx_buffer[GROUP_ID_IDX] == group_id||group_id==supergroupid)&&rx_buffer[MESSAGE_TYPE_IDX] == FINAL&&!memcmp(&rx_buffer[TAG_ID_IDX],&tag_id_recv,4)&&!memcmp(&rx_buffer[ANCHOR_ID_IDX],&dev_id,4)) //夿æ¯å¦ä¸ºFinalå
|
| | | { |
| | | uint32_t poll_tx_ts, resp_rx_ts, final_tx_ts; |
| | | uint32_t poll_rx_ts_32, resp_tx_ts_32, final_rx_ts_32; |