AFBR-S50 API Reference Manual v1.6.5
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 * Note that the function blocks until the current measurements are
508 * finished before returning. This guarantees that the callback was
509 * invoked and the #Argus_EvaluateData function may need to be called
510 * in order to release the data buffer.
511 *
512 * @param hnd The API handle; contains all internal states and data.
513 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
514 *****************************************************************************/
516
517/*!***************************************************************************
518 * @brief Triggers a single measurement frame asynchronously.
519 *
520 * @details This function immediately triggers a single measurement frame
521 * asynchronously if all the pre-conditions are met. Otherwise it
522 * returns with a corresponding status (e.g. #STATUS_BUSY or
523 * #STATUS_ARGUS_POWERLIMIT).
524 *
525 * When the measurement has finished, a callback (which is passed as
526 * a parameter to the function) is invoked in order to inform the
527 * main thread to call the \link #Argus_EvaluateData data evaluation
528 * method\endlink. This call is mandatory to release the data buffer
529 * for the next measurement and it must not be invoked directly from
530 * the callback since it is currently within an interrupt service
531 * routine. Rather a flag should inform the main thread or task
532 * scheduler to invoke the evaluation task.
533 *
534 * The pre-conditions for starting a measurement frame are:
535 * 1. timer flag set (i.e. a certain time has passed since the last
536 * measurement in order to fulfill eye-safety),
537 * 2. device idle (i.e. no measurement currently ongoing) and
538 * 3. data buffer ready (i.e. the previous data has been evaluated).
539 *
540 * The callback function pointer will be invoked when the measurement
541 * frame has finished successfully or whenever an error, that cannot
542 * be handled internally, occurs.
543 *
544 * The successful finishing of the measurement frame is not checked
545 * for timeouts! Instead, the user can call the #Argus_GetStatus()
546 * function on a regular function to do so.
547 *
548 * @note Despite this function triggers a new measurement cycle upon its
549 * invocation, the frame time parameter is still active for this
550 * measurement mode. Basically, the first pre-condition mentioned
551 * above is controlled via the frame time parameter. This means
552 * that measurements cannot be triggered faster than the frame
553 * timer parameters specifies. The maximum integration time (i.e.
554 * exposure time) is also determined by the frame time such that
555 * new measurements are finished with the specified frame time and
556 * the device is ready to trigger a new measurement after the
557 * frame time has elapse.
558 * See #Argus_SetConfigurationFrameTime function for more information
559 * on the frame time.
560 *
561 * @param hnd The API handle; contains all internal states and data.
562 *
563 * @param cb Callback function that will be invoked when the measurement
564 * is completed. Its parameters are the \link #status_t status
565 * \endlink of the finished measurement cycle and the pointer to
566 * the calling \link #argus_hnd_t API handle\endlink, i.e. the
567 * /p hnd value. The latter must be passed to the
568 * #Argus_EvaluateData function.
569 * If an error occurred, the status differs from #STATUS_OK.
570 *
571 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
572 *****************************************************************************/
575
576
577/*!****************************************************************************
578 * @brief Starts the teach-in measurement mode.
579 *
580 * @details This function starts the teach-in measurement mode which maximizes
581 * the laser output (within the limits of eye-safety) for better
582 * visibility. This can be useful when aligning the sensor to a target
583 * where the laser spot needs to be visible. This is mostly helpful
584 * for the device variants with visible (red) lasers.
585 *
586 * The teach-in measurement mode can (and should) be stopped using the
587 * #Argus_StopTeachInMode function.
588 *
589 * @param hnd The API handle; contains all internal states and data.
590 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
591 *****************************************************************************/
593
594/*!****************************************************************************
595 * @brief Stops the teach-in measurement mode.
596 *
597 * @details This function stops the teach-in measurement mode which maximizes
598 * the laser output (within the limits of eye-safety) for better
599 * visibility.
600 *
601 * The teach-in measurement mode can be started using the
602 * #Argus_StartTeachInMode function.
603 *
604 * @param hnd The API handle; contains all internal states and data.
605 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
606 *****************************************************************************/
608
609/*!***************************************************************************
610 * @brief Determines whether a data evaluation is pending.
611 *
612 * @details If the function returns true, a raw buffer is required to be
613 * evaluated to the #Argus_EvaluateData function. The raw data buffer
614 * is filled with raw data from the measurement tasks which need to
615 * be evaluated and the buffer must be freed in order to restart a
616 * new measurement task.
617 *
618 * Note that no configuration parameters can be update until all raw
619 * buffers are evaluated.
620 *
621 * @note See also the #Argus_GetStatus function to obtain the current device
622 * status and error code if any.
623 *
624 * @param hnd The API handle; contains all internal states and data.
625 * @return True if any raw buffer is filled with data that must be evaluated.
626 *****************************************************************************/
628
629/*!***************************************************************************
630 * @brief Determines if the device if active with timer based measurements.
631 * @details If the function returns true, the device is active with timer
632 * scheduled measurements that have been started via the
633 * #Argus_StartMeasurementTimer.
634 *
635 * Note that the active state is independent of the busy state that
636 * is set when the device is actually busy. The active state is also
637 * true if the device is currently idle but waits for the next timer
638 * event to trigger a new measurement cycle.
639 *
640 * @note See also the #Argus_GetStatus function to obtain the current device
641 * status and error code if any.
642 *
643 * @param hnd The API handle; contains all internal states and data.
644 * @return True if the device is operating in timer triggered measurement mode.
645 *****************************************************************************/
647
648/*!***************************************************************************
649 * @brief Stops the currently ongoing measurements and SPI activity immediately.
650 *
651 * @param hnd The API handle; contains all internal states and data.
652 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
653 *****************************************************************************/
655
656/*!***************************************************************************
657 * @brief Checks the state of the device/driver.
658 *
659 * @details Returns the current module status or error if any.
660 *
661 * See the following for a list of errors:
662 *
663 * Status:
664 * - Idle/OK: Device and SPI interface are idle (== #STATUS_IDLE).
665 * - Busy: Device or SPI interface are busy (== #STATUS_BUSY).
666 * - Initializing: The modules and devices are currently initializing
667 * (== #STATUS_INITIALIZING).
668 * .
669 *
670 * Error:
671 * - Not Initialized: The modules (or any submodule) has not been
672 * initialized yet (== #ERROR_NOT_INITIALIZED).
673 * - Not Connected: No device has been connected (or connection errors
674 * have occurred) (== #ERROR_ARGUS_NOT_CONNECTED).
675 * - Timeout: A previous frame measurement has not finished within a
676 * specified time (== #ERROR_TIMEOUT).
677 * .
678 *
679 * @note Note that this function returns the actual busy state. This means
680 * that it will return #STATUS_IDLE during the pause between two
681 * consecutive measurement frames. If the device is active with timer
682 * based measurements (i.e. started via the #Argus_StartMeasurementTimer
683 * function), the return state switches from idle to busy and back
684 * periodically. Use the #Argus_IsTimerMeasurementActive function in
685 * order to determine if the device is active with timer based
686 * measurements.
687 *
688 * @note Note also that the device might reject configuration parameter
689 * update despite the status is #STATUS_IDLE. This is due to the fact
690 * that the internal raw data buffers are still busy and require to
691 * be freed by passing them to the #Argus_EvaluateData function. Use
692 * the #Argus_IsDataEvaluationPending function to see whether any of
693 * the raw data buffers is busy or the configuration can be changed.
694 *
695 * @param hnd The API handle; contains all internal states and data.
696 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
697 *****************************************************************************/
699
700/*!*****************************************************************************
701 * @brief Tests the connection to the device by sending a ping message.
702 *
703 * @details A ping is transferred to the device in order to check the device and
704 * SPI connection status. Returns #STATUS_OK on success and
705 * #ERROR_ARGUS_NOT_CONNECTED else-wise.
706 *
707 * @param hnd The API handle; contains all internal states and data.
708 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
709 ******************************************************************************/
711
712/*!***************************************************************************
713 * @brief Evaluates measurement data from the raw sensor readout data.
714 *
715 * @details This function must be called after each completion of a measurement
716 * cycle. The completion of a measurement cycle is communicated by the
717 * API via the invocation of the measurement data ready callback. The
718 * callback is installed in the API when new measurements are started
719 * either via the #Argus_TriggerMeasurement or via the
720 * #Argus_StartMeasurementTimer functions.
721 *
722 * This function evaluates measurement values like distances, amplitudes
723 * states and auxiliary values like temperature or voltage values from
724 * the raw sensor readout data obtained from the device during the
725 * measurement cycle. A pointer to a #argus_results_t data structure
726 * must be passed where all the evaluated values will be written to.
727 * The structure must persist during the whole execution of the
728 * #Argus_EvaluateData function.
729 *
730 * In addition to the evaluation of measurement data, the function
731 * feeds back the obtained information to the device in order to
732 * optimize its performance with respect to the ambient conditions,
733 * utilizing the so called Dynamic Configuration Adaption (DCA)
734 * feature.
735 *
736 * Furthermore, several calibration algorithm are applied to the data.
737 *
738 * If the function is called without any data ready to be evaluated
739 * from the measurement module, the error code #ERROR_ARGUS_BUFFER_EMPTY
740 * is returned and not data is written to the passed #argus_results_t
741 * data structure.
742 *
743 * @note The call to this function is mandatory for each finished measurement
744 * cycle, i.e. for each call to the measurement data ready callback.
745 * If the function is not called, the data is not evaluated and the
746 * internal raw data buffers are not freed. In that case, they can not
747 * be reused for the next measurement and the API can not start new
748 * measurements.
749 * There are up to two internal buffers available, the to callback
750 * is called twice before the API must wait for the data evaluation
751 * to finish.
752 *
753 * @param hnd The API handle; contains all internal states and data.
754 * @param res A pointer to the results structure that will be populated
755 * with evaluated data.
756 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
757 *****************************************************************************/
759
760/*!***************************************************************************
761 * @brief Evaluates measurement data from the raw sensor readout data.
762 *
763 * @details This function enhances the #Argus_EvaluateData by adding additional
764 * debug data into a specified debug data structure (\p dbg). If the
765 * \p dbg is null, the function is eqivalent to the #Argus_EvaluateData
766 * function. This, see #Argus_EvaluateData for reference.
767 *
768 * @param hnd The API handle; contains all internal states and data.
769 * @param res A pointer to the results structure that will be populated
770 * with evaluated data.
771 * @param dbg An optional pointer (can be null) to the debug data structure.
772 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
773 *****************************************************************************/
776
777/*!***************************************************************************
778 * @brief Executes a crosstalk calibration measurement.
779 *
780 * @details This function immediately triggers a crosstalk vector calibration
781 * measurement sequence. The ordinary measurement activity is suspended
782 * while the calibration is ongoing.
783 *
784 * In order to perform a crosstalk calibration, the reflection of the
785 * transmitted signal must be kept from the receiver side, by either
786 * covering the TX completely (or RX respectively) or by setting up
787 * an absorbing target at far distance.
788 *
789 * After calibration has finished successfully, the obtained data is
790 * applied immediately and can be read from the API using the
791 * #Argus_GetCalibrationCrosstalkVectorTable function.
792 *
793 * @param hnd The API handle; contains all internal states and data.
794 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
795 *****************************************************************************/
797
798/*!***************************************************************************
799 * @brief Executes a relative range offset calibration measurement.
800 *
801 * @details This function immediately triggers a relative range offset calibration
802 * measurement sequence. The ordinary measurement activity is suspended
803 * while the calibration is ongoing.
804 *
805 * In order to perform a relative range offset calibration, a flat
806 * calibration target must be setup perpendicular to the sensors
807 * field-of-view.
808 *
809 * \code
810 * AFBR-S50 ToF Sensor
811 * #|
812 * #| |
813 * #|-----+ |
814 * #| RX | |
815 * Reference #|----++ | Calibration
816 * Plane #| TX | | Target
817 * #|----+ |
818 * #| |
819 * #| <------- targetRange -----------------> |
820 * \endcode
821 *
822 * There are two options to run the offset calibration: relative and
823 * absolute.
824 *
825 * - Relative (#Argus_ExecuteRelativeRangeOffsetCalibrationSequence):
826 * when the absolute distance is not essential or the distance to
827 * the calibration target is not known, the relative method can be
828 * used to compensate the relative pixel range offset w.r.t. the
829 * average range. The absolute or global range offset is not changed.
830 * - Absolute (#Argus_ExecuteAbsoluteRangeOffsetCalibrationSequence):
831 * when the absolute distance is essential and the distance to the
832 * calibration target is known, the absolute method can be used to
833 * calibrate the absolute measured distance. Additionally, the
834 * relative pixel offset w.r.t. the average range is also compensated.
835 * .
836 *
837 * After calibration has finished successfully, the obtained data is
838 * applied immediately and can be read from the API using the
839 * #Argus_GetCalibrationPixelRangeOffsets or
840 * #Argus_GetCalibrationGlobalRangeOffsets function.
841 *
842 * @param hnd The API handle; contains all internal states and data.
843 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
844 *****************************************************************************/
846
847/*!***************************************************************************
848 * @brief Executes an absolute range offset calibration measurement.
849 *
850 * @details This function immediately triggers an absolute range offset calibration
851 * measurement sequence. The ordinary measurement activity is suspended
852 * while the calibration is ongoing.
853 *
854 * In order to perform a relative range offset calibration, a flat
855 * calibration target must be setup perpendicular to the sensors
856 * field-of-view.
857 *
858 * \code
859 * AFBR-S50 ToF Sensor
860 * #|
861 * #| |
862 * #|-----+ |
863 * #| RX | |
864 * Reference #|----++ | Calibration
865 * Plane #| TX | | Target
866 * #|----+ |
867 * #| |
868 * #| <------- targetRange -----------------> |
869 * \endcode
870 *
871 * There are two options to run the offset calibration: relative and
872 * absolute.
873 *
874 * - Relative (#Argus_ExecuteRelativeRangeOffsetCalibrationSequence):
875 * when the absolute distance is not essential or the distance to
876 * the calibration target is not known, the relative method can be
877 * used to compensate the relative pixel range offset w.r.t. the
878 * average range. The absolute or global range offset is not changed.
879 * - Absolute (#Argus_ExecuteAbsoluteRangeOffsetCalibrationSequence):
880 * when the absolute distance is essential and the distance to the
881 * calibration target is known, the absolute method can be used to
882 * calibrate the absolute measured distance. Additionally, the
883 * relative pixel offset w.r.t. the average range is also compensated.
884 * .
885 *
886 * After calibration has finished successfully, the obtained data is
887 * applied immediately and can be read from the API using the
888 * #Argus_GetCalibrationPixelRangeOffsets or
889 * #Argus_GetCalibrationGlobalRangeOffsets function.
890 *
891 * @param hnd The API handle; contains all internal states and data.
892 * @param targetRange The absolute range between the reference plane and the
893 * calibration target in meter an Q9.22 format.
894 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
895 *****************************************************************************/
897 q9_22_t targetRange);
898
901/*!**************************************************************************
902 * Configuration API
903 ****************************************************************************
904 * @addtogroup argus_cfg
905 * @{
906 ****************************************************************************/
907
908/*!***************************************************************************
909 * @brief Gets the default measurement mode for a specified module type.
910 *
911 * @param module The specified module type.
912 * @return Returns the default measurement mode for the specified module type.
913 *****************************************************************************/
915
916/*!***************************************************************************
917 * @brief Sets the measurement mode to a specified device.
918 *
919 * @details This generates a new default configuration and calibration for the
920 * specified measurement mode and applies it to the device.
921 *
922 * See #argus_mode_t for a list of all available measurement modes.
923 *
924 * @warning The function overwrites all made changes to the configuration or
925 * calibration parameters with the default values. So this function
926 * must be called before any other changes to the configuration or
927 * calibration parameters are made!
928 *
929 * @param hnd The API handle; contains all internal states and data.
930 * @param mode The new measurement mode.
931 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
932 *****************************************************************************/
934
935/*!***************************************************************************
936 * @brief Resets the measurement mode to a specified device.
937 *
938 * @details This generates a new default configuration and calibration for the
939 * current measurement mode and applies it to the device.
940 *
941 * @warning The function overwrites all made changes to the configuration or
942 * calibration parameters with the default values. So this function
943 * must be called before any other changes to the configuration or
944 * calibration parameters are made!
945 *
946 * @param hnd The API handle; contains all internal states and data.
947 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
948 *****************************************************************************/
950
951/*!***************************************************************************
952 * @brief Gets the measurement mode from a specified device.
953 *
954 * @param hnd The API handle; contains all internal states and data.
955 * @param mode The current measurement mode.
956 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
957 *****************************************************************************/
959
960/*!***************************************************************************
961 * @brief Sets the frame time to a specified device.
962 *
963 * @details The frame time determines the measurement rate of the device.
964 * Usually, this controller the periodicity of measurements to be
965 * triggered via the timer based measurement mode that can be started
966 * via the #Argus_StartMeasurementTimer function. But also the
967 * behavior of the #Argus_TriggerMeasurement function is influenced
968 * by the frame rate parameter.
969 *
970 * The frame time parameter handles the maximum frame rate by limiting
971 * the trigger of a new measurement frame to the specified value.
972 * On the other hand, the accuracy of measurement results it also
973 * influenced since the frame time specifies the maximum integration
974 * depth (i.e. exposure time) along with the laser safety limitations.
975 * This means, the measurement speed can be increased by decreasing
976 * the frame time parameter and the accuracy can be improved by
977 * increasing the frame time parameter.
978 *
979 * Note the additional factor will limit the maximum frame rate on the
980 * one hand and the accuracy on the other hand:
981 * - High CPU load (or slow CPU in general) will lead to delays due
982 * to long data evaluation task (#Argus_EvaluateData) or long user
983 * application code. Reduce CPU load or increase CPU power to
984 * increase maximum frame rate.
985 * - The dual frequency mode (DFM, see #Argus_SetConfigurationDFMMode)
986 * will additionally limit the maximum frame rate to approximately
987 * 100 frames per second. Disable the DFM to increase maximum frame
988 * rates.
989 * - The smart power save (SPS, see
990 * #Argus_SetConfigurationSmartPowerSaveEnabled) mode will decrease
991 * the maximum possible frame rate slightly. Disable it to increase
992 * the maximum frame rate.
993 * - The dynamic configuration adaption with its specific power saving
994 * ratio parameter (see #Argus_SetConfigurationDynamicAdaption)
995 * will limit the maximum integration depth along with the laser
996 * safety limitations. Increase the power saving ratio to increase
997 * accuracy. Note that laser safety limitations might already limit
998 * the maximum integration depth such that the power saving ratio
999 * is ineffective.
1000 * .
1001 *
1002 * @param hnd The API handle; contains all internal states and data.
1003 * @param value The measurement frame time in microseconds.
1004 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1005 *****************************************************************************/
1007
1008/*!***************************************************************************
1009 * @brief Gets the frame time from a specified device.
1010 *
1011 * @param hnd The API handle; contains all internal states and data.
1012 * @param value The current frame time in microseconds.
1013 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1014 *****************************************************************************/
1016
1017/*!***************************************************************************
1018 * @brief Sets the smart power save enabled flag to a specified device.
1019 *
1020 * @param hnd The API handle; contains all internal states and data.
1021 * @param value The new smart power save enabled flag.
1022 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1023 *****************************************************************************/
1025 bool value);
1026
1027/*!***************************************************************************
1028 * @brief Gets the smart power save enabled flag from a specified device.
1029 *
1030 * @param hnd The API handle; contains all internal states and data.
1031 * @param value The current smart power save enabled flag.
1032 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1033 *****************************************************************************/
1035 bool * value);
1036
1037/*!***************************************************************************
1038 * @brief Sets the Dual Frequency Mode (DFM) to a specified device.
1039 *
1040 * @param hnd The API handle; contains all internal states and data.
1041 * @param value The new DFM mode value.
1042 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1043 *****************************************************************************/
1045 argus_dfm_mode_t value);
1046
1047
1048/*!***************************************************************************
1049 * @brief Gets the Dual Frequency Mode (DFM) from a specified device.
1050 *
1051 * @param hnd The API handle; contains all internal states and data.
1052 * @param value The current DFM mode value.
1053 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1054 *****************************************************************************/
1056 argus_dfm_mode_t * value);
1057
1058/*!***************************************************************************
1059 * @brief Sets the Shot Noise Monitor (SNM) mode to a specified device.
1060 *
1061 * @param hnd The API handle; contains all internal states and data.
1062 * @param value The new SNM mode value.
1063 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1064 *****************************************************************************/
1066 argus_snm_mode_t value);
1067
1068/*!***************************************************************************
1069 * @brief Gets the Shot Noise Monitor (SNM) mode from a specified device.
1070 *
1071 * @param hnd The API handle; contains all internal states and data.
1072 * @param value The current SNM mode value.
1073 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1074 *****************************************************************************/
1076 argus_snm_mode_t * value);
1077
1078/*!***************************************************************************
1079* @brief Sets the Crosstalk Monitor (XTM) mode to a specified device.
1080*
1081* @param hnd The API handle; contains all internal states and data.
1082* @param value The new XTM mode value (true: enabled; false: disabled).
1083* @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1084*****************************************************************************/
1086 bool value);
1087
1088/*!***************************************************************************
1089* @brief Gets the Crosstalk Monitor (XTM) mode from a specified device.
1090*
1091* @param hnd The API handle; contains all internal states and data.
1092* @param value The current XTM mode value (true: enabled; false: disabled).
1093* @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1094*****************************************************************************/
1096 bool * value);
1097
1098/*!***************************************************************************
1099 * @brief Sets the full DCA module configuration to a specified device.
1100 *
1101 * @param hnd The API handle; contains all internal states and data.
1102 * @param value The new DCA configuration set.
1103 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1104 *****************************************************************************/
1106 argus_cfg_dca_t const * value);
1107
1108/*!***************************************************************************
1109 * @brief Gets the # from a specified device.
1110 *
1111 * @param hnd The API handle; contains all internal states and data.
1112 * @param value The current DCA configuration set value.
1113 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1114 *****************************************************************************/
1116 argus_cfg_dca_t * value);
1117/*!***************************************************************************
1118 * @brief Sets the pixel binning configuration parameters to a specified device.
1119 *
1120 * @param hnd The API handle; contains all internal states and data.
1121 * @param value The new pixel binning configuration parameters.
1122 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1123 *****************************************************************************/
1125 argus_cfg_pba_t const * value);
1126
1127/*!***************************************************************************
1128 * @brief Gets the pixel binning configuration parameters from a specified device.
1129 *
1130 * @param hnd The API handle; contains all internal states and data.
1131 * @param value The current pixel binning configuration parameters.
1132 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1133 *****************************************************************************/
1135 argus_cfg_pba_t * value);
1136
1137/*!***************************************************************************
1138 * @brief Gets the current unambiguous range in mm.
1139 *
1140 * @param hnd The API handle; contains all internal states and data.
1141 * @param range_mm The returned range in mm.
1142 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1143 *****************************************************************************/
1145 uint32_t * range_mm);
1146
1149/*!**************************************************************************
1150 * Calibration API
1151 ****************************************************************************
1152 * @addtogroup argus_cal
1153 * @{
1154 ****************************************************************************/
1155
1156/*!***************************************************************************
1157 * @brief Sets the global range offset values to a specified device.
1158 *
1159 * @details The global range offsets are subtracted from the raw range values.
1160 * There are two distinct values that are applied in low or high
1161 * power stage setting respectively.
1162 *
1163 * @param hnd The API handle; contains all internal states and data.
1164 * @param offset_low The new global range offset for the low power stage in
1165 * meter and Q0.15 format.
1166 * @param offset_high The new global range offset for the high power stage in
1167 * meter and Q0.15 format.
1168 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1169 *****************************************************************************/
1171 q0_15_t offset_low,
1172 q0_15_t offset_high);
1173
1174/*!***************************************************************************
1175 * @brief Gets the global range offset values from a specified device.
1176 *
1177 * @details The global range offsets are subtracted from the raw range values.
1178 * There are two distinct values that are applied in low or high
1179 * power stage setting respectively.
1180 *
1181 * @param hnd The API handle; contains all internal states and data.
1182 * @param offset_low The current range offset for the low power stage in
1183 * meter and Q0.15 format.
1184 * @param offset_high The current global range offset for the high power stage
1185 * in meter and Q0.15 format.
1186 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1187 *****************************************************************************/
1189 q0_15_t * offset_low,
1190 q0_15_t * offset_high);
1191
1192/*!***************************************************************************
1193 * @brief Sets the relative pixel offset table to a specified device.
1194 *
1195 * @details The relative pixel offset values are subtracted from the raw range
1196 * values for each individual pixel. Note that a global range offset
1197 * is applied additionally. The relative pixel offset values are meant
1198 * to be with respect to the average range of all pixels, i.e. the
1199 * average of all relative offsets should be 0!
1200 *
1201 * The crosstalk vector table is a two dimensional array of type
1202 * #q0_15_t, wrapped within the #argus_cal_offset_table_t structure.
1203 *
1204 * The dimensions are:
1205 * - size(0) = #ARGUS_PIXELS_X (Pixel count in x-direction)
1206 * - size(1) = #ARGUS_PIXELS_Y (Pixel count in y-direction)
1207 * .
1208 *
1209 * Its recommended to use the built-in pixel offset calibration
1210 * sequence (see #Argus_ExecuteRelativeRangeOffsetCalibrationSequence)
1211 * to determine the offset table for the current device.
1212 *
1213 * If a constant offset table for all device needs to be incorporated
1214 * into the sources, the #Argus_GetPixelRangeOffsets_Callback
1215 * should be used.
1216 *
1217 * @param hnd The API handle; contains all internal states and data.
1218 * @param value The new relative range offset in meter and Q0.15 format.
1219 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1220 *****************************************************************************/
1222 argus_cal_offset_table_t const * value);
1223
1224
1225/*!***************************************************************************
1226 * @brief Gets the relative pixel offset table from a specified device.
1227 *
1228 * @details The relative pixel offset values are subtracted from the raw range
1229 * values for each individual pixel. Note that a global range offset
1230 * is applied additionally. The relative pixel offset values are meant
1231 * to be with respect to the average range of all pixels, i.e. the
1232 * average of all relative offsets should be 0!
1233 *
1234 * The crosstalk vector table is a two dimensional array of type
1235 * #q0_15_t, wrapped within the #argus_cal_offset_table_t structure.
1236 *
1237 * The dimensions are:
1238 * - size(0) = #ARGUS_PIXELS_X (Pixel count in x-direction)
1239 * - size(1) = #ARGUS_PIXELS_Y (Pixel count in y-direction)
1240 * .
1241 *
1242 * @param hnd The API handle; contains all internal states and data.
1243 * @param value The current relative range offset in meter and Q0.15 format.
1244 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1245 *****************************************************************************/
1247 argus_cal_offset_table_t * value);
1248
1249
1250/*!***************************************************************************
1251 * @brief Resets the relative pixel offset values for the specified device to
1252 * the factory calibrated default values.
1253 *
1254 * @details The relative pixel offset values are subtracted from the raw range
1255 * values for each individual pixel. Note that a global range offset
1256 * is applied additionally.
1257 *
1258 * The factory defaults are device specific values.
1259 *
1260 * @param hnd The API handle; contains all internal states and data.
1261 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1262 *****************************************************************************/
1264
1265/*!***************************************************************************
1266 * @brief A callback that returns the external pixel range offsets.
1267 *
1268 * @details The function needs to be implemented by the host application in
1269 * order to set the external pixel range offsets values upon system
1270 * initialization. If not defined in user code, the default
1271 * implementation will return an all zero offset table, assuming there
1272 * is no (additional) external pixel range offset values.
1273 *
1274 * If defined in user code, the function must fill all offset values
1275 * in the provided \par offsets parameter with external range offset
1276 * values.
1277 * The values can be obtained by the calibration routine.
1278 *
1279 * Example usage:
1280 *
1281 * @code
1282 * status_t Argus_GetPixelRangeOffsets_Callback(argus_cal_offset_table_t offsets)
1283 * {
1284 * memset(offsets, 0, sizeof(argus_cal_offset_t));
1285 *
1286 * // Set offset values in meter and Q0.15 format.
1287 * offsets.Table[0][0] = -3542;
1288 * offsets.Table[0][1] = -4385;
1289 * offsets.Table[0][2] = 2953;
1290 * // etc.
1291 * }
1292 * @endcode
1293 *
1294 * @param offsets The pixel range offsets in meter and Q0.15 format; to be
1295 * filled with data.
1296 * @param mode The current measurement mode.
1297 *****************************************************************************/
1299 argus_mode_t const mode);
1300
1301/*!***************************************************************************
1302 * @brief Sets the sample time for the range offset calibration sequence.
1303 *
1304 * @details Gets the measurement sample acquisition time for executing the
1305 * range offset calibration sequence and generate the offset data.\n
1306 * Units: msec.
1307 *
1308 * @note Since the range offset calibration is executed twice (once for
1309 * low and once for high laser power stages), the actual calibration
1310 * time will be twice as long as set by the sample time parameter.
1311 *
1312 * @param hnd The API handle; contains all internal states and data.
1313 * @param value The new range offset calibration sequence sample time.
1314 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1315 *****************************************************************************/
1317
1318/*!***************************************************************************
1319 * @brief Gets the sample time for the range offset calibration sequence.
1320 *
1321 * @details Gets the measurement sample acquisition time for executing the
1322 * range offset calibration sequence and generate the offset data.\n
1323 * Units: msec.
1324 *
1325 * @note Since the range offset calibration is executed twice (once for
1326 * low and once for high laser power stages), the actual calibration
1327 * time will be twice as long as set by the sample time parameter.
1328 *
1329 * @param hnd The API handle; contains all internal states and data.
1330 * @param value The current range offset calibration sequence sample time.
1331 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1332 *****************************************************************************/
1334
1335/*!***************************************************************************
1336 * @brief Sets the pixel-to-pixel crosstalk compensation parameters to a specified device.
1337 *
1338 * @param hnd The API handle; contains all internal states and data.
1339 * @param value The new pixel-to-pixel crosstalk compensation parameters.
1340 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1341 *****************************************************************************/
1343 argus_cal_p2pxtalk_t const * value);
1344
1345/*!***************************************************************************
1346 * @brief Gets the pixel-to-pixel crosstalk compensation parameters from a specified device.
1347 *
1348 * @param hnd The API handle; contains all internal states and data.
1349 * @param value The current pixel-to-pixel crosstalk compensation parameters.
1350 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1351 *****************************************************************************/
1353 argus_cal_p2pxtalk_t * value);
1354
1355
1356/*!***************************************************************************
1357 * @brief Sets the custom crosstalk vector table to a specified device.
1358 *
1359 * @details The crosstalk vectors are subtracted from the raw sampling data
1360 * in the data evaluation phase.
1361 *
1362 * The crosstalk vector table is a three dimensional array of type
1363 * #xtalk_t. The #argus_cal_xtalk_table_t is the corresponding
1364 * typedef for the required data.
1365 *
1366 * The dimensions are:
1367 * - size(0) = #ARGUS_DFM_FRAME_COUNT (Dual-frequency mode A- or B-frame)
1368 * - size(1) = #ARGUS_PIXELS_X (Pixel count in x-direction)
1369 * - size(2) = #ARGUS_PIXELS_Y (Pixel count in y-direction)
1370 * .
1371 *
1372 * Its recommended to use the built-in crosstalk calibration sequence
1373 * (see #Argus_ExecuteXtalkCalibrationSequence) to determine the
1374 * crosstalk vector table.
1375 *
1376 * If a constant table for all device needs to be incorporated into
1377 * the sources, the #Argus_GetCrosstalkVectorTable_Callback
1378 * should be used.
1379 *
1380 * @param hnd The API handle; contains all internal states and data.
1381 * @param value The new crosstalk vector table.
1382 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1383 *****************************************************************************/
1385 argus_cal_xtalk_table_t const * value);
1386
1387/*!***************************************************************************
1388 * @brief Gets the custom crosstalk vector table from a specified device.
1389 *
1390 * @details The crosstalk vectors are subtracted from the raw sampling data
1391 * in the data evaluation phase.
1392 *
1393 * The crosstalk vector table is a three dimensional array of type
1394 * #xtalk_t. The #argus_cal_xtalk_table_t is the corresponding
1395 * typedef for the required data.
1396 *
1397 * The dimensions are:
1398 * - size(0) = #ARGUS_DFM_FRAME_COUNT (Dual-frequency mode A- or B-frame)
1399 * - size(1) = #ARGUS_PIXELS_X (Pixel count in x-direction)
1400 * - size(2) = #ARGUS_PIXELS_Y (Pixel count in y-direction)
1401 * .
1402 *
1403 * @param hnd The API handle; contains all internal states and data.
1404 * @param value The current crosstalk vector table.
1405 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1406 *****************************************************************************/
1408 argus_cal_xtalk_table_t * value);
1409
1410/*!***************************************************************************
1411 * @brief Resets the crosstalk vector table for the specified device to the
1412 * factory calibrated default values.
1413 *
1414 * @details The crosstalk vectors are subtracted from the raw sampling data
1415 * in the data evaluation phase.
1416 * *
1417 * The factory defaults are device specific calibrated values.
1418 *
1419 * @param hnd The API handle; contains all internal states and data.
1420 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1421 *****************************************************************************/
1423
1424/*!***************************************************************************
1425 * @brief Sets the sample time for the crosstalk calibration sequence.
1426 *
1427 * @details Sets the measurement sample acquisition time for executing the
1428 * crosstalk calibration sequence and generate the crosstalk data.\n
1429 * Units: msec.
1430 *
1431 * @param hnd The API handle; contains all internal states and data.
1432 * @param value The new crosstalk calibration sequence sample time.
1433 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1434 *****************************************************************************/
1436 uint16_t value);
1437
1438/*!***************************************************************************
1439 * @brief Gets the sample time for the crosstalk calibration sequence.
1440 *
1441 * @details Gets the measurement sample acquisition time for executing the
1442 * crosstalk calibration sequence and generate the crosstalk data.\n
1443 * Units: msec.
1444 *
1445 * @param hnd The API handle; contains all internal states and data.
1446 * @param value The current crosstalk calibration sequence sample time.
1447 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1448 *****************************************************************************/
1450 uint16_t * value);
1451
1452/*!***************************************************************************
1453 * @brief Sets the max. amplitude threshold for the crosstalk calibration sequence.
1454 *
1455 * @details The maximum amplitude threshold defines a maximum crosstalk vector
1456 * amplitude before causing an error message. If the crosstalk is
1457 * too high, there is usually an issue with the measurement setup, i.e.
1458 * there is still a measurement signal detected.
1459 *
1460 * @param hnd The API handle; contains all internal states and data.
1461 * @param value The new crosstalk calibration sequence maximum amplitude
1462 * threshold value in UQ12.4 format.
1463 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1464 *****************************************************************************/
1466 uq12_4_t value);
1467
1468/*!***************************************************************************
1469 * @brief Gets the max. amplitude threshold for the crosstalk calibration sequence.
1470 *
1471 * @details The maximum amplitude threshold defines a maximum crosstalk vector
1472 * amplitude before causing an error message. If the crosstalk is
1473 * too high, there is usually an issue with the measurement setup, i.e.
1474 * there is still a measurement signal detected.
1475 *
1476 * @param hnd The API handle; contains all internal states and data.
1477 * @param value The current max. amplitude threshold value in UQ12.4 format.
1478 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1479 *****************************************************************************/
1481 uq12_4_t * value);
1482
1483
1484/*!***************************************************************************
1485 * @brief Clears all user calibration values from NVM for the specified device.
1486 *
1487 * @details The user calibration values are stored in the non-volatile memory
1488 * (NVM) if corresponding \link #argus_nvm NVM hardware layer\endlink
1489 * is implemented. This method clears the user calibration data from
1490 * the non-volatile memory.
1491 *
1492 * @warning This does not reset the currently set calibration values to
1493 * factory defaults!
1494 *
1495 * @param hnd The API handle; contains all internal states and data.
1496 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1497 *****************************************************************************/
1499
1500
1501/*!***************************************************************************
1502 * @brief A callback that returns the external crosstalk vector table.
1503 *
1504 * @details The function needs to be implemented by the host application in
1505 * order to set the external crosstalk vector table upon system
1506 * initialization. If not defined in user code, the default
1507 * implementation will return an all zero vector table, assuming there
1508 * is no (additional) external crosstalk.
1509 *
1510 * If defined in user code, the function must fill all vector values
1511 * in the provided \par crosstalk parameter with external crosstalk
1512 * values. The values can be obtained by the calibration routine.
1513 *
1514 * Example usage:
1515 *
1516 * @code
1517 * status_t Argus_GetCrosstalkVectorTable_Callback(
1518 * argus_cal_xtalk_table_t * xtalk)
1519 * {
1520 * memset(xtalk, 0, sizeof(argus_cal_xtalk_table_t));
1521 *
1522 * // Set crosstalk vectors in Q11.4 format.
1523 * // Note on dual-frequency frame index: 0 = A-Frame; 1 = B-Frame
1524 * xtalk.FrameA[0][0].dS = -9; xtalk.FrameB[0][0].dC = -11;
1525 * xtalk.FrameA[0][1].dS = -13; xtalk.FrameB[0][1].dC = -16;
1526 * xtalk.FrameA[0][2].dS = 6; xtalk.FrameB[0][2].dC = -18;
1527 * // etc.
1528 * }
1529 * @endcode
1530 *
1531 * @param xtalk The crosstalk vector array; to be filled with data.
1532 * @param mode The current measurement mode.
1533 *****************************************************************************/
1535 argus_mode_t const mode);
1536
1537
1538/*!***************************************************************************
1539 * @brief Gets the currently calibrated Golden Pixel coordinates.
1540 *
1541 * @details The Golden Pixel is the pixel that is located at the center of the
1542 * receiving light beam. Thus it it the one that receives the most
1543 * signal and plays a central role in 1D measurement systems.
1544 *
1545 * The function fills the provided \p x and \p y parameters with
1546 * the Golden Pixel coordinates. Typical values are x = 5 and y = 1
1547 * or 2. But the actual values depend on the specific sensor.
1548 *
1549 * Please also note the utility functions provided in the \ref argus_map
1550 * module to convert between pixel coordinates and channel numbers or
1551 * shift pixel maps by a position offset (#ShiftSelectedPixels) or
1552 * generate pixel masks centered around the Golden Pixel
1553 * (#FillPixelMask).
1554 *
1555 * @param hnd The API handle; contains all internal states and data.
1556 * @param x The Golden Pixel x-coordinate.
1557 * @param y The Golden Pixel y-coordinate.
1558 * @return Returns the \link #status_t status\endlink (#STATUS_OK on success).
1559 *****************************************************************************/
1560status_t Argus_GetCalibrationGoldenPixel(argus_hnd_t const * hnd, uint8_t * x, uint8_t * y);
1561
1563#ifdef __cplusplus
1564} // extern "C"
1565#endif
1566#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:351
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:320
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:276
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_StartTeachInMode(argus_hnd_t *hnd)
Starts the teach-in measurement mode.
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_StopTeachInMode(argus_hnd_t *hnd)
Stops the teach-in measurement mode.
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:208
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