|
代码参考如下:主要定义声明:
- static dwt_rxdiag_t rx_diag;
- #define ACCUM_DATA_LEN 50
- static uint8 accum_data[ACCUM_DATA_LEN];
- int max(int a, int b)
- {
- if(a>b)
- return a;
- else
- return b;
- }
- int min(int a, int b)
- {
- if(a < b)
- return a;
- else
- return b;
- }
- void dwNLOS_ExtractAndPrintCIR()
- {
- uint8 cir[5]={0};
- for(int i = 0;i<1016;i++)
- {
- dwt_readaccdata(cir, 5, 4*i);
- int16 real =0;
- int16 imag =0;
- double amp=0;
- real = (int16)cir[2] << 8 | (int16)cir[1];/*printf("%i,",real);*/
- imag = (int16)cir[4] << 8 | (int16)cir[3]; /*printf("%u\n",imag);*/
- printf("index:%d,real:%i,imag:%i\r\n",i, real,imag);
- }
- }
复制代码 在UWB接收完信号执行如下代码
- /* Read diagnostics data. */
- dwt_readdiagnostics(&rx_diag);
- /* Read accumulator */
- dwNLOS_ExtractAndPrintCIR();
- printf("Count of preamble symbols accumulated: %d \r\n",rx_diag.rxPreamCount);
- printf("Index of first path is %d \r\n", rx_diag.firstPath / 64);
- printf("CIR max growth CIR: % d \r\n",rx_diag.maxGrowthCIR);
- printf("LDE max value of noise: %d \r\n", rx_diag.maxNoise);
- printf("Std of noise is %d \r\n",rx_diag.stdNoise);
- printf("First Path AMP2: %d \r\n",rx_diag.firstPathAmp2);
- printf("First Path AMP3: %d \r\n",rx_diag.firstPathAmp3);
- printf("First Path AMP1: %d \r\n",rx_diag.firstPathAmp1);
复制代码
|
|