yincheng.zhong
2024-12-09 46f58be3ec0f37414a681b8279109e2120dfe627
Src/application/dw_app.c
@@ -163,7 +163,7 @@
        *ts += ts_field[i] << (i * 8);
    }
}
u8 usart_send_anc[10];
void Dw1000_Init(void)
{
   /* Reset and initialise DW1000.
@@ -172,7 +172,7 @@
    Reset_DW1000();//重启DW1000 /* Target specific drive of RSTn line into DW1000 low for a period. */
   Spi_ChangePrescaler(SPIx_PRESCALER_SLOW);   //设置为快速模式
    dwt_initialise(DWT_LOADUCODE);//初始化DW1000
   Spi_ChangePrescaler(SPIx_PRESCALER_FAST);   //设置为快速模式
//   Spi_ChangePrescaler(SPIx_PRESCALER_FAST);   //设置为快速模式
    /* Configure DW1000. See NOTE 6 below. */
    dwt_configure(&config);//配置DW1000
@@ -182,7 +182,19 @@
    /* Apply default antenna delay value. See NOTE 1 below. */
    dwt_setrxantennadelay(RX_ANT_DLY);      //设置接收天线延迟
    dwt_settxantennadelay(TX_ANT_DLY);      //设置发射天线延迟
    if(g_com_map[MODBUS_MODE])
    {
    delay_ms(10);
    dwt_configcontinuousframemode(12480);
    dwt_writetxdata(13, usart_send_anc, 0);//将Poll包数据传给DW1000,将在开启发送时传出去
   dwt_writetxfctrl(13, 0);//设置超宽带发送数据长度
   dwt_starttx(DWT_START_TX_IMMEDIATE);//开启发送,发送完成后等待一段时间开启接收,等待时间在dwt_setrxaftertxdelay中设置
       while(1)
        {
          IdleTask();
        }
    }
    Spi_ChangePrescaler(SPIx_PRESCALER_FAST);
    /* Set expected response's delay and timeout. See NOTE 4 and 5 below.
     * As this example only handles one incoming frame with always the same delay and timeout, those values can be set here once for all. */
            //设置接收超时时间