UWB-Tracking
Loading...
Searching...
No Matches
tdoa-device.h
Go to the documentation of this file.
1#pragma once
2
8#include <pin_config.h>
9#include <datatypes.h>
10#include <dw3000.h>
11#include <dw3000_mac_802_15_4.h>
12
13#define DEST_PAN_ID 0x4321
14
15/* Index to access to sequence number of the blink frame in the tx_msg array. */
16#define BLINK_FRAME_SN_IDX 1
17
18#define FRAME_LENGTH (sizeof(tx_msg) + FCS_LEN) // The real length that is going to be transmitted
19
20/* Inter-frame delay period, in milliseconds. */
21#define RNG_DELAY_TDOA 500 /* Inter-ranging delay period, in milliseconds. */
22
23#ifndef TX_ANT_DLY
24#define TX_ANT_DLY 16400
25#endif
26
27#ifndef RX_ANT_DLY
28#define RX_ANT_DLY 16400
29#endif
30
31/* Values for the PG_DELAY and TX_POWER registers reflect the bandwidth and power of the spectrum at the current
32 * temperature. These values can be calibrated prior to taking reference measurements.*/
33extern dwt_txconfig_t txconfig_options;
34
39{
40public:
46
51
55 virtual void setup();
56
60 void enable_leds();
61
65 virtual void loop();
66
71 char* get_type() {return const_cast<char*>(this->type.c_str());};
72
73protected:
74 /*defining the own source addresse*/
76
77 String type;
78
79 /* The frame sent in this code is an 802.15.4e standard blink. It is a 12-byte frame composed of the following fields:
80 * - byte 0: frame type (0xC5 for a blink).
81 * - byte 1: sequence number, incremented for each new frame.
82 * - byte 2 -> 9: device ID.
83 */
84 uint8_t tx_msg[10];
85
86 /* Buffer to store received response message.
87 * Its size is adjusted to longest frame that the code can handle. */
89
93 uint32_t status_reg;
94
98 int8_t status;
99
103 dwt_config_t config;
104};
The base class for TDOA (Time Difference of Arrival) devices.
Definition: tdoa-device.h:39
char * get_type()
Get the type of the TDOA device.
Definition: tdoa-device.h:71
String type
Definition: tdoa-device.h:77
uint8_t rx_buffer[FRAME_LENGTH]
Definition: tdoa-device.h:88
dwt_config_t config
Configuration settings for the DW3000 device.
Definition: tdoa-device.h:103
uwb_addr src_address
Definition: tdoa-device.h:75
uint8_t tx_msg[10]
Definition: tdoa-device.h:84
virtual void setup()
Perform setup and configuration of the TDOA device.
Definition: tdoa-device.cpp:61
int8_t status
Status variable indicating the device's current status.
Definition: tdoa-device.h:98
uint32_t status_reg
Status register value.
Definition: tdoa-device.h:93
~TdoaDevice()
Destructor for the TdoaDevice class.
Definition: tdoa-device.h:50
void enable_leds()
Enable LEDs on the TDOA device if available.
Definition: tdoa-device.cpp:79
virtual void loop()
Main loop function for the TDOA device.
Definition: tdoa-device.cpp:88
Defines custom data types used in the UWB device code.
long long uwb_addr
Definition: datatypes.h:11
Configuration of various pins used in the project.
dwt_txconfig_t txconfig_options
#define FRAME_LENGTH
Definition: tdoa-device.h:18