| | |
| | | tx_final_msg[MESSAGE_TYPE_IDX]=FINAL; |
| | | tx_sync_msg[MESSAGE_TYPE_IDX]=SYNC; |
| | | |
| | | memcpy(&tx_poll_msg[GROUP_ID_IDX], &group_id, 1); |
| | | memcpy(&tx_final_msg[GROUP_ID_IDX], &group_id, 1); |
| | | memcpy(&tx_resp_msg[GROUP_ID_IDX], &group_id, 1); |
| | | |
| | | memcpy(&tx_poll_msg[TAG_ID_IDX], &dev_id, 4); |
| | | memcpy(&tx_final_msg[TAG_ID_IDX], &dev_id, 4); |
| | | memcpy(&tx_resp_msg[ANCHOR_ID_IDX], &dev_id, 4); |
| | |
| | | /* 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[MESSAGE_TYPE_IDX] == RESPONSE&&!memcmp(&rx_buffer[TAG_ID_IDX],&dev_id,4)) //å¤ææ¥æ¶å°çæ°æ®æ¯å¦æ¯responseæ°æ® |
| | | if (rx_buffer[GROUP_ID_IDX] == group_id&&rx_buffer[MESSAGE_TYPE_IDX] == RESPONSE&&!memcmp(&rx_buffer[TAG_ID_IDX],&dev_id,4)) //å¤ææ¥æ¶å°çæ°æ®æ¯å¦æ¯responseæ°æ® |
| | | { u16 anc_id_recv; |
| | | /* Retrieve poll transmission and response reception timestamp. */ |
| | | poll_tx_ts = get_tx_timestamp_u64(); //è·å¾POLLåéæ¶é´T1 |
| | |
| | | // deca_sleep(10); |
| | | } |
| | | // dwt_entersleep(); |
| | | if(tag_succ_times<g_com_map[MIN_REPORT_ANC_NUM]) |
| | | { |
| | | //poll_timer +=time32_incr&0x7+3; |
| | | } |
| | | // if(tag_succ_times<g_com_map[MIN_REPORT_ANC_NUM]) |
| | | // { |
| | | // //poll_timer +=time32_incr&0x7+3; |
| | | // } |
| | | |
| | | /* Execute a delay between ranging exchanges. */ |
| | | |
| | |
| | | // tag_recv_interval = tag_recv_timer + 65535 - tag_time_recv[tag_id_recv]; |
| | | // } |
| | | |
| | | if (rx_buffer[MESSAGE_TYPE_IDX] == POLL&&(anchor_type == rx_buffer[ANC_TYPE_IDX])) //夿æ¯å¦æ¯pollå
æ°æ® |
| | | if (rx_buffer[GROUP_ID_IDX] == group_id&&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[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] == group_id&&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; |