| | |
| | | #define POLL_DELAY 100U //yuan100U |
| | | |
| | | /* Receive response timeout */ |
| | | #define RESP_RX_TIMEOUT_US 7500U //Yuan500 10mssuccess 300jixian |
| | | #define RESP_RX_TIMEOUT_US 6000U //Yuan500 10mssuccess 300jixian |
| | | |
| | | /* Field index in frame */ |
| | | #define MSG_SEQ_NUM_IDX 2 |
| | |
| | | } |
| | | uint32_t count_index; |
| | | int tt=1; |
| | | int TagRange(void) |
| | | void uwb_tag_init(void) |
| | | { |
| | | // The following peripherals will be initialized in the uwb_open function |
| | | // The following peripherals will be initialized in the uwb_open function |
| | | // phy/mac/aes/lsp/phy timers initialized |
| | | uwb_open(); |
| | | |
| | |
| | | |
| | | ranging_frame_type_set(config.phy_cfg.sts_pkt_cfg); |
| | | |
| | | // Register rx interrupt callback function |
| | | mac_register_process_handler(tx_int_callback, rx_int_callback); |
| | | |
| | | |
| | | } |
| | | int TagRange(void) |
| | | { |
| | | |
| | | phy_timer_open(1, IRQ_PRIORITY_HIGH); |
| | | //#if LOW_POWER_EN |
| | | // // Initialize low power mode |
| | | // power_init(); |
| | | // // Enable sleep timer |
| | | // sleep_timer_open(true, SLEEP_TIMER_MODE_ONESHOT, NULL); |
| | | //#endif |
| | | // Register rx interrupt callback function |
| | | |
| | | mac_register_process_handler(tx_int_callback, rx_int_callback); |
| | | uwb_poll_buffer_construct(); |
| | | temp_tag_num=0;//临时数量为0 |
| | | poll_tx_en_start_u32 = phy_timer_count_get()+US_TO_PHY_TIMER_COUNT(POLL_DELAY);//发送必须要延时发送才可以用于测距否则立即发送会获取时间戳不对,需要计算程序运行时间,避免设置过去时间 |
| | |
| | | // if(tt){ |
| | | while(current_count<end_receive_count||current_count>end_receive_count+HALF_SECOND_TIME)//循环接受包体,若为124.8K则是+62400000 |
| | | { |
| | | |
| | | current_count=phy_timer_count_get();//不断刷新当前计数器值 |
| | | temp_count2=phy_timer_count_get(); |
| | | while(mac_is_busy());//等待接收完成 |