![Logo](AFBR-S50.ico) |
AFBR-S50 API Reference Manual
v1.6.5
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
|
The following document describes the changes to the AFBR-S50 API interface across the released versions. This is meant to assist developers in updating their code to a newer API version.
The API is usually not changing much between the versions, however, some features require to introduce breaking changes such that the user code needs to be adopted too. This document mainly focusses on the breaking changes only.
If migration over multiple releases is required, please refer to each of the corresponding sections below and apply the changes iteratively.
Please report any additional issues to the AFBR-S50 GitHub repository.
API Migration Guide (1.5.6 → 1.6.5)
The following document describes the changes to the AFBR-S50 API interface from v1.5.6 to v1.6.5.
Overview of Data & Function Changes / Extensions / new Items
(bug fixes or typo corrections are excluded from this list)
—Data types
- argus_cfg_dca_t Struct Reference (Changed)
- argus_pixel_t Struct Reference (Extended)
- argus_mode_t (Extended)
- argus_mode_flags_t (Extended)
- argus_snm_mode_t (Extended)
—Functions
- Argus_StartTeachInMode(argus_hand_t *hnd) (new)
- Argus_StopTeachInMode(argus_hand_t *hnd) (new)
—Miscellaneous
- New description for status -107
- New description for status -110
- New description for status -113
- New status -108
Changes in more Detail
To further improve the absolute failure at small distances below 50cm the DCA was extended by power stage differentions:
Extensions and new Items in more Detail
The pixel struct got upgraded with uncorrelatedNoise figure and signa-to-noise ratio (SNR):
New measurement modes were introduced:
The new measurement mode enumeration is as follows. Note that new modes were added which are
- High Precision Mode
- Laser Class 2 mode (only valid for AFBR-S50MV68B)
Accordingly, new mode flags were added:
The shot noise monitor was also extended by the new dynamic plus mode:
API Migration Guide (1.4.4 → 1.5.6)
The following document describes the changes to the AFBR-S50 API interface from v1.4.4 to v1.5.6.
Overview of Changes
The most changes to the last version of the AFBR-S50 API, v1.5.6, happened under the hood. Thus, there are only very minor changes regarding the offset calibration parameters to the API .
Introduction of distinct global range offsets for low and high power stages
To better compensate for the different range offsets of the low and high power stages, a second global range offset value has been introduced. The new value is only applied in the low power stage and thus does not affect the high power stage. However, the API function not require two offset values and the offset table data structure has changed from a two-dimensional array to a three-dimensional array.
Here are the changes in the API functions:
Here are the corresponding changes in the data structure:
API Migration Guide (1.3.5 → 1.4.4)
The following document describes the changes to the AFBR-S50 API interface from v1.3.5 to v1.4.4.
Due to many improvements and new features in v1.4.4, such as multi-device support, high-speed measurement modes and memory footprint reduction, the API interface has changed significantly this time.
Overview of Changes
The latest version of the AFBR-S50 API, v1.4.4, includes several significant changes that improve the performance and functionality of the sensor. These changes include:
- Memory Footprint Reduction: The new version of the API reduces the memory footprint of the library by removing the second measurement mode from the API. This means that the ability to dynamically switch between Long and Short Range Modes has been removed. Although this feature has been removed, it has resulted in a more efficient and compact library. Still, the API is capable of switching between measurement modes, but the user must re-initialize the API or use a dedicated function to change the measurement mode. This change has also removed the measurement mode parameter from most of the API functions. Beneath reducing the memory footprint, this change also allowed the introduction of additional measurements modes such as the high-speed modes.
- High-Speed Modes: The new version of the API includes additional measurement modes that are dedicated to high speed measurements. These new modes allow for measurement frame rate up to 3000 frames per second, making the sensor more versatile and applicable to a wider range of use cases. Please note that the maximum limit of the frame rate highly depends on the used microcontroller.
- Multi-Device Support: The latest version of the API now allows simultaneous usage of multiple devices per microcontroller. This means that developers can now use multiple sensors with a single microcontroller, which can significantly reduce the cost and complexity of their applications. The multiple device act independently and share a single SPI and Timer interface. The API automatically handles the resource management within the API such that there is no need for the user to manage the resources. The only limitation is the requirement of a common frame rate if multiple devices are used with a single periodic interrupt timer.
Removal of Dual-Measurement Modes And Adding of Advanced Measurement Modes
The main implication of the API change is the removal of the measurement mode parameter in most of the API functions. In order to migrate to the new version, simply remove the measurement mode parameter from each function call. Instead, set the measurement mode at initialization time (via Argus_InitMode) or use the dedicated Argus_SetMeasurementMode function to load the desired measurement mode from ROM. All changes to the default parameters must be done afterward.
v1.3.5: The measurement mode can be changed at any time via the Argus_SetMeasurementMode function. Other API calls must pass the measurement mode parameter (mode
).
v1.4.4: The new API must set the measurement mode (via Argus_SetMeasurementMode) as the first change as it reloads the default parameters from ROM and overwrites all previous made changes. Note that the measurement mode is loaded upon device initialization. Using the Argus_Init function will load the corresponding default measurement mode. The Argus_InitMode function is used to specify the measurement mode at initialization time.
argus_mode_t mode = ARGUS_MODE_ARGUS_MODE_HIGH_SPEED_SHORT_RANGE;
Note that also the measurement mode enumeration has changed to describe the new measurement modes better.
The old measurement mode enumeration is as follows:
typedef enum
{
ARGUS_MODE_A
ARGUS_MODE_B
The new measurement mode enumeration is as follows. Note that new measurement modes may be added in future releases.
Note that there are additional API methods to change the measurement mode:
Improved Measurement Ready Callback
The measurement ready callback has been updated to include the concrete handle pointer (argus_hnd_t*
) instead of an abstract pointer (void*
). This removes the need to cast from void*
to the argus_hnd_t*
when passing to the Argus_EvaluateData method.
In consequence, the Argus_TriggerMeasurement and Argus_StartMeasurementTimer methods have changed accordingly:
Improved Measurement Evaluate Function
The Argus_EvaluateData function has been updated and the abstract void * raw
pointer has been remove. The API is handling the raw data buffer now internally and the user does not need to handle the pointer any more.
The requirement to call Argus_EvaluateData exactly once per invocation of the measurement ready callback is still present. The API will return an error if Argus_EvaluateData is called more than once. On the other hand, the API will get stuck if Argus_EvaluateData is not called at all. Please use the new method Argus_IsDataEvaluationPending to determine if raw data is available and requires evaluation.
Note: The Argus_IsDataEvaluationPending does not replace the Argus_GetStatus function. Still, one needs to call the Argus_GetStatus function to determine if the measurement is ready in case of Argus_TriggerMeasurement or to check for timeout in case of running measurements via Argus_StartMeasurementTimer`. See also the API reference manual documentation of Argus_GetStatus and Argus_IsDataEvaluationPending` functions for more information.
Changed Data Types for Crosstalk and Offset Tables
The new data types argus_cal_offset_table_t
and argus_cal_xtalk_table_t
have been introduced for passing offset and crosstalk tables in and out of the API.
Function affected are:
Here is an example for the crosstalk related functions:
Here is an example for the offset related functions:
Advanced Debug Data Structure for Argus_EvaluateData
In order to obtain additional debug information without any impact on the measurement performance, a new debug data structure (argus_results_debug_t) has been introduced. A new function, Argus_EvaluateDataDebug, is added to the API to receive an optional pointer to that structure. The debug data structure is optional and can be set to NULL
if not required. Please note that in that case it is recommended to use the Argus_EvaluateData function instead.
Please note that this debug information is usually not required and should only be used if explicitly requested for debugging purposes.
S2PI Hardware Abstraction Layer (HAL) Changes
In order to support multiple devices, the S2PI layer has been updated to receive the SPI slave on every function. Further, two new functions are added that are required for the API to prevent access conflicts between multiple devices.
Changed HAL Functions in the S2PI layer
The following functions have an added slave
parameter. If there is no need for multiple device support, the parameter can be ignored (e.g. via (void)slave;
).
{
(void)slave;
}
{
(void)slave;
}
{
(void)slave;
}
{
(void)slave;
}
Added HAL Functions in the S2PI layer
The newly added functions in the s2pi.h/c
module are S2PI_TryGetMutex and S2PI_ReleaseMutex. If there is no need for multiple device support, the function can be ignored and simply return STATUS_OK.
{
(void) slave;
}
{
(void) slave;
}
In case of multi device support, refer to the API reference documentation of the S2PI_TryGetMutex and S2PI_ReleaseMutex functions for a reference implementation of that mechanism.
@ ARGUS_MODE_HIGH_SPEED_LONG_RANGE_LASER_CLASS_2
Definition: argus_def.h:310
uq10_6_t DepthMin_HighPower
Definition: argus_dca.h:476
argus_px_status_t Status
Definition: argus_px.h:146
argus_dca_amplitude_mode_t
The DCA amplitude evaluation method.
Definition: argus_dca.h:156
argus_mode_t
The measurement modes.
Definition: argus_def.h:275
argus_dca_amplitude_mode_t AmplitudeMode
Definition: argus_dca.h:444
argus_hnd_t * hnd
Definition: main.c:100
Dynamic Configuration Adaption (DCA) Parameters.
Definition: argus_dca.h:371
status_t Argus_Init(argus_hnd_t *hnd, s2pi_slave_t spi_slave)
Initializes the device with default measurement mode.
argus_dca_gain_t GainMax
Definition: argus_dca.h:508
@ ARGUS_MODE_HIGH_PRECISION_SHORT_RANGE
Definition: argus_def.h:294
q0_15_t Table[ARGUS_DCA_POWER_STAGE_COUNT][ARGUS_PIXELS_X][ARGUS_PIXELS_Y]
Definition: argus_offset.h:69
@ ARGUS_MODE_SHORT_RANGE_LASER_CLASS_2
Definition: argus_def.h:298
status_t Argus_EvaluateData(argus_hnd_t *hnd, argus_results_t *res)
Evaluates measurement data from the raw sensor readout data.
uint8_t uq0_8_t
Unsigned fixed point number: UQ0.8.
Definition: fp_def.h:162
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.
int8_t RangeWindow
Definition: argus_px.h:149
status_t S2PI_CaptureGpioControl(s2pi_slave_t slave)
Captures the S2PI pins for GPIO usage.
#define ARGUS_DFM_FRAME_COUNT
Definition: argus_dfm.h:64
uint8_t DisablePowerSaveInLowPowerStage
Definition: argus_dca.h:531
@ SNM_MODE_STATIC_OUTDOOR
Definition: argus_snm.h:76
void handle_error(status_t status, char const *msg)
A very brief example for error handling.
Definition: main.c:265
@ SNM_MODE_DYNAMIC
Definition: argus_snm.h:80
uq12_4_t Amplitude
Definition: argus_px.h:141
@ SNM_MODE_STATIC_INDOOR
Definition: argus_snm.h:71
@ ARGUS_MODE_HIGH_SPEED_SHORT_RANGE
Definition: argus_def.h:286
argus_dca_power_t Power
Definition: argus_dca.h:448
status_t Argus_InitMode(argus_hnd_t *hnd, s2pi_slave_t spi_slave, argus_mode_t mode)
Initializes the device with specified measurement mode.
@ ARGUS_MODE_SHORT_RANGE
Definition: argus_def.h:278
status_t S2PI_Abort(s2pi_slave_t slave)
Terminates a currently ongoing asynchronous SPI transfer.
status_t S2PI_GetStatus(s2pi_slave_t slave)
Returns the status of the SPI module.
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.
argus_dca_gain_t GainMin
Definition: argus_dca.h:500
status_t S2PI_TryGetMutex(s2pi_slave_t slave)
Tries to grab the SPI interface mutex for the next transfer.
uint16_t uq12_4_t
Unsigned fixed point number: UQ12.4.
Definition: fp_def.h:231
int32_t q9_22_t
Signed fixed point number: Q9.22.
Definition: fp_def.h:538
q0_15_t LowPower[ARGUS_PIXELS_X][ARGUS_PIXELS_Y]
Definition: argus_offset.h:60
Pixel Range Offset Table.
Definition: argus_offset.h:54
uq12_4_t AthLow
Definition: argus_dca.h:430
argus_dca_gain_t GainNom
Definition: argus_dca.h:492
uq1_15_t Phase
Definition: argus_px.h:137
status_t Argus_TriggerMeasurement(argus_hnd_t *hnd, argus_measurement_ready_callback_t cb)
Triggers a single measurement frame asynchronously.
@ ARGUS_MODE_FLAG_LASER_CLASS_2
Definition: argus_def.h:257
uint16_t uq10_6_t
Unsigned fixed point number: UQ10.6.
Definition: fp_def.h:251
The debug data of measurement results data structure.
Definition: argus_res.h:143
@ SNM_MODE_DYNAMIC_PLUS
Definition: argus_snm.h:85
struct argus_hnd_t argus_hnd_t
Definition: argus_def.h:320
argus_snm_mode_t
Definition: argus_snm.h:65
@ ARGUS_MODE_FLAG_SHORT_RANGE
Definition: argus_def.h:245
status_t Argus_SetConfigurationFrameTime(argus_hnd_t *hnd, uint32_t value)
Sets the frame time to a specified device.
#define SPI_SLAVE
Definition: examples.h:103
argus_dca_enable_t Enabled
Definition: argus_dca.h:376
uq10_6_t DepthMin_LowPower
Definition: argus_dca.h:466
Pixel Crosstalk Compensation Vector.
Definition: argus_xtalk.h:57
@ ARGUS_MODE_LONG_RANGE
Definition: argus_def.h:282
The measurement results data structure.
Definition: argus_res.h:215
argus_mode_t Argus_GetDefaultMeasurementMode(argus_module_version_t module)
Gets the default measurement mode for a specified module type.
uint8_t SatPxThLin
Definition: argus_dca.h:389
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.
bool Argus_IsDataEvaluationPending(argus_hnd_t *hnd)
Determines whether a data evaluation is pending.
status_t(* argus_measurement_ready_callback_t)(status_t status, argus_hnd_t *hnd)
Measurement Ready API callback function.
Definition: argus_def.h:351
int32_t s2pi_slave_t
Definition: argus_api.h:67
q9_22_t Range
Definition: argus_px.h:134
@ STATUS_OK
Definition: argus_status.h:80
Pixel Crosstalk Vector Table.
Definition: argus_xtalk.h:76
uq12_4_t UncorrelatedNoise
Definition: argus_px.h:155
@ DFM_MODE_OFF
Definition: argus_dfm.h:73
int16_t q0_15_t
Signed fixed point number: Q0.15.
Definition: fp_def.h:381
@ ARGUS_MODE_HIGH_PRECISION_SHORT_RANGE_LASER_CLASS_2
Definition: argus_def.h:314
q0_15_t HighPower[ARGUS_PIXELS_X][ARGUS_PIXELS_Y]
Definition: argus_offset.h:64
@ ARGUS_MODE_LONG_RANGE_LASER_CLASS_2
Definition: argus_def.h:302
#define ARGUS_DCA_POWER_STAGE_COUNT
Definition: argus_dca.h:116
status_t Argus_ResetMeasurementMode(argus_hnd_t *hnd)
Resets the measurement mode to a specified device.
status_t Argus_SetMeasurementMode(argus_hnd_t *hnd, argus_mode_t mode)
Sets the measurement mode to a specified device.
The evaluated measurement results per pixel.
Definition: argus_px.h:130
@ ARGUS_MODE_FLAG_HIGH_PRECISION
Definition: argus_def.h:254
status_t Argus_GetMeasurementMode(argus_hnd_t *hnd, argus_mode_t *mode)
Gets the measurement mode from a specified device.
#define ARGUS_PIXELS_Y
The device pixel field size in y direction (short edge).
Definition: argus_def.h:77
uq12_4_t SNR
Definition: argus_px.h:158
status_t Argus_StartMeasurementTimer(argus_hnd_t *hnd, argus_measurement_ready_callback_t cb)
Starts the timer based measurement cycle asynchronously.
@ ARGUS_MODE_HIGH_SPEED_LONG_RANGE
Definition: argus_def.h:290
argus_px_status_t
Status flags for the evaluated pixel structure.
Definition: argus_px.h:75
argus_module_version_t
The AFBR-S50 module types.
Definition: argus_def.h:92
status_t S2PI_ReleaseGpioControl(s2pi_slave_t slave)
Releases the S2PI pins from GPIO usage and switches back to SPI mode.
#define ARGUS_PIXELS_X
The device pixel field size in x direction (long edge).
Definition: argus_def.h:72
uq12_4_t Atarget
Definition: argus_dca.h:422
argus_dca_power_t
The dynamic configuration algorithm Optical Output Power stages enumerator.
Definition: argus_dca.h:169
uq10_6_t DepthMax
Definition: argus_dca.h:484
@ ARGUS_MODE_FLAG_HIGH_SPEED
Definition: argus_def.h:251
uq12_4_t AthHigh
Definition: argus_dca.h:439
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_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_SetCalibrationCrosstalkVectorTable(argus_hnd_t *hnd, argus_cal_xtalk_table_t const *value)
Sets the custom crosstalk vector table to a specified device.
uq10_6_t DepthNom
Definition: argus_dca.h:456
status_t Argus_SetConfigurationSmartPowerSaveEnabled(argus_hnd_t *hnd, bool value)
Sets the smart power save enabled flag to a specified device.
uint8_t SatPxThRst
Definition: argus_dca.h:413
static status_t status
Definition: argus_xtalk_cal_cli.c:140
uq12_4_t AmplitudeRaw
Definition: argus_px.h:152
uq0_8_t PowerSavingRatio
Definition: argus_dca.h:527
uint8_t SatPxThExp
Definition: argus_dca.h:400
argus_dca_gain_t
The dynamic configuration algorithm Pixel Input Gain stages enumerator.
Definition: argus_dca.h:185
argus_dca_enable_t
The dynamic configuration algorithm enable flags.
Definition: argus_dca.h:134
void S2PI_ReleaseMutex(s2pi_slave_t slave)
Releases the SPI interface mutex.
int32_t status_t
Type used for all status and error return values.
Definition: argus_status.h:70
argus_mode_flags_t
The measurement mode flags.
Definition: argus_def.h:242
@ ARGUS_MODE_FLAG_LONG_RANGE
Definition: argus_def.h:248
@ ARGUS_MODE_HIGH_SPEED_SHORT_RANGE_LASER_CLASS_2
Definition: argus_def.h:306
uint16_t uq1_15_t
Unsigned fixed point number: UQ1.15.
Definition: fp_def.h:271