UWB-Tracking
Loading...
Searching...
No Matches
tof-responder.h
Go to the documentation of this file.
1#pragma once
2#include "tof-device.h"
3#include <ArduinoJson.h>
4#include <FS.h>
5#include <SPIFFS.h>
6
11#define POLL_RX_TO_RESP_TX_DLY_UUS 2400
12
16static portMUX_TYPE taskMutex = portMUX_INITIALIZER_UNLOCKED;
17
21class TofResponder : public TofDevice
22{
23public:
31 TofResponder(uwb_addr src, uwb_addr dst, unsigned long wdt_timeout, DynamicJsonDocument* rx_diagnostics);
33
37 virtual void setup() override;
38
42 virtual void loop() override;
43
44private:
49
53 uint64_t poll_rx_ts;
54
58 uint64_t resp_tx_ts;
59
63 DynamicJsonDocument * rx_diagnostics_json;
64
68 static SemaphoreHandle_t responseSemaphore;
69
74
79 static void rx_ok_cb(const dwt_cb_data_t *cb_data);
80};
The base class for Time-of-Flight (TOF) devices.
Definition: tof-device.h:44
The TofResponder class represents a TOF responder device.
Definition: tof-responder.h:22
uint64_t poll_rx_ts
Timestamp of poll frame reception.
Definition: tof-responder.h:53
virtual void loop() override
Main loop of the TOF responder device.
Definition: tof-responder.cpp:51
static SemaphoreHandle_t responseSemaphore
FreeRTOS Semaphore to indicate a active response.
Definition: tof-responder.h:68
static void rx_ok_cb(const dwt_cb_data_t *cb_data)
Static interrupt service routine (ISR) for successful frame reception.
Definition: tof-responder.cpp:233
~TofResponder()
Definition: tof-responder.h:32
DynamicJsonDocument * rx_diagnostics_json
JSON holding the rx diagnostic information with style like uwb_diagnostic.json.
Definition: tof-responder.h:63
uwb_addr dst_address
The destination address of the initiator.
Definition: tof-responder.h:48
uint64_t resp_tx_ts
Timestamp of response frame transmission.
Definition: tof-responder.h:58
virtual void setup() override
Initialize and configure the TOF responder device.
Definition: tof-responder.cpp:19
void update_rx_diagnostics()
updates the value of rx_diagnostics.
Definition: tof-responder.cpp:196
long long uwb_addr
Definition: datatypes.h:11
Header file for the TOFDevice class, a superclass for TOF initiators and responders.
static portMUX_TYPE taskMutex
A FreeRTOS Mutex type to protekt task from getting interupted while tof mesuring.
Definition: tof-responder.h:16