AFBR-S50 API Reference Manual  v1.6.5
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
argus_dca.h
Go to the documentation of this file.
1 /*************************************************************************/
38 #ifndef ARGUS_DCA_H
39 #define ARGUS_DCA_H
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /*!***************************************************************************
45  * @defgroup argus_dca Dynamic Configuration Adaption
46  * @ingroup argus_api
47  *
48  * @brief Dynamic Configuration Adaption (DCA) parameter definitions and API functions.
49  *
50  * @details The DCA contains an algorithms that detect ambient conditions
51  * and adopt the device configuration to the changing parameters
52  * dynamically while operating the sensor. This is achieved by
53  * rating the currently received signal quality and changing the
54  * device configuration accordingly to the gathered information
55  * from the current measurement frame results before the next
56  * integration cycle starts.
57  *
58  * The DCA consists of the following features:
59  * - Static or Dynamic mode. The first is utilizing the nominal
60  * values while the latter is dynamically adopting between min.
61  * and max. value and starting from the nominal values.
62  * - Analog Integration Depth Adaption (from multiple patterns down to single pulses)
63  * - Optical Output Power Adaption
64  * - Pixel Input Gain Adaption (w/ ambient light rejection)
65  * - ADC Sensitivity (i.e. ADC Range) Adaption
66  * - Power Saving Ratio (to decrease the average output power and thus the current consumption)
67  * - All that features are heeding the Laser Safety limits.
68  * .
69  *
70  * @addtogroup argus_dca
71  * @{
72  *****************************************************************************/
73 
74 #include "argus_def.h"
75 
76 
77 
79 #define ARGUS_CFG_DCA_ATH_MIN (1U << 6U)
80 
82 #define ARGUS_CFG_DCA_ATH_MAX (0xFFFFU)
83 
84 
86 #define ARGUS_CFG_DCA_PXTH_MIN (1U)
87 
89 #define ARGUS_CFG_DCA_PXTH_MAX (33U)
90 
91 
94 #define ARGUS_CFG_DCA_DEPTH_MAX ((uq10_6_t)(0xFFC0U))
95 
98 #define ARGUS_CFG_DCA_DEPTH_MIN ((uq10_6_t)(1U)) // 1/64, i.e. 1/2 nibble
99 
100 
102 #define ARGUS_DCA_GAIN_STAGE_COUNT (4U)
103 
105 #define ARGUS_STATE_DCA_GAIN_MASK (0x03U)
106 
108 #define ARGUS_STATE_DCA_GAIN_SHIFT (14U)
109 
111 #define ARGUS_STATE_DCA_GAIN_GET(state) \
112  (((state) >> ARGUS_STATE_DCA_GAIN_SHIFT) & ARGUS_STATE_DCA_GAIN_MASK)
113 
114 
116 #define ARGUS_DCA_POWER_STAGE_COUNT (2U)
117 
119 #define ARGUS_STATE_DCA_POWER_MASK (0x01U)
120 
122 #define ARGUS_STATE_DCA_POWER_SHIFT (13U)
123 
125 #define ARGUS_STATE_DCA_POWER_GET(state) \
126  (((state) >> ARGUS_STATE_DCA_POWER_SHIFT) & ARGUS_STATE_DCA_POWER_MASK)
127 
128 
129 
130 
131 /*!***************************************************************************
132  * @brief The dynamic configuration algorithm enable flags.
133  *****************************************************************************/
134 typedef enum argus_dca_enable_t
135 {
144 
147 
150 
152 
153 /*!***************************************************************************
154  * @brief The DCA amplitude evaluation method.
155  *****************************************************************************/
157 {
160 
163 
165 
166 /*!***************************************************************************
167  * @brief The dynamic configuration algorithm Optical Output Power stages enumerator.
168  *****************************************************************************/
169 typedef enum argus_dca_power_t
170 {
173 
176 
179 
181 
182 /*!***************************************************************************
183  * @brief The dynamic configuration algorithm Pixel Input Gain stages enumerator.
184  *****************************************************************************/
185 typedef enum argus_dca_gain_t
186 {
189 
192 
195 
198 
200 
201 
202 /*!***************************************************************************
203  * @brief State flags for the current frame.
204  * @details State flags determine the current state of the measurement frame:
205  * - [0]: #ARGUS_STATE_XTALK_MONITOR_ACTIVE
206  * - [1]: #ARGUS_STATE_DUAL_FREQ_MODE
207  * - [2]: #ARGUS_STATE_MEASUREMENT_FREQ
208  * - [3]: #ARGUS_STATE_DEBUG_MODE
209  * - [4]: #ARGUS_STATE_WEAK_SIGNAL
210  * - [5]: #ARGUS_STATE_BGL_WARNING
211  * - [6]: #ARGUS_STATE_BGL_ERROR
212  * - [7]: #ARGUS_STATE_PLL_LOCKED
213  * - [8]: #ARGUS_STATE_LASER_WARNING
214  * - [9]: #ARGUS_STATE_LASER_ERROR
215  * - [10]: #ARGUS_STATE_HAS_DATA
216  * - [11]: #ARGUS_STATE_HAS_AUX_DATA
217  * - [12]: #ARGUS_STATE_SATURATED_PIXELS
218  * - [13]: DCA Power Stage
219  * - [14-15]: DCA Gain Stages
220  * - [16]: #ARGUS_STATE_DCA_MIN
221  * - [17]: #ARGUS_STATE_DCA_MAX
222  * - [18]: #ARGUS_STATE_DCA_RESET
223  * - [18-31]: not used
224  * .
225  *****************************************************************************/
226 typedef enum argus_state_t
227 {
230 
235 
240 
246 
253 
261 
268 
275 
280 
289 
297 
301  ARGUS_STATE_HAS_DATA = 1U << 10U,
302 
307 
314 
317 
320 
323 
326 
329 
337  ARGUS_STATE_DCA_MIN = 1U << 16U,
338 
346  ARGUS_STATE_DCA_MAX = 1U << 17U,
347 
354 
355 } argus_state_t;
356 
357 /*!***************************************************************************
358  * @brief Dynamic Configuration Adaption (DCA) Parameters.
359  * @details DCA contains:
360  * - Static or dynamic mode. The first is utilizing the nominal values
361  * while the latter is dynamically adopting between min. and max.
362  * value and starting form the nominal values.
363  * - Analog Integration Depth Adaption down to single pulses.
364  * - Optical Output Power Adaption
365  * - Pixel Input Gain Adaption
366  * - Digital Integration Depth Adaption
367  * - Dynamic Global Phase Shift Injection.
368  * - All that features are heeding the Laser Safety limits.
369  * .
370  *****************************************************************************/
371 typedef struct argus_cfg_dca_t
372 {
377 
389  uint8_t SatPxThLin;
390 
400  uint8_t SatPxThExp;
401 
413  uint8_t SatPxThRst;
414 
423 
431 
440 
445 
449 
457 
467 
477 
485 
493 
501 
509 
528 
532 
534 
536 #ifdef __cplusplus
537 } // extern "C"
538 #endif
539 #endif /* ARGUS_DCA_H */
argus_cfg_dca_t::DepthMin_HighPower
uq10_6_t DepthMin_HighPower
Definition: argus_dca.h:476
ARGUS_STATE_DCA_GAIN_LOW
@ ARGUS_STATE_DCA_GAIN_LOW
Definition: argus_dca.h:319
argus_dca_amplitude_mode_t
argus_dca_amplitude_mode_t
The DCA amplitude evaluation method.
Definition: argus_dca.h:156
argus_cfg_dca_t::AmplitudeMode
argus_dca_amplitude_mode_t AmplitudeMode
Definition: argus_dca.h:444
DCA_GAIN_MEDIUM_HIGH
@ DCA_GAIN_MEDIUM_HIGH
Definition: argus_dca.h:194
ARGUS_STATE_DCA_MIN
@ ARGUS_STATE_DCA_MIN
Definition: argus_dca.h:337
argus_cfg_dca_t
Dynamic Configuration Adaption (DCA) Parameters.
Definition: argus_dca.h:371
DCA_GAIN_HIGH
@ DCA_GAIN_HIGH
Definition: argus_dca.h:197
ARGUS_STATE_DCA_GAIN_MED_HIGH
@ ARGUS_STATE_DCA_GAIN_MED_HIGH
Definition: argus_dca.h:325
argus_cfg_dca_t::GainMax
argus_dca_gain_t GainMax
Definition: argus_dca.h:508
ARGUS_STATE_BGL_WARNING
@ ARGUS_STATE_BGL_WARNING
Definition: argus_dca.h:267
ARGUS_STATE_PLL_LOCKED
@ ARGUS_STATE_PLL_LOCKED
Definition: argus_dca.h:279
ARGUS_STATE_XTALK_MONITOR_ACTIVE
@ ARGUS_STATE_XTALK_MONITOR_ACTIVE
Definition: argus_dca.h:234
uq0_8_t
uint8_t uq0_8_t
Unsigned fixed point number: UQ0.8.
Definition: fp_def.h:162
DCA_POWER_LOW
@ DCA_POWER_LOW
Definition: argus_dca.h:172
argus_state_t
argus_state_t
State flags for the current frame.
Definition: argus_dca.h:226
argus_cfg_dca_t::DisablePowerSaveInLowPowerStage
uint8_t DisablePowerSaveInLowPowerStage
Definition: argus_dca.h:531
DCA_ENABLE_DYNAMIC
@ DCA_ENABLE_DYNAMIC
Definition: argus_dca.h:146
ARGUS_STATE_LASER_WARNING
@ ARGUS_STATE_LASER_WARNING
Definition: argus_dca.h:288
argus_cfg_dca_t::Power
argus_dca_power_t Power
Definition: argus_dca.h:448
DCA_GAIN_MEDIUM_LOW
@ DCA_GAIN_MEDIUM_LOW
Definition: argus_dca.h:191
argus_cfg_dca_t::GainMin
argus_dca_gain_t GainMin
Definition: argus_dca.h:500
argus_def.h
This file is part of the AFBR-S50 hardware API.
uq12_4_t
uint16_t uq12_4_t
Unsigned fixed point number: UQ12.4.
Definition: fp_def.h:231
ARGUS_STATE_LASER_ERROR
@ ARGUS_STATE_LASER_ERROR
Definition: argus_dca.h:296
ARGUS_STATE_WEAK_SIGNAL
@ ARGUS_STATE_WEAK_SIGNAL
Definition: argus_dca.h:260
argus_cfg_dca_t::AthLow
uq12_4_t AthLow
Definition: argus_dca.h:430
argus_cfg_dca_t::GainNom
argus_dca_gain_t GainNom
Definition: argus_dca.h:492
ARGUS_STATE_DUAL_FREQ_MODE
@ ARGUS_STATE_DUAL_FREQ_MODE
Definition: argus_dca.h:239
ARGUS_STATE_NONE
@ ARGUS_STATE_NONE
Definition: argus_dca.h:229
DCA_ENABLE_STATIC
@ DCA_ENABLE_STATIC
Definition: argus_dca.h:149
DCA_POWER_AUTO
@ DCA_POWER_AUTO
Definition: argus_dca.h:178
uq10_6_t
uint16_t uq10_6_t
Unsigned fixed point number: UQ10.6.
Definition: fp_def.h:251
ARGUS_STATE_MEASUREMENT_FREQ
@ ARGUS_STATE_MEASUREMENT_FREQ
Definition: argus_dca.h:245
ARGUS_STATE_SATURATED_PIXELS
@ ARGUS_STATE_SATURATED_PIXELS
Definition: argus_dca.h:313
argus_cfg_dca_t::Enabled
argus_dca_enable_t Enabled
Definition: argus_dca.h:376
argus_cfg_dca_t::DepthMin_LowPower
uq10_6_t DepthMin_LowPower
Definition: argus_dca.h:466
ARGUS_STATE_DCA_MAX
@ ARGUS_STATE_DCA_MAX
Definition: argus_dca.h:346
argus_cfg_dca_t::SatPxThLin
uint8_t SatPxThLin
Definition: argus_dca.h:389
ARGUS_STATE_DCA_GAIN_MED_LOW
@ ARGUS_STATE_DCA_GAIN_MED_LOW
Definition: argus_dca.h:322
DCA_GAIN_LOW
@ DCA_GAIN_LOW
Definition: argus_dca.h:188
DCA_POWER_HIGH
@ DCA_POWER_HIGH
Definition: argus_dca.h:175
ARGUS_STATE_BGL_ERROR
@ ARGUS_STATE_BGL_ERROR
Definition: argus_dca.h:274
ARGUS_STATE_HAS_AUX_DATA
@ ARGUS_STATE_HAS_AUX_DATA
Definition: argus_dca.h:306
ARGUS_STATE_DCA_GAIN_SHIFT
#define ARGUS_STATE_DCA_GAIN_SHIFT
Definition: argus_dca.h:108
ARGUS_STATE_DCA_RESET
@ ARGUS_STATE_DCA_RESET
Definition: argus_dca.h:353
DCA_AMPLITUDE_AVG
@ DCA_AMPLITUDE_AVG
Definition: argus_dca.h:162
ARGUS_STATE_DEBUG_MODE
@ ARGUS_STATE_DEBUG_MODE
Definition: argus_dca.h:252
ARGUS_STATE_DCA_GAIN_HIGH
@ ARGUS_STATE_DCA_GAIN_HIGH
Definition: argus_dca.h:328
argus_cfg_dca_t::Atarget
uq12_4_t Atarget
Definition: argus_dca.h:422
argus_dca_power_t
argus_dca_power_t
The dynamic configuration algorithm Optical Output Power stages enumerator.
Definition: argus_dca.h:169
argus_cfg_dca_t::DepthMax
uq10_6_t DepthMax
Definition: argus_dca.h:484
argus_cfg_dca_t::AthHigh
uq12_4_t AthHigh
Definition: argus_dca.h:439
ARGUS_STATE_HAS_DATA
@ ARGUS_STATE_HAS_DATA
Definition: argus_dca.h:301
argus_cfg_dca_t::DepthNom
uq10_6_t DepthNom
Definition: argus_dca.h:456
argus_cfg_dca_t::SatPxThRst
uint8_t SatPxThRst
Definition: argus_dca.h:413
argus_cfg_dca_t::PowerSavingRatio
uq0_8_t PowerSavingRatio
Definition: argus_dca.h:527
argus_cfg_dca_t::SatPxThExp
uint8_t SatPxThExp
Definition: argus_dca.h:400
ARGUS_STATE_DCA_POWER_SHIFT
#define ARGUS_STATE_DCA_POWER_SHIFT
Definition: argus_dca.h:122
DCA_AMPLITUDE_MAX
@ DCA_AMPLITUDE_MAX
Definition: argus_dca.h:159
argus_dca_gain_t
argus_dca_gain_t
The dynamic configuration algorithm Pixel Input Gain stages enumerator.
Definition: argus_dca.h:185
argus_dca_enable_t
argus_dca_enable_t
The dynamic configuration algorithm enable flags.
Definition: argus_dca.h:134
DCA_ENABLE_OFF
@ DCA_ENABLE_OFF
Definition: argus_dca.h:143
ARGUS_STATE_DCA_POWER_HIGH
@ ARGUS_STATE_DCA_POWER_HIGH
Definition: argus_dca.h:316