资源简介
使用keil MDK平台开发dwm双向测距,一基站+一标签实现双向测距。使用方法:
在工程options中分别预定义宏EX_05A_DEF 或者 EX_05B_DEF 即可完成标签程序和基站程序的切换。
代码片段和文件信息
/*! ----------------------------------------------------------------------------
* @file main.c
* @brief Simple TX example code
*
* @attention
*
* Copyright 2015 (c) Decawave Ltd Dublin Ireland.
*
* All rights reserved.
*
* @author Decawave
*/
#ifdef EX_01A_DEF
#include “deca_device_api.h“
#include “deca_regs.h“
//#include “lcd.h“
#include “include.h“
#include “deca_spi.h“
#include “port.h“
/* Example application name and version to display on LCD screen. */
#define APP_NAME “SIMPLE TX v1.2“
/* Default communication configuration. We use here EVK1000‘s default mode (mode 3). */
static dwt_config_t config = {
2 /* Channel number. */
DWT_PRF_64M /* Pulse repetition frequency. */
DWT_PLEN_1024 /* Preamble length. Used in TX only. */
DWT_PAC32 /* Preamble acquisition chunk size. Used in RX only. */
9 /* TX preamble code. Used in TX only. */
9 /* RX preamble code. Used in RX only. */
1 /* 0 to use standard SFD 1 to use non-standard SFD. */
DWT_BR_110K /* Data rate. */
DWT_PHRMODE_STD /* PHY header mode. */
(1025 + 64 - 32) /* SFD timeout (preamble length + 1 + SFD length - PAC size). Used in RX only. */
};
/* The frame sent in this example is an 802.15.4e standard blink. It is a 12-byte frame composed of the following fields:
* - byte 0: frame type (0xC5 for a blink).
* - byte 1: sequence number incremented for each new frame.
* - byte 2 -> 9: device ID see NOTE 1 below.
* - byte 10/11: frame check-sum automatically set by DW1000. */
static uint8 tx_msg[] = {0xC5 0 ‘D‘ ‘E‘ ‘C‘ ‘A‘ ‘W‘ ‘A‘ ‘V‘ ‘E‘ 0 0};
/* Index to access to sequence number of the blink frame in the tx_msg array. */
#define blink_frame_SN_IDX 1
/* Inter-frame delay period in milliseconds. */
#define TX_DELAY_MS 5000
/* Dummy buffer for DW1000 wake-up SPI read. See NOTE 2 below. */
#define DUMMY_BUFFER_LEN 600
static uint8 dummy_buffer[DUMMY_BUFFER_LEN];
/**
* Application entry point.
*/
int dw_main(void)
{
/* Display application name on LCD. */
printf(APP_NAME);
printf(“\r\n“);
dwt_spicswakeup ( dummy_buffer DUMMY_BUFFER_LEN );
/* Reset and initialise DW1000. See NOTE 2 below.
* For initialisation DW1000 clocks must be temporarily set to crystal speed. After initialisation SPI rate can be increased for optimum
* performance. */
reset_DW1000(); /* Target specific drive of RSTn line into DW1000 low for a period. */
port_set_dw1000_slowrate();
if (dwt_initialise(DWT_LOADNONE) == DWT_ERROR)
{
printf(“INIT FAILED\r\n“);
while (1)
{ };
}
port_set_dw1000_fastrate();
/* Configure DW1000. See NOTE 3 below. */
dwt_configure(&config);
/* Loop forever sending frames periodically. */
while(1)
{
/* Write frame data to DW1000 and prepare transmission. See NOTE 4 below.*/
dwt_writetxdata(sizeof(tx_ms
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-05-07 18:58 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 2050 2020-05-04 04:17 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 6176 2020-05-04 21:37 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 7177 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 7818 2020-05-04 20:10 stm32_led_key_timeba
文件 7746 2020-05-04 18:46 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 8635 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 12529 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 5766 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 6231 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 8948 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 6438 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 6908 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 10192 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
文件 10071 2018-12-19 23:43 stm32_led_key_timeba
目录 0 2020-05-07 18:51 stm32_led_key_timeba
............此处省略187个文件信息
评论
共有 条评论