AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
Loading...
Searching...
No Matches
argus_api.h
Go to the documentation of this file.
1/*************************************************************************/
38#ifndef ARGUS_API_H
39#define ARGUS_API_H
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44/*!***************************************************************************
45 * @defgroup argus_api AFBR-S50 API
46 * @ingroup argus
47 *
48 * @brief The main module of the API from the AFBR-S50 SDK.
49 *
50 * @details General API for the AFBR-S50 time-of-flight sensor device family.\n
51 * See the \ref getting_started Guide for a detailed description
52 * on how to use the module/API.
53 *
54 * @addtogroup argus_api
55 * @{
56 *****************************************************************************/
57
58#include "argus_def.h"
59#include "argus_res.h"
60#include "argus_pba.h"
61#include "argus_dfm.h"
62#include "argus_snm.h"
63#include "argus_xtalk.h"
64#include "argus_offset.h"
65
67typedef int32_t s2pi_slave_t;
68
69/*!***************************************************************************
70 * @brief Initializes the device with default measurement mode.
71 *
72 * @details The function that needs to be called once after power up to
73 * initialize the modules state (i.e. the corresponding handle) and the
74 * dedicated Time-of-Flight device. In order to obtain a handle,
75 * reference the #Argus_CreateHandle method.
76 *
77 * Prior to calling the function, the required peripherals (i.e. S2PI,
78 * GPIO w/ IRQ and Timers) must be initialized and ready to use.
79 *
80 * The function executes the following tasks:
81 * - Initialization of the internal state represented by the handle
82 * object.
83 * - Setup the device such that an safe configuration is present in
84 * the registers.
85 * - Initialize sub modules such as calibration or measurement modules.
86 * .
87 *
88 * The modules configuration is initialized with reasonable default
89 * values. Note that the default measurement mode depends on the
90 * given device.
91 *
92 * Also refer to #Argus_InitMode, which uses an specified measurement
93 * mode instead of the dedicated default measurement mode.
94 *
95 * @param hnd The API handle; contains all internal states and data.
96 *
97 * @param spi_slave The SPI hardware slave, i.e. the specified CS and IRQ
98 * lines. This is actually just a number that is passed
99 * to the SPI interface to distinct for multiple SPI slave
100 * devices. Note that the slave must be not equal to 0,
101 * since is reserved for error handling.
102 *
103 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
104 *****************************************************************************/
106
107/*!***************************************************************************
108 * @brief Initializes the device with specified measurement mode.
109 *
110 * @details The function that needs to be called once after power up to
111 * initialize the modules state (i.e. the corresponding handle) and the
112 * dedicated Time-of-Flight device. In order to obtain a handle,
113 * reference the #Argus_CreateHandle method.
114 *
115 * Prior to calling the function, the required peripherals (i.e. S2PI,
116 * GPIO w/ IRQ and Timers) must be initialized and ready to use.
117 *
118 * The function executes the following tasks:
119 * - Initialization of the internal state represented by the handle
120 * object.
121 * - Setup the device such that an safe configuration is present in
122 * the registers.
123 * - Initialize sub modules such as calibration or measurement modules.
124 * .
125 *
126 * The modules configuration is initialized with reasonable default values.
127 *
128 * Also refer to #Argus_Init, which uses the dedicated default measurement
129 * mode instead of an user specified measurement mode.
130 *
131 * @param hnd The API handle; contains all internal states and data.
132 *
133 * @param spi_slave The SPI hardware slave, i.e. the specified CS and IRQ
134 * lines. This is actually just a number that is passed
135 * to the SPI interface to distinct for multiple SPI slave
136 * devices. Note that the slave must be not equal to 0,
137 * since is reserved for error handling.
138 *
139 * @param mode The specified measurement mode to be initialized.
140 * Pass 0 as special value to select default measurement mode
141 * (see #Argus_Init).
142 *
143 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
144 *****************************************************************************/
146
147/*!***************************************************************************
148 * @brief Reinitializes the device with the current measurement mode.
149 *
150 * @details The function reinitializes the device with the currently active
151 * measurement mode.
152 *
153 * This can be used as a soft reset for the device and API.
154 * See #Argus_Init for more information on the initialization.
155 *
156 * Note that the #Argus_Init or #Argus_InitMode function must be called
157 * first! Otherwise, the function will return an error if it is called
158 * for an yet uninitialized device/handle.
159 *
160 * Also refer to #Argus_ReinitMode, which uses a specified measurement
161 * mode instead of the currently active measurement mode.
162 *
163 * @note If a full re-initialization is not desired, refer to the
164 * #Argus_RestoreDeviceState function that will only re-write the
165 * register map to the device to restore its state after an power
166 * cycle.
167 *
168 * @param hnd The API handle; contains all internal states and data.
169 *
170 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
171 *****************************************************************************/
173
174/*!***************************************************************************
175 * @brief Reinitializes the device with a specified measurement mode.
176 *
177 * @details The function reinitializes the device with a specified (/p mode)
178 * measurement mode.
179 *
180 * This can be used as a soft reset for the device and API.
181 * See #Argus_InitMode for more information on the initialization.
182 *
183 * Note that the #Argus_Init or #Argus_InitMode function must be called
184 * first! Otherwise, the function will return an error if it is called
185 * for an yet uninitialized device/handle.
186 *
187 * Also refer to #Argus_Reinit, which re-uses the currently active
188 * measurement mode instead of an user specified measurement mode.
189 *
190 * @note If a full re-initialization is not desired, refer to the
191 * #Argus_RestoreDeviceState function that will only re-write the
192 * register map to the device to restore its state after an power
193 * cycle.
194 *
195 * @param hnd The API handle; contains all internal states and data.
196 *
197 * @param mode The specified measurement mode to be initialized.
198 * Pass 0 as special value to select the current measurement mode
199 * (see #Argus_Init).
200 *
201 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
202 *****************************************************************************/
204
205/*!***************************************************************************
206 * @brief Deinitializes the API modules and the device.
207 *
208 * @details The function deinitializes the device and clear all internal states.
209 * Can be used to cleanup before releasing the memory. The device
210 * can not be used any more and must be initialized again prior to next
211 * usage.
212 *
213 * Note that the #Argus_Init function must be called first! Otherwise,
214 * the function will return an error if it is called for an yet
215 * uninitialized device/handle.
216 *
217 * @param hnd The API handle; contains all internal states and data.
218 *
219 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
220 *****************************************************************************/
222
223/*!***************************************************************************
224 * @brief Creates a new device data handle object to store all internal states.
225 *
226 * @details The function must be called to obtain a new device handle object.
227 * The handle is basically an abstract object in memory that contains
228 * all the internal states and settings of the API module. The handle
229 * is passed to all the API methods in order to address the specified
230 * device. This allows to use the API with more than a single measurement
231 * device.
232 *
233 * The handler is created by calling the memory allocation method from
234 * the standard library: @code void * malloc(size_t size) @endcode
235 * In order to implement an individual memory allocation method,
236 * define and implement the following weakly binded method and return
237 * a pointer to the newly allocated memory. *
238 *
239 * @code void * Argus_Malloc (size_t size) @endcode
240 *
241 * Also see the #Argus_DestroyHandle method for the corresponding
242 * deallocation of the allocated memory.
243 *
244 * @note Although the method is using memory allocated on the heap, it
245 * is eventually no dynamic memory allocation, since the block of
246 * memory is kept all the time and no memory blocks are dynamically
247 * freed and re-allocated. If the usage of heap must be avoided, one
248 * can always implement its own version of the `Argus_Malloc` function
249 * to create the memory elsewhere.
250 *
251 * @return Returns a pointer to the newly allocated device handler object.
252 * Returns a null pointer if the allocation failed!
253 *****************************************************************************/
255
256/*!***************************************************************************
257 * @brief Destroys a given device data handle object.
258 *
259 * @details The function can be called to free the previously created device
260 * data handle object in order to save memory when the device is not
261 * used any more.
262 *
263 * Note that the handle must be deinitialized before it can be
264 * destroyed. The function returns #ERROR_FAIL if the handle is not
265 * yet deinitialized.
266 *
267 * Please refer to the #Argus_CreateHandle method for the corresponding
268 * allocation of the memory.
269 *
270 * The handler is destroyed by freeing the corresponding memory with the
271 * method from the standard library, @code void free(void * ptr) @endcode.
272 * In order to implement an individual memory deallocation method, define
273 * and implement the following weakly binded method and free the memory
274 * object passed to the method by a pointer.
275 *
276 * @code void Argus_Free (void * ptr) @endcode
277 *
278 * Also see the #Argus_CreateHandle method for the corresponding
279 * allocation of the required memory.
280 *
281 * @param hnd The device handle object to be deallocated.
282 *
283 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
284 *****************************************************************************/
286
287/*!***************************************************************************
288 * @brief Restores the device state with a re-write of all register values.
289 *
290 * @details The function invalidates and restores the device state by executing
291 * a re-write of the full register map.
292 *
293 * The purpose of this function is to recover from known external
294 * events like power cycles, for example due to sleep / wake-up
295 * functionality. This can be implemented by cutting off the external
296 * power supply of the device (e.g. via a MOSFET switch controlled by
297 * a GPIB pin). By calling this function, the expected state of the
298 * API is written to the device without the need to fully re-initialize
299 * the device. Thus, the API can resume where it has stopped as if
300 * there has never been a power cycle.
301 *
302 * The internal state machines like the dynamic configuration adaption
303 * (DCA) algorithm will not be reseted. The API/sensor will immediately
304 * resume at the last state that was optimized for the given
305 * environmental conditions.
306 *
307 * The use case of sleep / wake-up can be implemented as follows:
308 *
309 * 1. In case of ongoing measurements, stop the measurements via
310 * the #Argus_StopMeasurementTimer function (if started by the
311 * #Argus_StartMeasurementTimer function).
312 *
313 * 2. Shut down the device by removing the 5V power supply, e.g.
314 * via a GPIO pin that switches a MOSFET circuit.
315 *
316 * 3. After the desired sleep period, power the device by switching
317 * the 5V power supply on again. Wait until the power-on-reset
318 * (POR) is finished (approx. 1 ms) or just repeat step 4 until
319 * it succeeds.
320 *
321 * 4. Call the #Argus_RestoreDeviceState function to trigger the
322 * restoration of the device state in the API. Note that the
323 * function will return an error code if it fails. One can repeat
324 * the execution of that function a few times until it succeeds.
325 *
326 * 6. Continue with measurements via #Argus_StartMeasurementTimer
327 * of #Argus_TriggerMeasurement functions as desired.
328 *
329 * @note If a complete re-initialization (= soft-reset) is desired, see
330 * the #Argus_Reinit functionality.
331 *
332 * @note Changing a configuration or calibration parameter will always
333 * invalidate the device state as well as the state machine of the
334 * dynamic configuration adaption (DCA) algorithm. In that case, the
335 * device/API needs a few measurements to adopt to the present
336 * environmental conditions before the first valid measurement result
337 * can be obtained. This is almost similar to re-initializing the
338 * device (see #Argus_Reinit) which would also re-read the EEPROM.
339 * On the other hand, the #Argus_RestoreDeviceState does not reset
340 * or re-initialize anything. It just makes sure that the device
341 * register map (which has changed to its reset values after the
342 * power cycle) is what the API expects upon the next measurement.
343 *
344 * @param hnd The device handle object to be invalidated.
345 *
346 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
347 *****************************************************************************/
349
350/*!**************************************************************************
351 * Generic API
352 ****************************************************************************/
353
354/*!***************************************************************************
355 * @brief Gets the version number of the current API library.
356 *
357 * @details The version is compiled of a major (a), minor (b) and bugfix (c)
358 * number: a.b.c.
359 *
360 * The values are encoded into a 32-bit value:
361 *
362 * - [ 31 .. 24 ] - Major Version Number
363 * - [ 23 .. 16 ] - Minor Version Number
364 * - [ 15 .. 0 ] - Bugfix Version Number
365 * .
366 *
367 * To obtain the parts from the returned uin32_t value:
368 *
369 * @code
370 * uint32_t value = Argus_GetAPIVersion();
371 * uint8_t a = (value >> 24) & 0xFFU;
372 * uint8_t b = (value >> 16) & 0xFFU;
373 * uint8_t c = value & 0xFFFFU;
374 * @endcode
375 *
376 * @return Returns the current version number.
377 *****************************************************************************/
378uint32_t Argus_GetAPIVersion(void);
379
380/*!***************************************************************************
381 * @brief Gets the build number of the current API library.
382 *
383 * @return Returns the current build number as a C-string.
384 *****************************************************************************/
385char const * Argus_GetBuildNumber(void);
386
387/*!***************************************************************************
388 * @brief Gets the version/variant of the module.
389 *
390 * @param hnd The API handle; contains all internal states and data.
391 * @return Returns the current module number.
392 *****************************************************************************/
394
395/*!***************************************************************************
396 * @brief Gets the name string of the module.
397 *
398 * @param hnd The API handle; contains all internal states and data.
399 * @return Returns the current module name.
400 *****************************************************************************/
402
403/*!***************************************************************************
404 * @brief Gets the version number of the chip.
405 *
406 * @param hnd The API handle; contains all internal states and data.
407 * @return Returns the current version number.
408 *****************************************************************************/
410
411/*!***************************************************************************
412 * @brief Gets the type number of the device laser.
413 *
414 * @param hnd The API handle; contains all internal states and data.
415 * @return Returns the current device laser type number.
416 *****************************************************************************/
418
419/*!***************************************************************************
420 * @brief Gets the unique identification number of the chip.
421 *
422 * @param hnd The API handle; contains all internal states and data.
423 * @return Returns the unique identification number.
424 *****************************************************************************/
426
427/*!***************************************************************************
428 * @brief Gets the SPI hardware slave identifier.
429 *
430 * @param hnd The API handle; contains all internal states and data.
431 * @return The SPI hardware slave identifier.
432 *****************************************************************************/
434
437/*!**************************************************************************
438 * Measurement/Device Operation
439 ****************************************************************************
440 * @addtogroup argus_meas
441 * @{
442 ****************************************************************************/
443
444/*!***************************************************************************
445 * @brief Starts the timer based measurement cycle asynchronously.
446 *
447 * @details This function starts a timer based measurement cycle asynchronously
448 * in the background. A periodic timer interrupt triggers the measurement
449 * frames on the ASIC and the data readout afterwards.
450 *
451 * When the measurement has finished, a callback (which is passed as
452 * a parameter to the function) is invoked in order to inform the
453 * main thread to call the \link #Argus_EvaluateData data evaluation
454 * method\endlink. This call is mandatory to release the data buffer
455 * for the next measurement and it must not be invoked directly from
456 * the callback since it is currently within an interrupt service
457 * routine. Rather a flag should inform the main thread or task
458 * scheduler to invoke the evaluation as soon as possible in order
459 * to not introduce any unwanted delays to the next measurement frame.
460 *
461 * The next measurement frame will be started as soon as the pre-
462 * conditions are meet. These are:
463 * 1. timer flag set (i.e. a certain time has passed since the last
464 * measurement in order to fulfill eye-safety),
465 * 2. device idle (i.e. no measurement currently ongoing) and
466 * 3. data buffer ready (i.e. the previous data has been evaluated).
467 *
468 * Usually, the device idle and data buffer ready conditions are met
469 * before the timer tick occurs and thus the timer dictates the frame
470 * rate.
471 *
472 * The callback function pointer will be invoked when the measurement
473 * frame has finished successfully or whenever an error, that cannot
474 * be handled internally, occurs.
475 *
476 * The periodic timer interrupts are used to check the measurement status
477 * for timeouts. An error is invoked when a measurement cycle have not
478 * finished within the specified time.
479 *
480 * Use #Argus_StopMeasurementTimer to stop the measurements.
481 *
482 * @note In order to use this function, the periodic interrupt timer module
483 * (see @ref argus_timer) must be implemented!
484 *
485 * @param hnd The API handle; contains all internal states and data.
486 *
487 * @param cb Callback function that will be invoked when the measurement
488 * is completed. Its parameters are the \link #status_t status
489 * \endlink of the finished measurement cycle and the pointer to
490 * the calling \link #argus_hnd_t API handle\endlink, i.e. the
491 * /p hnd value. The latter must be passed to the
492 * #Argus_EvaluateData function.
493 * If an error occurred, the status differs from #STATUS_OK.
494 *
495 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
496 *****************************************************************************/
499
500/*!***************************************************************************
501 * @brief Stops the timer based measurement cycle.
502 *
503 * @details This function stops the ongoing timer based measurement cycles
504 * that have been started using the #Argus_StartMeasurementTimer
505 * function.
506 *
507 * @param hnd The API handle; contains all internal states and data.
508 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
509 *****************************************************************************/
511
512/*!***************************************************************************
513 * @brief Triggers a single measurement frame asynchronously.
514 *
515 * @details This function immediately triggers a single measurement frame
516 * asynchronously if all the pre-conditions are met. Otherwise it
517 * returns with a corresponding status (e.g. #STATUS_BUSY or
518 * #STATUS_ARGUS_POWERLIMIT).
519 *
520 * When the measurement has finished, a callback (which is passed as
521 * a parameter to the function) is invoked in order to inform the
522 * main thread to call the \link #Argus_EvaluateData data evaluation
523 * method\endlink. This call is mandatory to release the data buffer
524 * for the next measurement and it must not be invoked directly from
525 * the callback since it is currently within an interrupt service
526 * routine. Rather a flag should inform the main thread or task
527 * scheduler to invoke the evaluation task.
528 *
529 * The pre-conditions for starting a measurement frame are:
530 * 1. timer flag set (i.e. a certain time has passed since the last
531 * measurement in order to fulfill eye-safety),
532 * 2. device idle (i.e. no measurement currently ongoing) and
533 * 3. data buffer ready (i.e. the previous data has been evaluated).
534 *
535 * The callback function pointer will be invoked when the measurement
536 * frame has finished successfully or whenever an error, that cannot
537 * be handled internally, occurs.
538 *
539 * The successful finishing of the measurement frame is not checked
540 * for timeouts! Instead, the user can call the #Argus_GetStatus()
541 * function on a regular function to do so.
542 *
543 * @note Despite this function triggers a new measurement cycle upon its
544 * invocation, the frame time parameter is still active for this
545 * measurement mode. Basically, the first pre-condition mentioned
546 * above is controlled via the frame time parameter. This means
547 * that measurements cannot be triggered faster than the frame
548 * timer parameters specifies. The maximum integration time (i.e.
549 * exposure time) is also determined by the frame time such that
550 * new measurements are finished with the specified frame time and
551 * the device is ready to trigger a new measurement after the
552 * frame time has elapse.
553 * See #Argus_SetConfigurationFrameTime function for more information
554 * on the frame time.
555 *
556 * @param hnd The API handle; contains all internal states and data.
557 *
558 * @param cb Callback function that will be invoked when the measurement
559 * is completed. Its parameters are the \link #status_t status
560 * \endlink of the finished measurement cycle and the pointer to
561 * the calling \link #argus_hnd_t API handle\endlink, i.e. the
562 * /p hnd value. The latter must be passed to the
563 * #Argus_EvaluateData function.
564 * If an error occurred, the status differs from #STATUS_OK.
565 *
566 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
567 *****************************************************************************/
570
571/*!***************************************************************************
572 * @brief Determines whether a data evaluation is pending.
573 *
574 * @details If the function returns true, a raw buffer is required to be
575 * evaluated to the #Argus_EvaluateData function. The raw data buffer
576 * is filled with raw data from the measurement tasks which need to
577 * be evaluated and the buffer must be freed in order to restart a
578 * new measurement task.
579 *
580 * Note that no configuration parameters can be update until all raw
581 * buffers are evaluated.
582 *
583 * @note See also the #Argus_GetStatus function to obtain the current device
584 * status and error code if any.
585 *
586 * @param hnd The API handle; contains all internal states and data.
587 * @return True if any raw buffer is filled with data that must be evaluated.
588 *****************************************************************************/
590
591/*!***************************************************************************
592 * @brief Determines if the device if active with timer based measurements.
593 * @details If the function returns true, the device is active with timer
594 * scheduled measurements that have been started via the
595 * #Argus_StartMeasurementTimer.
596 *
597 * Note that the active state is independent of the busy state that
598 * is set when the device is actually busy. The active state is also
599 * true if the device is currently idle but waits for the next timer
600 * event to trigger a new measurement cycle.
601 *
602 * @note See also the #Argus_GetStatus function to obtain the current device
603 * status and error code if any.
604 *
605 * @param hnd The API handle; contains all internal states and data.
606 * @return True if the device is operating in timer triggered measurement mode.
607 *****************************************************************************/
609
610/*!***************************************************************************
611 * @brief Stops the currently ongoing measurements and SPI activity immediately.
612 *
613 * @param hnd The API handle; contains all internal states and data.
614 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
615 *****************************************************************************/
617
618/*!***************************************************************************
619 * @brief Checks the state of the device/driver.
620 *
621 * @details Returns the current module status or error if any.
622 *
623 * See the following for a list of errors:
624 *
625 * Status:
626 * - Idle/OK: Device and SPI interface are idle (== #STATUS_IDLE).
627 * - Busy: Device or SPI interface are busy (== #STATUS_BUSY).
628 * - Initializing: The modules and devices are currently initializing
629 * (== #STATUS_INITIALIZING).
630 * .
631 *
632 * Error:
633 * - Not Initialized: The modules (or any submodule) has not been
634 * initialized yet (== #ERROR_NOT_INITIALIZED).
635 * - Not Connected: No device has been connected (or connection errors
636 * have occurred) (== #ERROR_ARGUS_NOT_CONNECTED).
637 * - Timeout: A previous frame measurement has not finished within a
638 * specified time (== #ERROR_TIMEOUT).
639 * .
640 *
641 * @note Note that this function returns the actual busy state. This means
642 * that it will return #STATUS_IDLE during the pause between two
643 * consecutive measurement frames. If the device is active with timer
644 * based measurements (i.e. started via the #Argus_StartMeasurementTimer
645 * function), the return state switches from idle to busy and back
646 * periodically. Use the #Argus_IsTimerMeasurementActive function in
647 * order to determine if the device is active with timer based
648 * measurements.
649 *
650 * @note Note also that the device might reject configuration parameter
651 * update despite the status is #STATUS_IDLE. This is due to the fact
652 * that the internal raw data buffers are still busy and require to
653 * be freed by passing them to the #Argus_EvaluateData function. Use
654 * the #Argus_IsDataEvaluationPending function to see whether any of
655 * the raw data buffers is busy or the configuration can be changed.
656 *
657 * @param hnd The API handle; contains all internal states and data.
658 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
659 *****************************************************************************/
661
662/*!*****************************************************************************
663 * @brief Tests the connection to the device by sending a ping message.
664 *
665 * @details A ping is transferred to the device in order to check the device and
666 * SPI connection status. Returns #STATUS_OK on success and
667 * #ERROR_ARGUS_NOT_CONNECTED else-wise.
668 *
669 * @param hnd The API handle; contains all internal states and data.
670 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
671 ******************************************************************************/
673
674/*!***************************************************************************
675 * @brief Evaluates measurement data from the raw sensor readout data.
676 *
677 * @details This function must be called after each completion of a measurement
678 * cycle. The completion of a measurement cycle is communicated by the
679 * API via the invocation of the measurement data ready callback. The
680 * callback is installed in the API when new measurements are started
681 * either via the #Argus_TriggerMeasurement or via the
682 * #Argus_StartMeasurementTimer functions.
683 *
684 * This function evaluates measurement values like distances, amplitudes
685 * states and auxiliary values like temperature or voltage values from
686 * the raw sensor readout data obtained from the device during the
687 * measurement cycle. A pointer to a #argus_results_t data structure
688 * must be passed where all the evaluated values will be written to.
689 * The structure must persist during the whole execution of the
690 * #Argus_EvaluateData function.
691 *
692 * In addition to the evaluation of measurement data, the function
693 * feeds back the obtained information to the device in order to
694 * optimize its performance with respect to the ambient conditions,
695 * utilizing the so called Dynamic Configuration Adaption (DCA)
696 * feature.
697 *
698 * Furthermore, several calibration algorithm are applied to the data.
699 *
700 * If the function is called without any data ready to be evaluated
701 * from the measurement module, the error code #ERROR_ARGUS_BUFFER_EMPTY
702 * is returned and not data is written to the passed #argus_results_t
703 * data structure.
704 *
705 * @note The call to this function is mandatory for each finished measurement
706 * cycle, i.e. for each call to the measurement data ready callback.
707 * If the function is not called, the data is not evaluated and the
708 * internal raw data buffers are not freed. In that case, they can not
709 * be reused for the next measurement and the API can not start new
710 * measurements.
711 * There are up to two internal buffers available, the to callback
712 * is called twice before the API must wait for the data evaluation
713 * to finish.
714 *
715 * @param hnd The API handle; contains all internal states and data.
716 * @param res A pointer to the results structure that will be populated
717 * with evaluated data.
718 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
719 *****************************************************************************/
721
722/*!***************************************************************************
723 * @brief Evaluates measurement data from the raw sensor readout data.
724 *
725 * @details This function enhances the #Argus_EvaluateData by adding additional
726 * debug data into a specified debug data structure (\p dbg). If the
727 * \p dbg is null, the function is eqivalent to the #Argus_EvaluateData
728 * function. This, see #Argus_EvaluateData for reference.
729 *
730 * @param hnd The API handle; contains all internal states and data.
731 * @param res A pointer to the results structure that will be populated
732 * with evaluated data.
733 * @param dbg An optional pointer (can be null) to the debug data structure.
734 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
735 *****************************************************************************/
738
739/*!***************************************************************************
740 * @brief Executes a crosstalk calibration measurement.
741 *
742 * @details This function immediately triggers a crosstalk vector calibration
743 * measurement sequence. The ordinary measurement activity is suspended
744 * while the calibration is ongoing.
745 *
746 * In order to perform a crosstalk calibration, the reflection of the
747 * transmitted signal must be kept from the receiver side, by either
748 * covering the TX completely (or RX respectively) or by setting up
749 * an absorbing target at far distance.
750 *
751 * After calibration has finished successfully, the obtained data is
752 * applied immediately and can be read from the API using the
753 * #Argus_GetCalibrationCrosstalkVectorTable function.
754 *
755 * @param hnd The API handle; contains all internal states and data.
756 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
757 *****************************************************************************/
759
760/*!***************************************************************************
761 * @brief Executes a relative range offset calibration measurement.
762 *
763 * @details This function immediately triggers a relative range offset calibration
764 * measurement sequence. The ordinary measurement activity is suspended
765 * while the calibration is ongoing.
766 *
767 * In order to perform a relative range offset calibration, a flat
768 * calibration target must be setup perpendicular to the sensors
769 * field-of-view.
770 *
771 * \code
772 * AFBR-S50 ToF Sensor
773 * #|
774 * #| |
775 * #|-----+ |
776 * #| RX | |
777 * Reference #|----++ | Calibration
778 * Plane #| TX | | Target
779 * #|----+ |
780 * #| |
781 * #| <------- targetRange -----------------> |
782 * \endcode
783 *
784 * There are two options to run the offset calibration: relative and
785 * absolute.
786 *
787 * - Relative (#Argus_ExecuteRelativeRangeOffsetCalibrationSequence):
788 * when the absolute distance is not essential or the distance to
789 * the calibration target is not known, the relative method can be
790 * used to compensate the relative pixel range offset w.r.t. the
791 * average range. The absolute or global range offset is not changed.
792 * - Absolute (#Argus_ExecuteAbsoluteRangeOffsetCalibrationSequence):
793 * when the absolute distance is essential and the distance to the
794 * calibration target is known, the absolute method can be used to
795 * calibrate the absolute measured distance. Additionally, the
796 * relative pixel offset w.r.t. the average range is also compensated.
797 * .
798 *
799 * After calibration has finished successfully, the obtained data is
800 * applied immediately and can be read from the API using the
801 * #Argus_GetCalibrationPixelRangeOffsets or
802 * #Argus_GetCalibrationGlobalRangeOffsets function.
803 *
804 * @param hnd The API handle; contains all internal states and data.
805 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
806 *****************************************************************************/
808
809/*!***************************************************************************
810 * @brief Executes an absolute range offset calibration measurement.
811 *
812 * @details This function immediately triggers an absolute range offset calibration
813 * measurement sequence. The ordinary measurement activity is suspended
814 * while the calibration is ongoing.
815 *
816 * In order to perform a relative range offset calibration, a flat
817 * calibration target must be setup perpendicular to the sensors
818 * field-of-view.
819 *
820 * \code
821 * AFBR-S50 ToF Sensor
822 * #|
823 * #| |
824 * #|-----+ |
825 * #| RX | |
826 * Reference #|----++ | Calibration
827 * Plane #| TX | | Target
828 * #|----+ |
829 * #| |
830 * #| <------- targetRange -----------------> |
831 * \endcode
832 *
833 * There are two options to run the offset calibration: relative and
834 * absolute.
835 *
836 * - Relative (#Argus_ExecuteRelativeRangeOffsetCalibrationSequence):
837 * when the absolute distance is not essential or the distance to
838 * the calibration target is not known, the relative method can be
839 * used to compensate the relative pixel range offset w.r.t. the
840 * average range. The absolute or global range offset is not changed.
841 * - Absolute (#Argus_ExecuteAbsoluteRangeOffsetCalibrationSequence):
842 * when the absolute distance is essential and the distance to the
843 * calibration target is known, the absolute method can be used to
844 * calibrate the absolute measured distance. Additionally, the
845 * relative pixel offset w.r.t. the average range is also compensated.
846 * .
847 *
848 * After calibration has finished successfully, the obtained data is
849 * applied immediately and can be read from the API using the
850 * #Argus_GetCalibrationPixelRangeOffsets or
851 * #Argus_GetCalibrationGlobalRangeOffsets function.
852 *
853 * @param hnd The API handle; contains all internal states and data.
854 * @param targetRange The absolute range between the reference plane and the
855 * calibration target in meter an Q9.22 format.
856 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
857 *****************************************************************************/
859 q9_22_t targetRange);
860
863/*!**************************************************************************
864 * Configuration API
865 ****************************************************************************
866 * @addtogroup argus_cfg
867 * @{
868 ****************************************************************************/
869
870/*!***************************************************************************
871 * @brief Gets the default measurement mode for a specified module type.
872 *
873 * @param module The specified module type.
874 * @return Returns the default measurement mode for the specified module type.
875 *****************************************************************************/
877
878/*!***************************************************************************
879 * @brief Sets the measurement mode to a specified device.
880 *
881 * @details This generates a new default configuration and calibration for the
882 * specified measurement mode and applies it to the device.
883 *
884 * See #argus_mode_t for a list of all available measurement modes.
885 *
886 * @warning The function overwrites all made changes to the configuration or
887 * calibration parameters with the default values. So this function
888 * must be called before any other changes to the configuration or
889 * calibration parameters are made!
890 *
891 * @param hnd The API handle; contains all internal states and data.
892 * @param mode The new measurement mode.
893 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
894 *****************************************************************************/
896
897/*!***************************************************************************
898 * @brief Resets the measurement mode to a specified device.
899 *
900 * @details This generates a new default configuration and calibration for the
901 * current measurement mode and applies it to the device.
902 *
903 * @warning The function overwrites all made changes to the configuration or
904 * calibration parameters with the default values. So this function
905 * must be called before any other changes to the configuration or
906 * calibration parameters are made!
907 *
908 * @param hnd The API handle; contains all internal states and data.
909 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
910 *****************************************************************************/
912
913/*!***************************************************************************
914 * @brief Gets the measurement mode from a specified device.
915 *
916 * @param hnd The API handle; contains all internal states and data.
917 * @param mode The current measurement mode.
918 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
919 *****************************************************************************/
921
922/*!***************************************************************************
923 * @brief Sets the frame time to a specified device.
924 *
925 * @details The frame time determines the measurement rate of the device.
926 * Usually, this controller the periodicity of measurements to be
927 * triggered via the timer based measurement mode that can be started
928 * via the #Argus_StartMeasurementTimer function. But also the
929 * behavior of the #Argus_TriggerMeasurement function is influenced
930 * by the frame rate parameter.
931 *
932 * The frame time parameter handles the maximum frame rate by limiting
933 * the trigger of a new measurement frame to the specified value.
934 * On the other hand, the accuracy of measurement results it also
935 * influenced since the frame time specifies the maximum integration
936 * depth (i.e. exposure time) along with the laser safety limitations.
937 * This means, the measurement speed can be increased by decreasing
938 * the frame time parameter and the accuracy can be improved by
939 * increasing the frame time parameter.
940 *
941 * Note the additional factor will limit the maximum frame rate on the
942 * one hand and the accuracy on the other hand:
943 * - High CPU load (or slow CPU in general) will lead to delays due
944 * to long data evaluation task (#Argus_EvaluateData) or long user
945 * application code. Reduce CPU load or increase CPU power to
946 * increase maximum frame rate.
947 * - The dual frequency mode (DFM, see #Argus_SetConfigurationDFMMode)
948 * will additionally limit the maximum frame rate to approximately
949 * 100 frames per second. Disable the DFM to increase maximum frame
950 * rates.
951 * - The smart power save (SPS, see
952 * #Argus_SetConfigurationSmartPowerSaveEnabled) mode will decrease
953 * the maximum possible frame rate slightly. Disable it to increase
954 * the maximum frame rate.
955 * - The dynamic configuration adaption with its specific power saving
956 * ratio parameter (see #Argus_SetConfigurationDynamicAdaption)
957 * will limit the maximum integration depth along with the laser
958 * safety limitations. Increase the power saving ratio to increase
959 * accuracy. Note that laser safety limitations might already limit
960 * the maximum integration depth such that the power saving ratio
961 * is ineffective.
962 * .
963 *
964 * @param hnd The API handle; contains all internal states and data.
965 * @param value The measurement frame time in microseconds.
966 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
967 *****************************************************************************/
969
970/*!***************************************************************************
971 * @brief Gets the frame time from a specified device.
972 *
973 * @param hnd The API handle; contains all internal states and data.
974 * @param value The current frame time in microseconds.
975 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
976 *****************************************************************************/
978
979/*!***************************************************************************
980 * @brief Sets the smart power save enabled flag to a specified device.
981 *
982 * @param hnd The API handle; contains all internal states and data.
983 * @param value The new smart power save enabled flag.
984 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
985 *****************************************************************************/
987 bool value);
988
989/*!***************************************************************************
990 * @brief Gets the smart power save enabled flag from a specified device.
991 *
992 * @param hnd The API handle; contains all internal states and data.
993 * @param value The current smart power save enabled flag.
994 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
995 *****************************************************************************/
997 bool * value);
998
999/*!***************************************************************************
1000 * @brief Sets the Dual Frequency Mode (DFM) to a specified device.
1001 *
1002 * @param hnd The API handle; contains all internal states and data.
1003 * @param value The new DFM mode value.
1004 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1005 *****************************************************************************/
1007 argus_dfm_mode_t value);
1008
1009
1010/*!***************************************************************************
1011 * @brief Gets the Dual Frequency Mode (DFM) from a specified device.
1012 *
1013 * @param hnd The API handle; contains all internal states and data.
1014 * @param value The current DFM mode value.
1015 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1016 *****************************************************************************/
1018 argus_dfm_mode_t * value);
1019
1020/*!***************************************************************************
1021 * @brief Sets the Shot Noise Monitor (SNM) mode to a specified device.
1022 *
1023 * @param hnd The API handle; contains all internal states and data.
1024 * @param value The new SNM mode value.
1025 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1026 *****************************************************************************/
1028 argus_snm_mode_t value);
1029
1030/*!***************************************************************************
1031 * @brief Gets the Shot Noise Monitor (SNM) mode from a specified device.
1032 *
1033 * @param hnd The API handle; contains all internal states and data.
1034 * @param value The current SNM mode value.
1035 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1036 *****************************************************************************/
1038 argus_snm_mode_t * value);
1039
1040/*!***************************************************************************
1041* @brief Sets the Crosstalk Monitor (XTM) mode to a specified device.
1042*
1043* @param hnd The API handle; contains all internal states and data.
1044* @param value The new XTM mode value (true: enabled; false: disabled).
1045* @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1046*****************************************************************************/
1048 bool value);
1049
1050/*!***************************************************************************
1051* @brief Gets the Crosstalk Monitor (XTM) mode from a specified device.
1052*
1053* @param hnd The API handle; contains all internal states and data.
1054* @param value The current XTM mode value (true: enabled; false: disabled).
1055* @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1056*****************************************************************************/
1058 bool * value);
1059
1060/*!***************************************************************************
1061 * @brief Sets the full DCA module configuration to a specified device.
1062 *
1063 * @param hnd The API handle; contains all internal states and data.
1064 * @param value The new DCA configuration set.
1065 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1066 *****************************************************************************/
1068 argus_cfg_dca_t const * value);
1069
1070/*!***************************************************************************
1071 * @brief Gets the # from a specified device.
1072 *
1073 * @param hnd The API handle; contains all internal states and data.
1074 * @param value The current DCA configuration set value.
1075 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1076 *****************************************************************************/
1078 argus_cfg_dca_t * value);
1079/*!***************************************************************************
1080 * @brief Sets the pixel binning configuration parameters to a specified device.
1081 *
1082 * @param hnd The API handle; contains all internal states and data.
1083 * @param value The new pixel binning configuration parameters.
1084 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1085 *****************************************************************************/
1087 argus_cfg_pba_t const * value);
1088
1089/*!***************************************************************************
1090 * @brief Gets the pixel binning configuration parameters from a specified device.
1091 *
1092 * @param hnd The API handle; contains all internal states and data.
1093 * @param value The current pixel binning configuration parameters.
1094 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1095 *****************************************************************************/
1097 argus_cfg_pba_t * value);
1098
1099/*!***************************************************************************
1100 * @brief Gets the current unambiguous range in mm.
1101 *
1102 * @param hnd The API handle; contains all internal states and data.
1103 * @param range_mm The returned range in mm.
1104 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1105 *****************************************************************************/
1107 uint32_t * range_mm);
1108
1111/*!**************************************************************************
1112 * Calibration API
1113 ****************************************************************************
1114 * @addtogroup argus_cal
1115 * @{
1116 ****************************************************************************/
1117
1118/*!***************************************************************************
1119 * @brief Sets the global range offset values to a specified device.
1120 *
1121 * @details The global range offsets are subtracted from the raw range values.
1122 * There are two distinct values that are applied in low or high
1123 * power stage setting respectively.
1124 *
1125 * @param hnd The API handle; contains all internal states and data.
1126 * @param offset_low The new global range offset for the low power stage in
1127 * meter and Q0.15 format.
1128 * @param offset_high The new global range offset for the high power stage in
1129 * meter and Q0.15 format.
1130 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1131 *****************************************************************************/
1133 q0_15_t offset_low,
1134 q0_15_t offset_high);
1135
1136/*!***************************************************************************
1137 * @brief Gets the global range offset values from a specified device.
1138 *
1139 * @details The global range offsets are subtracted from the raw range values.
1140 * There are two distinct values that are applied in low or high
1141 * power stage setting respectively.
1142 *
1143 * @param hnd The API handle; contains all internal states and data.
1144 * @param offset_low The current range offset for the low power stage in
1145 * meter and Q0.15 format.
1146 * @param offset_high The current global range offset for the high power stage
1147 * in meter and Q0.15 format.
1148 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1149 *****************************************************************************/
1151 q0_15_t * offset_low,
1152 q0_15_t * offset_high);
1153
1154/*!***************************************************************************
1155 * @brief Sets the relative pixel offset table to a specified device.
1156 *
1157 * @details The relative pixel offset values are subtracted from the raw range
1158 * values for each individual pixel. Note that a global range offset
1159 * is applied additionally. The relative pixel offset values are meant
1160 * to be with respect to the average range of all pixels, i.e. the
1161 * average of all relative offsets should be 0!
1162 *
1163 * The crosstalk vector table is a two dimensional array of type
1164 * #q0_15_t, wrapped within the #argus_cal_offset_table_t structure.
1165 *
1166 * The dimensions are:
1167 * - size(0) = #ARGUS_PIXELS_X (Pixel count in x-direction)
1168 * - size(1) = #ARGUS_PIXELS_Y (Pixel count in y-direction)
1169 * .
1170 *
1171 * Its recommended to use the built-in pixel offset calibration
1172 * sequence (see #Argus_ExecuteRelativeRangeOffsetCalibrationSequence)
1173 * to determine the offset table for the current device.
1174 *
1175 * If a constant offset table for all device needs to be incorporated
1176 * into the sources, the #Argus_GetPixelRangeOffsets_Callback
1177 * should be used.
1178 *
1179 * @param hnd The API handle; contains all internal states and data.
1180 * @param value The new relative range offset in meter and Q0.15 format.
1181 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1182 *****************************************************************************/
1184 argus_cal_offset_table_t const * value);
1185
1186
1187/*!***************************************************************************
1188 * @brief Gets the relative pixel offset table from a specified device.
1189 *
1190 * @details The relative pixel offset values are subtracted from the raw range
1191 * values for each individual pixel. Note that a global range offset
1192 * is applied additionally. The relative pixel offset values are meant
1193 * to be with respect to the average range of all pixels, i.e. the
1194 * average of all relative offsets should be 0!
1195 *
1196 * The crosstalk vector table is a two dimensional array of type
1197 * #q0_15_t, wrapped within the #argus_cal_offset_table_t structure.
1198 *
1199 * The dimensions are:
1200 * - size(0) = #ARGUS_PIXELS_X (Pixel count in x-direction)
1201 * - size(1) = #ARGUS_PIXELS_Y (Pixel count in y-direction)
1202 * .
1203 *
1204 * @param hnd The API handle; contains all internal states and data.
1205 * @param value The current relative range offset in meter and Q0.15 format.
1206 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1207 *****************************************************************************/
1209 argus_cal_offset_table_t * value);
1210
1211
1212/*!***************************************************************************
1213 * @brief Resets the relative pixel offset values for the specified device to
1214 * the factory calibrated default values.
1215 *
1216 * @details The relative pixel offset values are subtracted from the raw range
1217 * values for each individual pixel. Note that a global range offset
1218 * is applied additionally.
1219 *
1220 * The factory defaults are device specific values.
1221 *
1222 * @param hnd The API handle; contains all internal states and data.
1223 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1224 *****************************************************************************/
1226
1227/*!***************************************************************************
1228 * @brief A callback that returns the external pixel range offsets.
1229 *
1230 * @details The function needs to be implemented by the host application in
1231 * order to set the external pixel range offsets values upon system
1232 * initialization. If not defined in user code, the default
1233 * implementation will return an all zero offset table, assuming there
1234 * is no (additional) external pixel range offset values.
1235 *
1236 * If defined in user code, the function must fill all offset values
1237 * in the provided \par offsets parameter with external range offset
1238 * values.
1239 * The values can be obtained by the calibration routine.
1240 *
1241 * Example usage:
1242 *
1243 * @code
1244 * status_t Argus_GetPixelRangeOffsets_Callback(argus_cal_offset_table_t offsets)
1245 * {
1246 * memset(offsets, 0, sizeof(argus_cal_offset_t));
1247 *
1248 * // Set offset values in meter and Q0.15 format.
1249 * offsets.Table[0][0] = -3542;
1250 * offsets.Table[0][1] = -4385;
1251 * offsets.Table[0][2] = 2953;
1252 * // etc.
1253 * }
1254 * @endcode
1255 *
1256 * @param offsets The pixel range offsets in meter and Q0.15 format; to be
1257 * filled with data.
1258 * @param mode The current measurement mode.
1259 *****************************************************************************/
1261 argus_mode_t const mode);
1262
1263/*!***************************************************************************
1264 * @brief Sets the sample time for the range offset calibration sequence.
1265 *
1266 * @details Gets the measurement sample acquisition time for executing the
1267 * range offset calibration sequence and generate the offset data.\n
1268 * Units: msec.
1269 *
1270 * @param hnd The API handle; contains all internal states and data.
1271 * @param value The new range offset calibration sequence sample time.
1272 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1273 *****************************************************************************/
1275
1276/*!***************************************************************************
1277 * @brief Gets the sample time for the range offset calibration sequence.
1278 *
1279 * @details Gets the measurement sample acquisition time for executing the
1280 * range offset calibration sequence and generate the offset data.\n
1281 * Units: msec.
1282 *
1283 * @param hnd The API handle; contains all internal states and data.
1284 * @param value The current range offset calibration sequence sample time.
1285 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1286 *****************************************************************************/
1288
1289/*!***************************************************************************
1290 * @brief Sets the pixel-to-pixel crosstalk compensation parameters to a specified device.
1291 *
1292 * @param hnd The API handle; contains all internal states and data.
1293 * @param value The new pixel-to-pixel crosstalk compensation parameters.
1294 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1295 *****************************************************************************/
1297 argus_cal_p2pxtalk_t const * value);
1298
1299/*!***************************************************************************
1300 * @brief Gets the pixel-to-pixel crosstalk compensation parameters from a specified device.
1301 *
1302 * @param hnd The API handle; contains all internal states and data.
1303 * @param value The current pixel-to-pixel crosstalk compensation parameters.
1304 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1305 *****************************************************************************/
1307 argus_cal_p2pxtalk_t * value);
1308
1309
1310/*!***************************************************************************
1311 * @brief Sets the custom crosstalk vector table to a specified device.
1312 *
1313 * @details The crosstalk vectors are subtracted from the raw sampling data
1314 * in the data evaluation phase.
1315 *
1316 * The crosstalk vector table is a three dimensional array of type
1317 * #xtalk_t. The #argus_cal_xtalk_table_t is the corresponding
1318 * typedef for the required data.
1319 *
1320 * The dimensions are:
1321 * - size(0) = #ARGUS_DFM_FRAME_COUNT (Dual-frequency mode A- or B-frame)
1322 * - size(1) = #ARGUS_PIXELS_X (Pixel count in x-direction)
1323 * - size(2) = #ARGUS_PIXELS_Y (Pixel count in y-direction)
1324 * .
1325 *
1326 * Its recommended to use the built-in crosstalk calibration sequence
1327 * (see #Argus_ExecuteXtalkCalibrationSequence) to determine the
1328 * crosstalk vector table.
1329 *
1330 * If a constant table for all device needs to be incorporated into
1331 * the sources, the #Argus_GetCrosstalkVectorTable_Callback
1332 * should be used.
1333 *
1334 * @param hnd The API handle; contains all internal states and data.
1335 * @param value The new crosstalk vector table.
1336 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1337 *****************************************************************************/
1339 argus_cal_xtalk_table_t const * value);
1340
1341/*!***************************************************************************
1342 * @brief Gets the custom crosstalk vector table from a specified device.
1343 *
1344 * @details The crosstalk vectors are subtracted from the raw sampling data
1345 * in the data evaluation phase.
1346 *
1347 * The crosstalk vector table is a three dimensional array of type
1348 * #xtalk_t. The #argus_cal_xtalk_table_t is the corresponding
1349 * typedef for the required data.
1350 *
1351 * The dimensions are:
1352 * - size(0) = #ARGUS_DFM_FRAME_COUNT (Dual-frequency mode A- or B-frame)
1353 * - size(1) = #ARGUS_PIXELS_X (Pixel count in x-direction)
1354 * - size(2) = #ARGUS_PIXELS_Y (Pixel count in y-direction)
1355 * .
1356 *
1357 * @param hnd The API handle; contains all internal states and data.
1358 * @param value The current crosstalk vector table.
1359 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1360 *****************************************************************************/
1362 argus_cal_xtalk_table_t * value);
1363
1364/*!***************************************************************************
1365 * @brief Resets the crosstalk vector table for the specified device to the
1366 * factory calibrated default values.
1367 *
1368 * @details The crosstalk vectors are subtracted from the raw sampling data
1369 * in the data evaluation phase.
1370 * *
1371 * The factory defaults are device specific calibrated values.
1372 *
1373 * @param hnd The API handle; contains all internal states and data.
1374 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1375 *****************************************************************************/
1377
1378/*!***************************************************************************
1379 * @brief Sets the sample time for the crosstalk calibration sequence.
1380 *
1381 * @details Sets the measurement sample acquisition time for executing the
1382 * crosstalk calibration sequence and generate the crosstalk data.\n
1383 * Units: msec.
1384 *
1385 * @param hnd The API handle; contains all internal states and data.
1386 * @param value The new crosstalk calibration sequence sample time.
1387 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1388 *****************************************************************************/
1390 uint16_t value);
1391
1392/*!***************************************************************************
1393 * @brief Gets the sample time for the crosstalk calibration sequence.
1394 *
1395 * @details Gets the measurement sample acquisition time for executing the
1396 * crosstalk calibration sequence and generate the crosstalk data.\n
1397 * Units: msec.
1398 *
1399 * @param hnd The API handle; contains all internal states and data.
1400 * @param value The current crosstalk calibration sequence sample time.
1401 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1402 *****************************************************************************/
1404 uint16_t * value);
1405
1406/*!***************************************************************************
1407 * @brief Sets the max. amplitude threshold for the crosstalk calibration sequence.
1408 *
1409 * @details The maximum amplitude threshold defines a maximum crosstalk vector
1410 * amplitude before causing an error message. If the crosstalk is
1411 * too high, there is usually an issue with the measurement setup, i.e.
1412 * there is still a measurement signal detected.
1413 *
1414 * @param hnd The API handle; contains all internal states and data.
1415 * @param value The new crosstalk calibration sequence maximum amplitude
1416 * threshold value in UQ12.4 format.
1417 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1418 *****************************************************************************/
1420 uq12_4_t value);
1421
1422/*!***************************************************************************
1423 * @brief Gets the max. amplitude threshold for the crosstalk calibration sequence.
1424 *
1425 * @details The maximum amplitude threshold defines a maximum crosstalk vector
1426 * amplitude before causing an error message. If the crosstalk is
1427 * too high, there is usually an issue with the measurement setup, i.e.
1428 * there is still a measurement signal detected.
1429 *
1430 * @param hnd The API handle; contains all internal states and data.
1431 * @param value The current max. amplitude threshold value in UQ12.4 format.
1432 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1433 *****************************************************************************/
1435 uq12_4_t * value);
1436
1437
1438/*!***************************************************************************
1439 * @brief Clears all user calibration values from NVM for the specified device.
1440 *
1441 * @details The user calibration values are stored in the non-volatile memory
1442 * (NVM) if corresponding \link #argus_nvm NVM hardware layer\endlink
1443 * is implemented. This method clears the user calibration data from
1444 * the non-volatile memory.
1445 *
1446 * @warning This does not reset the currently set calibration values to
1447 * factory defaults!
1448 *
1449 * @param hnd The API handle; contains all internal states and data.
1450 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1451 *****************************************************************************/
1453
1454
1455/*!***************************************************************************
1456 * @brief A callback that returns the external crosstalk vector table.
1457 *
1458 * @details The function needs to be implemented by the host application in
1459 * order to set the external crosstalk vector table upon system
1460 * initialization. If not defined in user code, the default
1461 * implementation will return an all zero vector table, assuming there
1462 * is no (additional) external crosstalk.
1463 *
1464 * If defined in user code, the function must fill all vector values
1465 * in the provided \par crosstalk parameter with external crosstalk
1466 * values. The values can be obtained by the calibration routine.
1467 *
1468 * Example usage:
1469 *
1470 * @code
1471 * status_t Argus_GetCrosstalkVectorTable_Callback(
1472 * argus_cal_xtalk_table_t * xtalk)
1473 * {
1474 * memset(xtalk, 0, sizeof(argus_cal_xtalk_table_t));
1475 *
1476 * // Set crosstalk vectors in Q11.4 format.
1477 * // Note on dual-frequency frame index: 0 = A-Frame; 1 = B-Frame
1478 * xtalk.FrameA[0][0].dS = -9; xtalk.FrameB[0][0].dC = -11;
1479 * xtalk.FrameA[0][1].dS = -13; xtalk.FrameB[0][1].dC = -16;
1480 * xtalk.FrameA[0][2].dS = 6; xtalk.FrameB[0][2].dC = -18;
1481 * // etc.
1482 * }
1483 * @endcode
1484 *
1485 * @param xtalk The crosstalk vector array; to be filled with data.
1486 * @param mode The current measurement mode.
1487 *****************************************************************************/
1489 argus_mode_t const mode);
1490
1491
1492/*!***************************************************************************
1493 * @brief Gets the currently calibrated Golden Pixel coordinates.
1494 *
1495 * @details The Golden Pixel is the pixel that is located at the center of the
1496 * receiving light beam. Thus it it the one that receives the most
1497 * signal and plays a central role in 1D measurement systems.
1498 *
1499 * The function fills the provided \p x and \p y parameters with
1500 * the Golden Pixel coordinates. Typical values are x = 5 and y = 1
1501 * or 2. But the actual values depend on the specific sensor.
1502 *
1503 * Please also note the utility functions provided in the \ref argus_map
1504 * module to convert between pixel coordinates and channel numbers or
1505 * shift pixel maps by a position offset (#ShiftSelectedPixels) or
1506 * generate pixel masks centered around the Golden Pixel
1507 * (#FillPixelMask).
1508 *
1509 * @param hnd The API handle; contains all internal states and data.
1510 * @param x The Golden Pixel x-coordinate.
1511 * @param y The Golden Pixel y-coordinate.
1512 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1513 *****************************************************************************/
1514status_t Argus_GetCalibrationGoldenPixel(argus_hnd_t const * hnd, uint8_t * x, uint8_t * y);
1515
1517#ifdef __cplusplus
1518} // extern "C"
1519#endif
1520#endif /* ARGUS_API_H */
This file is part of the AFBR-S50 hardware API.
This file is part of the AFBR-S50 API.
This file is part of the AFBR-S50 hardware API.
This file is part of the AFBR-S50 API.
This file is part of the AFBR-S50 API.
This file is part of the AFBR-S50 API.
This file is part of the AFBR-S50 hardware API.
argus_laser_type_t Argus_GetLaserType(argus_hnd_t *hnd)
Gets the type number of the device laser.
status_t Argus_DestroyHandle(argus_hnd_t *hnd)
Destroys a given device data handle object.
s2pi_slave_t Argus_GetSPISlave(argus_hnd_t *hnd)
Gets the SPI hardware slave identifier.
argus_module_version_t Argus_GetModuleVersion(argus_hnd_t *hnd)
Gets the version/variant of the module.
argus_module_version_t
The AFBR-S50 module types.
Definition argus_def.h:93
status_t Argus_RestoreDeviceState(argus_hnd_t *hnd)
Restores the device state with a re-write of all register values.
status_t(* argus_measurement_ready_callback_t)(status_t status, argus_hnd_t *hnd)
Measurement Ready API callback function.
Definition argus_def.h:315
argus_chip_version_t Argus_GetChipVersion(argus_hnd_t *hnd)
Gets the version number of the chip.
char const * Argus_GetModuleName(argus_hnd_t *hnd)
Gets the name string of the module.
status_t Argus_InitMode(argus_hnd_t *hnd, s2pi_slave_t spi_slave, argus_mode_t mode)
Initializes the device with specified measurement mode.
status_t Argus_Init(argus_hnd_t *hnd, s2pi_slave_t spi_slave)
Initializes the device with default measurement mode.
uint32_t Argus_GetChipID(argus_hnd_t *hnd)
Gets the unique identification number of the chip.
status_t Argus_ReinitMode(argus_hnd_t *hnd, argus_mode_t mode)
Reinitializes the device with a specified measurement mode.
argus_hnd_t * Argus_CreateHandle(void)
Creates a new device data handle object to store all internal states.
struct argus_hnd_t argus_hnd_t
Definition argus_def.h:284
argus_chip_version_t
The AFBR-S50 chip versions.
Definition argus_def.h:200
int32_t s2pi_slave_t
Definition argus_api.h:67
status_t Argus_Reinit(argus_hnd_t *hnd)
Reinitializes the device with the current measurement mode.
argus_mode_t
The measurement modes.
Definition argus_def.h:264
uint32_t Argus_GetAPIVersion(void)
Gets the version number of the current API library.
char const * Argus_GetBuildNumber(void)
Gets the build number of the current API library.
status_t Argus_Deinit(argus_hnd_t *hnd)
Deinitializes the API modules and the device.
argus_laser_type_t
The AFBR-S50 laser configurations.
Definition argus_def.h:175
status_t Argus_SetCalibrationCrosstalkVectorTable(argus_hnd_t *hnd, argus_cal_xtalk_table_t const *value)
Sets the custom crosstalk vector table to a specified device.
status_t Argus_ClearUserCalibration(argus_hnd_t *hnd)
Clears all user calibration values from NVM for the specified device.
status_t Argus_GetCalibrationPixelRangeOffsets(argus_hnd_t *hnd, argus_cal_offset_table_t *value)
Gets the relative pixel offset table from a specified device.
status_t Argus_ResetCalibrationPixelRangeOffsets(argus_hnd_t *hnd)
Resets the relative pixel offset values for the specified device to the factory calibrated default va...
status_t Argus_SetCalibrationCrosstalkSequenceAmplitudeThreshold(argus_hnd_t *hnd, uq12_4_t value)
Sets the max. amplitude threshold for the crosstalk calibration sequence.
void Argus_GetCrosstalkVectorTable_Callback(argus_cal_xtalk_table_t *xtalk, argus_mode_t const mode)
A callback that returns the external crosstalk vector table.
status_t Argus_GetCalibrationCrosstalkSequenceSampleTime(argus_hnd_t *hnd, uint16_t *value)
Gets the sample time for the crosstalk calibration sequence.
status_t Argus_SetCalibrationGlobalRangeOffsets(argus_hnd_t *hnd, q0_15_t offset_low, q0_15_t offset_high)
Sets the global range offset values to a specified device.
status_t Argus_GetCalibrationGlobalRangeOffsets(argus_hnd_t *hnd, q0_15_t *offset_low, q0_15_t *offset_high)
Gets the global range offset values from a specified device.
status_t Argus_SetCalibrationPixelRangeOffsets(argus_hnd_t *hnd, argus_cal_offset_table_t const *value)
Sets the relative pixel offset table to a specified device.
status_t Argus_GetCalibrationCrosstalkSequenceAmplitudeThreshold(argus_hnd_t *hnd, uq12_4_t *value)
Gets the max. amplitude threshold for the crosstalk calibration sequence.
status_t Argus_GetCalibrationCrosstalkPixel2Pixel(argus_hnd_t *hnd, argus_cal_p2pxtalk_t *value)
Gets the pixel-to-pixel crosstalk compensation parameters from a specified device.
status_t Argus_GetCalibrationGoldenPixel(argus_hnd_t const *hnd, uint8_t *x, uint8_t *y)
Gets the currently calibrated Golden Pixel coordinates.
status_t Argus_SetCalibrationRangeOffsetSequenceSampleTime(argus_hnd_t *hnd, uint16_t value)
Sets the sample time for the range offset calibration sequence.
status_t Argus_GetCalibrationCrosstalkVectorTable(argus_hnd_t *hnd, argus_cal_xtalk_table_t *value)
Gets the custom crosstalk vector table from a specified device.
status_t Argus_SetCalibrationCrosstalkSequenceSampleTime(argus_hnd_t *hnd, uint16_t value)
Sets the sample time for the crosstalk calibration sequence.
status_t Argus_GetCalibrationRangeOffsetSequenceSampleTime(argus_hnd_t *hnd, uint16_t *value)
Gets the sample time for the range offset calibration sequence.
status_t Argus_SetCalibrationCrosstalkPixel2Pixel(argus_hnd_t *hnd, argus_cal_p2pxtalk_t const *value)
Sets the pixel-to-pixel crosstalk compensation parameters to a specified device.
status_t Argus_ResetCalibrationCrosstalkVectorTable(argus_hnd_t *hnd)
Resets the crosstalk vector table for the specified device to the factory calibrated default values.
void Argus_GetPixelRangeOffsets_Callback(argus_cal_offset_table_t *offsets, argus_mode_t const mode)
A callback that returns the external pixel range offsets.
status_t Argus_GetConfigurationUnambiguousRange(argus_hnd_t *hnd, uint32_t *range_mm)
Gets the current unambiguous range in mm.
status_t Argus_GetConfigurationFrameTime(argus_hnd_t *hnd, uint32_t *value)
Gets the frame time from a specified device.
status_t Argus_ResetMeasurementMode(argus_hnd_t *hnd)
Resets the measurement mode to a specified device.
status_t Argus_GetConfigurationDFMMode(argus_hnd_t *hnd, argus_dfm_mode_t *value)
Gets the Dual Frequency Mode (DFM) from a specified device.
status_t Argus_SetConfigurationDFMMode(argus_hnd_t *hnd, argus_dfm_mode_t value)
Sets the Dual Frequency Mode (DFM) to a specified device.
status_t Argus_GetMeasurementMode(argus_hnd_t *hnd, argus_mode_t *mode)
Gets the measurement mode from a specified device.
status_t Argus_SetConfigurationShotNoiseMonitorMode(argus_hnd_t *hnd, argus_snm_mode_t value)
Sets the Shot Noise Monitor (SNM) mode to a specified device.
status_t Argus_GetConfigurationCrosstalkMonitorMode(argus_hnd_t *hnd, bool *value)
Gets the Crosstalk Monitor (XTM) mode from a specified device.
status_t Argus_SetMeasurementMode(argus_hnd_t *hnd, argus_mode_t mode)
Sets the measurement mode to a specified device.
status_t Argus_SetConfigurationCrosstalkMonitorMode(argus_hnd_t *hnd, bool value)
Sets the Crosstalk Monitor (XTM) mode to a specified device.
status_t Argus_GetConfigurationSmartPowerSaveEnabled(argus_hnd_t *hnd, bool *value)
Gets the smart power save enabled flag from a specified device.
status_t Argus_SetConfigurationDynamicAdaption(argus_hnd_t *hnd, argus_cfg_dca_t const *value)
Sets the full DCA module configuration to a specified device.
argus_mode_t Argus_GetDefaultMeasurementMode(argus_module_version_t module)
Gets the default measurement mode for a specified module type.
status_t Argus_GetConfigurationShotNoiseMonitorMode(argus_hnd_t *hnd, argus_snm_mode_t *value)
Gets the Shot Noise Monitor (SNM) mode from a specified device.
status_t Argus_SetConfigurationFrameTime(argus_hnd_t *hnd, uint32_t value)
Sets the frame time to a specified device.
status_t Argus_GetConfigurationDynamicAdaption(argus_hnd_t *hnd, argus_cfg_dca_t *value)
Gets the # from a specified device.
status_t Argus_SetConfigurationSmartPowerSaveEnabled(argus_hnd_t *hnd, bool value)
Sets the smart power save enabled flag to a specified device.
status_t Argus_SetConfigurationPixelBinning(argus_hnd_t *hnd, argus_cfg_pba_t const *value)
Sets the pixel binning configuration parameters to a specified device.
status_t Argus_GetConfigurationPixelBinning(argus_hnd_t *hnd, argus_cfg_pba_t *value)
Gets the pixel binning configuration parameters from a specified device.
argus_dfm_mode_t
Definition argus_dfm.h:71
int32_t q9_22_t
Signed fixed point number: Q9.22.
Definition fp_def.h:538
int16_t q0_15_t
Signed fixed point number: Q0.15.
Definition fp_def.h:381
uint16_t uq12_4_t
Unsigned fixed point number: UQ12.4.
Definition fp_def.h:231
status_t Argus_EvaluateData(argus_hnd_t *hnd, argus_results_t *res)
Evaluates measurement data from the raw sensor readout data.
status_t Argus_Abort(argus_hnd_t *hnd)
Stops the currently ongoing measurements and SPI activity immediately.
status_t Argus_TriggerMeasurement(argus_hnd_t *hnd, argus_measurement_ready_callback_t cb)
Triggers a single measurement frame asynchronously.
status_t Argus_StopMeasurementTimer(argus_hnd_t *hnd)
Stops the timer based measurement cycle.
bool Argus_IsDataEvaluationPending(argus_hnd_t *hnd)
Determines whether a data evaluation is pending.
status_t Argus_EvaluateDataDebug(argus_hnd_t *hnd, argus_results_t *res, argus_results_debug_t *dbg)
Evaluates measurement data from the raw sensor readout data.
status_t Argus_ExecuteAbsoluteRangeOffsetCalibrationSequence(argus_hnd_t *hnd, q9_22_t targetRange)
Executes an absolute range offset calibration measurement.
status_t Argus_GetStatus(argus_hnd_t *hnd)
Checks the state of the device/driver.
status_t Argus_StartMeasurementTimer(argus_hnd_t *hnd, argus_measurement_ready_callback_t cb)
Starts the timer based measurement cycle asynchronously.
status_t Argus_ExecuteRelativeRangeOffsetCalibrationSequence(argus_hnd_t *hnd)
Executes a relative range offset calibration measurement.
bool Argus_IsTimerMeasurementActive(argus_hnd_t *hnd)
Determines if the device if active with timer based measurements.
status_t Argus_ExecuteXtalkCalibrationSequence(argus_hnd_t *hnd)
Executes a crosstalk calibration measurement.
status_t Argus_Ping(argus_hnd_t *hnd)
Tests the connection to the device by sending a ping message.
argus_snm_mode_t
Definition argus_snm.h:66
int32_t status_t
Type used for all status and error return values.
Definition argus_status.h:70
argus_hnd_t * hnd
Definition main.c:100
Pixel-To-Pixel Crosstalk Compensation Parameters.
Definition argus_xtalk.h:169
Dynamic Configuration Adaption (DCA) Parameters.
Definition argus_dca.h:372
The pixel binning algorithm settings data structure.
Definition argus_pba.h:209
The debug data of measurement results data structure.
Definition argus_res.h:144
The measurement results data structure.
Definition argus_res.h:216
Pixel Range Offset Table.
Definition argus_offset.h:55
Pixel Crosstalk Vector Table.
Definition argus_xtalk.h:77