zhyinch
2018-09-15 4979f7565cbd5f093e280f9f277ae29bb450acb8
Ô´Âë/ºËÐİå/Src/application/dw_app.c
@@ -47,13 +47,13 @@
#define POLL_TX_TO_RESP_RX_DLY_UUS 150
/* This is the delay from Frame RX timestamp to TX reply timestamp used for calculating/setting the DW1000's delayed TX function. This includes the
 * frame length of approximately 2.66 ms with above configuration. */
#define RESP_RX_TO_FINAL_TX_DLY_UUS 4100
#define RESP_RX_TO_FINAL_TX_DLY_UUS 5100
/* Receive response timeout. See NOTE 5 below. */
#define RESP_RX_TIMEOUT_UUS 14700
#define POLL_RX_TO_RESP_TX_DLY_UUS 3600
/* This is the delay from the end of the frame transmission to the enable of the receiver, as programmed for the DW1000's wait for response feature. */
#define RESP_TX_TO_FINAL_RX_DLY_UUS 500
#define RESP_TX_TO_FINAL_RX_DLY_UUS 1500
/* Receive final timeout. See NOTE 5 below. */
#define FINAL_RX_TIMEOUT_UUS 4300
@@ -223,7 +223,9 @@
    /* Configure DW1000. See NOTE 6 below. */
    dwt_configure(&config);//配置DW1000
    /* Apply default antenna delay value. See NOTE 1 below. */
    dwt_setrxantennadelay(RX_ANT_DLY);      //设置接收天线延迟
    dwt_settxantennadelay(TX_ANT_DLY);      //设置发射天线延迟
@@ -233,11 +235,24 @@
    dwt_setrxaftertxdelay(POLL_TX_TO_RESP_RX_DLY_UUS);         //设置发送后开启接收,并设定延迟时间
    dwt_setrxtimeout(RESP_RX_TIMEOUT_UUS);                  //设置接收超时时间
}
void Delayus(uint16_t time)
{
  uint16_t i = 0;
  while (time--) {
    i = 10;
    while (i--)
      ;
  }
}
void Tag_App(void)//发送模式(TAG标签)
{
   uint32_t frame_len;
   uint32_t final_tx_time;
   GPIO_ResetBits(SPIx_GPIO, SPIx_CS);
   Delayus(2000);
   GPIO_SetBits(SPIx_GPIO, SPIx_CS);
   
   /* Write frame data to DW1000 and prepare transmission. See NOTE 7 below. */
   tx_poll_msg[ALL_MSG_SN_IDX] = frame_seq_nb;
@@ -319,7 +334,8 @@
   }
   LED0_BLINK;
   /* Execute a delay between ranging exchanges. */
   deca_sleep(RNG_DELAY_MS + random_delay_tim); //休眠固定时间
   dwt_entersleep();
}
void Anchor_App(void)