| | |
| | | #include "beep.h" |
| | | #include "modbus.h" |
| | | |
| | | #define SUPERTAG_GROUP 0xff |
| | | #define USART_INTEGRATE_OUTPUT |
| | | /*------------------------------------ Marcos ------------------------------------------*/ |
| | | /* Inter-ranging delay period, in milliseconds. */ |
| | |
| | | NEARPOLL, |
| | | }tag_state=GETNEARMSG; |
| | | static dwt_config_t config = { |
| | | 5, /* Channel number. */ |
| | | 5, /* Channel number. */ |
| | | DWT_PRF_64M, /* Pulse repetition frequency. */ |
| | | DWT_PLEN_128, /* Preamble length. */ |
| | | DWT_PAC8, /* Preamble acquisition chunk size. Used in RX only. */ |
| | |
| | | dwt_readrxdata(rx_buffer, frame_len, 0); //读取接收数据 |
| | | dwt_setrxtimeout(0);//DELAY_BETWEEN_TWO_FRAME_UUS*(nearbase_num+1-recbase_num)+10);//设定接收超时时间,0位没有超时时间 |
| | | dwt_rxenable(0);//打开接收 |
| | | if (rx_buffer[MESSAGE_TYPE_IDX] == NEAR_RESPONSE&&!memcmp(&rx_buffer[TAG_ID_IDX],&dev_id,2)&&rx_buffer[GROUP_ID_IDX]==group_id) //判断接收到的数据是否是response数据 |
| | | if (rx_buffer[MESSAGE_TYPE_IDX] == NEAR_RESPONSE&&!memcmp(&rx_buffer[TAG_ID_IDX],&dev_id,2)&&(group_id == SUPERTAG_GROUP||rx_buffer[GROUP_ID_IDX]==group_id)) //判断接收到的数据是否是response数据 |
| | | { u16 rec_nearbaseid,rec_nearbasepos; |
| | | poll_tx_ts = get_tx_timestamp_u64(); //获得POLL发送时间T1 |
| | | resp_rx_ts = get_rx_timestamp_u64(); //获得RESPONSE接收时间T4 |