TI BLE5-Stack API Documentation  2.00.04.00
rtls_ctrl_tof.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  @file rtls_ctrl_tof.h
4 
5  @brief This file contains the functions and structures specific to
6  ToF post processing
7  Group: WCS, BTS
8  $Target Device: DEVICES $
9 
10  ******************************************************************************
11  $License: BSD3 2018 $
12  ******************************************************************************
13  $Release Name: PACKAGE NAME $
14  $Release Date: PACKAGE RELEASE DATE $
15  *****************************************************************************/
16 
17 
28 #ifndef RTLS_CTRL_TOF_H_
29 #define RTLS_CTRL_TOF_H_
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35 
36 /*********************************************************************
37  * INCLUDES
38  */
39 
40 #include "TOF.h"
41 
42 /*********************************************************************
43 * EXTERNAL VARIABLES
44 */
45 
46 /*********************************************************************
47  * CONSTANTS
48  */
49 
50 #define RTLS_CTRL_TOF_RSSI_THRESHOLD_HYSTERESIS -5
51 #define MAX_TOF_SAMPLES_SINGLE_CHUNK 16
52 
53 /*********************************************************************
54  * MACROS
55  */
56 
57 /*********************************************************************
58  * TYPEDEFS
59  */
60 
61 
66 typedef enum
68 {
69  TOF_MODE_DIST,
70  TOF_MODE_STAT,
71  TOF_MODE_RAW
73 
75 typedef enum
76 {
77  TOF_MODE_CONT,
78  TOF_MODE_ONE_SHOT,
79  TOF_MODE_AUTO
80 } tofRunMode_e;
81 
83 typedef enum
84 {
85  TOF_CALIB_NOT_INITIALIZED,
86  TOF_CALIB_CALIBRATING,
87  TOF_CALIB_CALIBRATED
89 
91 typedef struct
92 {
94  tofResultMode_e resultMode;
95  tofRunMode_e runMode;
96  uint8_t constSyncwords;
98 
100 typedef struct
101 {
102  tofCalibState_e tofCalibState;
104  uint16_t calibrationOffset;
107 
109 typedef struct __attribute__((packed))
110 {
111  ToF_Role tofRole;
112  uint16_t numBurstSamples;
113  uint8_t numFreq;
114  rtlsTofConfig_t tofConfig;
115  uint16_t frequencies[];
116 } rtlsTofParams_t;
117 
119 typedef struct __attribute__((packed))
120 {
121  uint8_t seed[TOF_SEEDLEN];
122 } rtlsTofSecSeed_t;
123 
125 typedef struct __attribute__((packed))
126 {
127  uint8_t enableTof;
128 } rtlsEnableTofCmd_t;
129 
131 typedef struct __attribute__((packed))
132 {
133  uint8_t enableCalib;
134  uint16_t samplesPerFreq;
135  uint8_t calibDistance;
136 } rtlsEnableTofCalib_t;
137 
139 typedef struct __attribute__((packed))
140 {
141  double distance;
142  int8_t rssi;
143 } rtlsTofResultDistance_t;
144 
146 typedef struct __attribute__((packed))
147 {
148  uint32_t tick;
149  uint8_t freqIdx;
150  int8_t rssi;
151 } rtlsTofResultRaw_t;
152 
154 typedef struct __attribute__((packed))
155 {
156  uint16_t offset;
157  uint16_t samplesLength;
158  rtlsTofResultRaw_t samples[];
159 } rtlsTofResultRawAggr_t;
160 
162 typedef struct __attribute__((packed))
163 {
164  uint16_t freq;
165  double tick;
166  double tickVariance;
167  int8_t rssi;
168  uint32_t numOk;
169 } rtlsTofResultStat_t;
170 
172 typedef struct
173 {
174  ToF_Struct tofStruct;
175  ToF_Handle tofHandle;
184 } rtlsTof_t;
187 /*********************************************************************
188  * API FUNCTIONS
189  */
190 
199 void RTLSCtrl_postProcessTof(rtlsTof_t *tofControlBlock, int8_t rssi);
200 
211 void RTLSCtrl_outputTofStat(uint8_t cmdId, uint16_t numFreq, ToF_BurstStat *tofStatArray, uint8_t rssi);
212 
213 /*********************************************************************
214 *********************************************************************/
215 
216 #ifdef __cplusplus
217 }
218 #endif
219 
220 #endif /* RTLS_CTRL_TOF_H_ */
221 
tofCalibState_e tofCalibState
Calibration state.
Definition: rtls_ctrl_tof.h:102
ToF_BurstStat * pTofAverage
Array to save average of samples (for each frequency)
Definition: rtls_ctrl_tof.h:179
ToF_BurstStat * pTofLastRun
Array to save samples from the last ToF run.
Definition: rtls_ctrl_tof.h:178
void RTLSCtrl_outputTofStat(uint8_t cmdId, uint16_t numFreq, ToF_BurstStat *tofStatArray, uint8_t rssi)
Output array of ToF_BurstStat.
tofResultMode_e
Enumeration for ToF Result Mode.
Definition: rtls_ctrl_tof.h:67
uint8_t bOneShotSuccessful
Used to determine whether a one shot ToF run was successful.
Definition: rtls_ctrl_tof.h:181
tofRunMode_e runMode
One-shot/continuous/auto.
Definition: rtls_ctrl_tof.h:95
ToF_BurstStat * pCalibVals
Array to save calibration values.
Definition: rtls_ctrl_tof.h:105
uint8_t constSyncwords
Syncwords are generated only once.
Definition: rtls_ctrl_tof.h:96
rtlsTofCalib_t tofCalibInfo
Information about ToF calibration.
Definition: rtls_ctrl_tof.h:177
uint8_t bSlaveTofEnabled
Used to determine whether slave is doing ToF or not.
Definition: rtls_ctrl_tof.h:183
TOF Burst Stats Structure.
Definition: TOF.h:160
ToF calibration information.
Definition: rtls_ctrl_tof.h:100
rtlsTofConfig_t tofConfig
Values configured by the user.
Definition: rtls_ctrl_tof.h:176
int8_t autoTofRssiTresh
RSSI threshold.
Definition: rtls_ctrl_tof.h:93
tofCalibState_e
Enumeration for ToF calibration states.
Definition: rtls_ctrl_tof.h:83
ToF_Role
Enumeration for TOF roles of operation.
Definition: TOF.h:102
void RTLSCtrl_postProcessTof(rtlsTof_t *tofControlBlock, int8_t rssi)
Post process a ToF run.
Aggregation of ToF structures needed for RTLS Control operation (saved in gRtlsData) ...
Definition: rtls_ctrl_tof.h:172
ToF_Struct tofStruct
Struct will be filled by TOF_open.
Definition: rtls_ctrl_tof.h:174
struct __attribute__((packed))
BLE Connection information.
Definition: rtls_ble.h:59
#define TOF_SEEDLEN
Seed Length in Bytes.
Definition: TOF.h:53
tofRunMode_e
Enumeration for ToF Run Mode.
Definition: rtls_ctrl_tof.h:75
tofResultMode_e resultMode
On/off-chip result processing.
Definition: rtls_ctrl_tof.h:94
uint8_t bTofValuesInitialized
Flag to check if ToF was run at least once.
Definition: rtls_ctrl_tof.h:180
uint16_t calibrationOffset
The distance at which calibration is being performed (will be subtracted from final result) ...
Definition: rtls_ctrl_tof.h:104
ToF_Handle tofHandle
Handle will be passed to the TOF driver for actions.
Definition: rtls_ctrl_tof.h:175
TOF interface.
uint8_t bSlaveTofParamPend
Used to determine whether to send params to slave when a connection is formed.
Definition: rtls_ctrl_tof.h:182
Various ToF configurations.
Definition: rtls_ctrl_tof.h:91
uint8_t runsForCalibration
Amount runs (instances of TOF_run) needed until calibration is complete.
Definition: rtls_ctrl_tof.h:103
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale