AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
|
The main module of the API from the AFBR-S50 SDK. More...
Modules | |
Configuration | |
Device configuration parameter definitions and API functions. | |
Calibration | |
Device calibration parameter definitions and API functions. | |
Dynamic Configuration Adaption | |
Dynamic Configuration Adaption (DCA) parameter definitions and API functions. | |
Dual Frequency Mode | |
Dual Frequency Mode (DFM) parameter definitions and API functions. | |
Pixel Channel Mapping | |
Pixel Channel Mapping. | |
Measurement/Device Control | |
Measurement/Device control module. | |
Pixel Binning Algorithm | |
Pixel Binning Algorithm (PBA) parameter definitions and API functions. | |
Measurement Data | |
Measurement results data structures. | |
Shot Noise Monitor | |
Shot Noise Monitor (SNM) parameter definitions and API functions. | |
API Version | |
API and library core version number. | |
Macros | |
#define | ARGUS_PHASECOUNT 4 |
Maximum number of phases per measurement cycle. | |
#define | ARGUS_PIXELS_X 8 |
The device pixel field size in x direction (long edge). | |
#define | ARGUS_PIXELS_Y 4 |
The device pixel field size in y direction (short edge). | |
#define | ARGUS_PIXELS ((ARGUS_PIXELS_X)*(ARGUS_PIXELS_Y)) |
The total device pixel count. | |
#define | MODULE_EXTENDED_FLAG (0x40U) |
A flag indicating that the device is a extended range device. | |
Typedefs | |
typedef int32_t | s2pi_slave_t |
typedef struct argus_hnd_t | argus_hnd_t |
typedef status_t(* | argus_measurement_ready_callback_t) (status_t status, argus_hnd_t *hnd) |
Measurement Ready API callback function. | |
Functions | |
status_t | Argus_Init (argus_hnd_t *hnd, s2pi_slave_t spi_slave) |
Initializes the device with default measurement mode. | |
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_Reinit (argus_hnd_t *hnd) |
Reinitializes the device with the current measurement mode. | |
status_t | Argus_ReinitMode (argus_hnd_t *hnd, argus_mode_t mode) |
Reinitializes the device with a specified measurement mode. | |
status_t | Argus_Deinit (argus_hnd_t *hnd) |
Deinitializes the API modules and the device. | |
argus_hnd_t * | Argus_CreateHandle (void) |
Creates a new device data handle object to store all internal states. | |
status_t | Argus_DestroyHandle (argus_hnd_t *hnd) |
Destroys a given device data handle object. | |
status_t | Argus_RestoreDeviceState (argus_hnd_t *hnd) |
Restores the device state with a re-write of all register values. | |
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. | |
argus_module_version_t | Argus_GetModuleVersion (argus_hnd_t *hnd) |
Gets the version/variant of the module. | |
char const * | Argus_GetModuleName (argus_hnd_t *hnd) |
Gets the name string of the module. | |
argus_chip_version_t | Argus_GetChipVersion (argus_hnd_t *hnd) |
Gets the version number of the chip. | |
argus_laser_type_t | Argus_GetLaserType (argus_hnd_t *hnd) |
Gets the type number of the device laser. | |
uint32_t | Argus_GetChipID (argus_hnd_t *hnd) |
Gets the unique identification number of the chip. | |
s2pi_slave_t | Argus_GetSPISlave (argus_hnd_t *hnd) |
Gets the SPI hardware slave identifier. | |
The main module of the API from the AFBR-S50 SDK.
General API for the AFBR-S50 time-of-flight sensor device family.
See the Getting Started Guide for a detailed description on how to use the module/API.
Include files
#define ARGUS_PHASECOUNT 4 |
Maximum number of phases per measurement cycle.
The actual phase number is defined in the register configuration. However the software does only support a fixed value of 4 yet.
#define ARGUS_PIXELS ((ARGUS_PIXELS_X)*(ARGUS_PIXELS_Y)) |
The total device pixel count.
#define ARGUS_PIXELS_X 8 |
The device pixel field size in x direction (long edge).
#define ARGUS_PIXELS_Y 4 |
The device pixel field size in y direction (short edge).
#define MODULE_EXTENDED_FLAG (0x40U) |
A flag indicating that the device is a extended range device.
typedef struct argus_hnd_t argus_hnd_t |
The data structure for the API representing a AFBR-S50 device instance.
typedef status_t(* argus_measurement_ready_callback_t) (status_t status, argus_hnd_t *hnd) |
Measurement Ready API callback function.
Invoked by the API whenever a measurement cycle is finished and new data is ready to be evaluated via the Argus_EvaluateData API function. The callback is passed to the API via the Argus_TriggerMeasurement or Argus_StartMeasurementTimer API functions. The API passes the status of the currently finished measurement cycle to the callback as first parameters. The second parameter is a pointer the API handle structure. The latter is used to identify the calling instance of the API in case of multiple devices. Further it can be passed to the Argus_EvaluateData function.
status | The module status that caused the callback. STATUS_OK if everything was as expected. |
hnd | The API handle pointer to the calling instance. Identifies the instance of the API that was invoking the callback and thus the instance that must call the Argus_EvaluateData for. |
typedef int32_t s2pi_slave_t |
The S2PI slave identifier.
enum argus_chip_version_t |
enum argus_laser_type_t |
enum argus_mode_flags_t |
The measurement mode flags.
The measurement mode flags that can be combined to a measurement mode, e.g. high speed short range mode. See argus_mode_t for a complete list of available measurement modes.
Note that the Long and Short Range Flags are mutual exclusive but any of those 2 must be set. Thus the value 0 is invalid! All other flags enhance the base configurations, e.g. the High Speed flag create the high speed mode of the selected base measurement mode.
enum argus_mode_t |
The measurement modes.
The measurement modes are composed in binary from of the flags define in argus_mode_flags_t, i.e. each bit has a special meaning:
Note that the Long and Short Range Bits are mutual exclusive but any of those 2 must be set. Thus the value 0 is invalid!
The AFBR-S50 module types.
argus_hnd_t * Argus_CreateHandle | ( | void | ) |
Creates a new device data handle object to store all internal states.
The function must be called to obtain a new device handle object. The handle is basically an abstract object in memory that contains all the internal states and settings of the API module. The handle is passed to all the API methods in order to address the specified device. This allows to use the API with more than a single measurement device.
The handler is created by calling the memory allocation method from the standard library:
In order to implement an individual memory allocation method, define and implement the following weakly binded method and return a pointer to the newly allocated memory. *
Also see the Argus_DestroyHandle method for the corresponding deallocation of the allocated memory.
Argus_Malloc
function to create the memory elsewhere.status_t Argus_Deinit | ( | argus_hnd_t * | hnd | ) |
Deinitializes the API modules and the device.
The function deinitializes the device and clear all internal states. Can be used to cleanup before releasing the memory. The device can not be used any more and must be initialized again prior to next usage.
Note that the Argus_Init function must be called first! Otherwise, the function will return an error if it is called for an yet uninitialized device/handle.
hnd | The API handle; contains all internal states and data. |
status_t Argus_DestroyHandle | ( | argus_hnd_t * | hnd | ) |
Destroys a given device data handle object.
The function can be called to free the previously created device data handle object in order to save memory when the device is not used any more.
Note that the handle must be deinitialized before it can be destroyed. The function returns ERROR_FAIL if the handle is not yet deinitialized.
Please refer to the Argus_CreateHandle method for the corresponding allocation of the memory.
The handler is destroyed by freeing the corresponding memory with the method from the standard library,
. In order to implement an individual memory deallocation method, define and implement the following weakly binded method and free the memory object passed to the method by a pointer.
Also see the Argus_CreateHandle method for the corresponding allocation of the required memory.
hnd | The device handle object to be deallocated. |
uint32_t Argus_GetAPIVersion | ( | void | ) |
Gets the version number of the current API library.
Generic API
The version is compiled of a major (a), minor (b) and bugfix (c) number: a.b.c.
The values are encoded into a 32-bit value:
To obtain the parts from the returned uin32_t value:
char const * Argus_GetBuildNumber | ( | void | ) |
Gets the build number of the current API library.
uint32_t Argus_GetChipID | ( | argus_hnd_t * | hnd | ) |
Gets the unique identification number of the chip.
hnd | The API handle; contains all internal states and data. |
argus_chip_version_t Argus_GetChipVersion | ( | argus_hnd_t * | hnd | ) |
Gets the version number of the chip.
hnd | The API handle; contains all internal states and data. |
argus_laser_type_t Argus_GetLaserType | ( | argus_hnd_t * | hnd | ) |
Gets the type number of the device laser.
hnd | The API handle; contains all internal states and data. |
char const * Argus_GetModuleName | ( | argus_hnd_t * | hnd | ) |
Gets the name string of the module.
hnd | The API handle; contains all internal states and data. |
argus_module_version_t Argus_GetModuleVersion | ( | argus_hnd_t * | hnd | ) |
Gets the version/variant of the module.
hnd | The API handle; contains all internal states and data. |
s2pi_slave_t Argus_GetSPISlave | ( | argus_hnd_t * | hnd | ) |
Gets the SPI hardware slave identifier.
hnd | The API handle; contains all internal states and data. |
status_t Argus_Init | ( | argus_hnd_t * | hnd, |
s2pi_slave_t | spi_slave | ||
) |
Initializes the device with default measurement mode.
The function that needs to be called once after power up to initialize the modules state (i.e. the corresponding handle) and the dedicated Time-of-Flight device. In order to obtain a handle, reference the Argus_CreateHandle method.
Prior to calling the function, the required peripherals (i.e. S2PI, GPIO w/ IRQ and Timers) must be initialized and ready to use.
The function executes the following tasks:
The modules configuration is initialized with reasonable default values. Note that the default measurement mode depends on the given device.
Also refer to Argus_InitMode, which uses an specified measurement mode instead of the dedicated default measurement mode.
hnd | The API handle; contains all internal states and data. |
spi_slave | The SPI hardware slave, i.e. the specified CS and IRQ lines. This is actually just a number that is passed to the SPI interface to distinct for multiple SPI slave devices. Note that the slave must be not equal to 0, since is reserved for error handling. |
status_t Argus_InitMode | ( | argus_hnd_t * | hnd, |
s2pi_slave_t | spi_slave, | ||
argus_mode_t | mode | ||
) |
Initializes the device with specified measurement mode.
The function that needs to be called once after power up to initialize the modules state (i.e. the corresponding handle) and the dedicated Time-of-Flight device. In order to obtain a handle, reference the Argus_CreateHandle method.
Prior to calling the function, the required peripherals (i.e. S2PI, GPIO w/ IRQ and Timers) must be initialized and ready to use.
The function executes the following tasks:
The modules configuration is initialized with reasonable default values.
Also refer to Argus_Init, which uses the dedicated default measurement mode instead of an user specified measurement mode.
hnd | The API handle; contains all internal states and data. |
spi_slave | The SPI hardware slave, i.e. the specified CS and IRQ lines. This is actually just a number that is passed to the SPI interface to distinct for multiple SPI slave devices. Note that the slave must be not equal to 0, since is reserved for error handling. |
mode | The specified measurement mode to be initialized. Pass 0 as special value to select default measurement mode (see Argus_Init). |
status_t Argus_Reinit | ( | argus_hnd_t * | hnd | ) |
Reinitializes the device with the current measurement mode.
The function reinitializes the device with the currently active measurement mode.
This can be used as a soft reset for the device and API. See Argus_Init for more information on the initialization.
Note that the Argus_Init or Argus_InitMode function must be called first! Otherwise, the function will return an error if it is called for an yet uninitialized device/handle.
Also refer to Argus_ReinitMode, which uses a specified measurement mode instead of the currently active measurement mode.
hnd | The API handle; contains all internal states and data. |
status_t Argus_ReinitMode | ( | argus_hnd_t * | hnd, |
argus_mode_t | mode | ||
) |
Reinitializes the device with a specified measurement mode.
The function reinitializes the device with a specified (/p mode) measurement mode.
This can be used as a soft reset for the device and API. See Argus_InitMode for more information on the initialization.
Note that the Argus_Init or Argus_InitMode function must be called first! Otherwise, the function will return an error if it is called for an yet uninitialized device/handle.
Also refer to Argus_Reinit, which re-uses the currently active measurement mode instead of an user specified measurement mode.
hnd | The API handle; contains all internal states and data. |
mode | The specified measurement mode to be initialized. Pass 0 as special value to select the current measurement mode (see Argus_Init). |
status_t Argus_RestoreDeviceState | ( | argus_hnd_t * | hnd | ) |
Restores the device state with a re-write of all register values.
The function invalidates and restores the device state by executing a re-write of the full register map.
The purpose of this function is to recover from known external events like power cycles, for example due to sleep / wake-up functionality. This can be implemented by cutting off the external power supply of the device (e.g. via a MOSFET switch controlled by a GPIB pin). By calling this function, the expected state of the API is written to the device without the need to fully re-initialize the device. Thus, the API can resume where it has stopped as if there has never been a power cycle.
The internal state machines like the dynamic configuration adaption (DCA) algorithm will not be reseted. The API/sensor will immediately resume at the last state that was optimized for the given environmental conditions.
The use case of sleep / wake-up can be implemented as follows:
hnd | The device handle object to be invalidated. |