AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
Loading...
Searching...
No Matches
AFBR-S50 API

The main module of the API from the AFBR-S50 SDK. More...

Collaboration diagram for AFBR-S50 API:

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.
 

Enumerations

enum  argus_module_version_t {
  MODULE_NONE = 0 ,
  AFBR_S50MV85G_V1 = 0x01 ,
  AFBR_S50MV85G_V2 = 0x02 ,
  AFBR_S50LV85D_V1 = 0x03 ,
  AFBR_S50MV68B_V1 = 0x04 ,
  AFBR_S50MV85I_V1 = 0x05 ,
  AFBR_S50SV85K_V1 = 0x06 ,
  AFBR_S50MV85G_V3 = 0x07 ,
  AFBR_S50LX85D_V1 = AFBR_S50LV85D_V1 | MODULE_EXTENDED_FLAG ,
  AFBR_S50MX68B_V1 = AFBR_S50MV68B_V1 | MODULE_EXTENDED_FLAG ,
  AFBR_S50MX85I_V1 = AFBR_S50MV85I_V1 | MODULE_EXTENDED_FLAG ,
  AFBR_S50SX85K_V1 = AFBR_S50SV85K_V1 | MODULE_EXTENDED_FLAG ,
  AFBR_S50MX85G_V1 = AFBR_S50MV85G_V3 | MODULE_EXTENDED_FLAG
}
 The AFBR-S50 module types. More...
 
enum  argus_laser_type_t {
  LASER_NONE = 0 ,
  LASER_H_V1 = 1 ,
  LASER_H_V2 = 2 ,
  LASER_R_V1 = 3 ,
  LASER_H_V2X = 4 ,
  LASER_R_V1X = 5
}
 The AFBR-S50 laser configurations. More...
 
enum  argus_chip_version_t {
  ADS0032_NONE = 0 ,
  ADS0032_V1A = 1 ,
  ADS0032_V1B = 2 ,
  ADS0032_V1C = 3 ,
  ADS0032_V1D = 4 ,
  ADS0032_V1E = 5
}
 The AFBR-S50 chip versions. More...
 
enum  argus_mode_flags_t {
  ARGUS_MODE_FLAG_SHORT_RANGE = 0x01 << 0 ,
  ARGUS_MODE_FLAG_LONG_RANGE = 0x01 << 1 ,
  ARGUS_MODE_FLAG_HIGH_SPEED = 0x01 << 2
}
 The measurement mode flags. More...
 
enum  argus_mode_t {
  ARGUS_MODE_SHORT_RANGE ,
  ARGUS_MODE_LONG_RANGE ,
  ARGUS_MODE_HIGH_SPEED_SHORT_RANGE ,
  ARGUS_MODE_HIGH_SPEED_LONG_RANGE
}
 The measurement modes. More...
 

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_tArgus_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.
 

Detailed Description

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


Macro Definition Documentation

◆ ARGUS_PHASECOUNT

#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.

◆ ARGUS_PIXELS

#define ARGUS_PIXELS   ((ARGUS_PIXELS_X)*(ARGUS_PIXELS_Y))

The total device pixel count.


◆ ARGUS_PIXELS_X

#define ARGUS_PIXELS_X   8

The device pixel field size in x direction (long edge).


◆ ARGUS_PIXELS_Y

#define ARGUS_PIXELS_Y   4

The device pixel field size in y direction (short edge).


◆ MODULE_EXTENDED_FLAG

#define MODULE_EXTENDED_FLAG   (0x40U)

A flag indicating that the device is a extended range device.


Typedef Documentation

◆ argus_hnd_t

typedef struct argus_hnd_t argus_hnd_t

The data structure for the API representing a AFBR-S50 device instance.

◆ argus_measurement_ready_callback_t

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.

Warning
Since the callback is called from an interrupt context, the callback execution must return as fast as possible. The usual task in the callback is to post an event to the main thread to inform it about the new data and that is must call the Argus_EvaluateData function.
Parameters
statusThe module status that caused the callback. STATUS_OK if everything was as expected.
hndThe 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.
Returns
Returns the status (STATUS_OK on success).

◆ s2pi_slave_t

typedef int32_t s2pi_slave_t

The S2PI slave identifier.

Enumeration Type Documentation

◆ argus_chip_version_t

The AFBR-S50 chip versions.


Enumerator
ADS0032_NONE 

No device connected or not recognized.

ADS0032_V1A 

ADS0032 v1a

ADS0032_V1B 

ADS0032 v1b

ADS0032_V1C 

ADS0032 v1c

ADS0032_V1D 

ADS0032 v1d

ADS0032_V1E 

ADS0032 v1e

◆ argus_laser_type_t

The AFBR-S50 laser configurations.


Enumerator
LASER_NONE 

No laser connected.

LASER_H_V1 

850nm Infra-Red VCSEL v1

LASER_H_V2 

850nm Infra-Red VCSEL v2

LASER_R_V1 

680nm Red VCSEL v1

LASER_H_V2X 

850nm Infra-Red VCSEL v2 /w extended mode.

LASER_R_V1X 

680nm Red VCSEL v1 w/ extended mode.

◆ 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.

  • Bit 0: Short Range Mode
  • Bit 1: Long Range Mode
  • Bit 2: High Speed Mode

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.

Enumerator
ARGUS_MODE_FLAG_SHORT_RANGE 

Measurement Mode Flag for Short Range Base Mode.

ARGUS_MODE_FLAG_LONG_RANGE 

Measurement Mode Flag for Long Range Base Mode.

ARGUS_MODE_FLAG_HIGH_SPEED 

Measurement Mode Flag for High Speed Mode.

◆ 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:

  • Bit 0: Short Range Mode
  • Bit 1: Long Range Mode
  • Bit 2: High Speed Mode

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!

Enumerator
ARGUS_MODE_SHORT_RANGE 

Measurement Mode: Short Range Mode.

ARGUS_MODE_LONG_RANGE 

Measurement Mode: Long Range Mode.

ARGUS_MODE_HIGH_SPEED_SHORT_RANGE 

Measurement Mode: High Speed Short Range Mode.

ARGUS_MODE_HIGH_SPEED_LONG_RANGE 

Measurement Mode: High Speed Long Range Mode.

◆ argus_module_version_t

The AFBR-S50 module types.


Enumerator
MODULE_NONE 

No device connected or not recognized.

AFBR_S50MV85G_V1 

AFBR-S50MV85G: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for medium range 3D applications. Version 1 - legacy version!

AFBR_S50MV85G_V2 

AFBR-S50MV85G: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for medium range 3D applications. Version 2 - legacy version!

AFBR_S50LV85D_V1 

AFBR-S50LV85D: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for long range 1D applications. Version 1 - current version!

AFBR_S50MV68B_V1 

AFBR-S50MV68B: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and red, 680 nm, laser source for medium range 1D applications. Version 1 - current version!

AFBR_S50MV85I_V1 

AFBR-S50MV85I: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for medium range 3D applications. Version 1 - current version!

AFBR_S50SV85K_V1 

AFBR-S50MV85G: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for short range 3D applications. Version 1 - current version!

AFBR_S50MV85G_V3 

AFBR-S50MV85G: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for medium range 3D applications. Version 3 - current version!

AFBR_S50LX85D_V1 

AFBR-S50LX85D: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for extended long range 1D applications. Version 1 - current version!

AFBR_S50MX68B_V1 

AFBR-S50MX68B: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and red, 680 nm, laser source for extended medium range 1D applications. Version 1 - current version!

AFBR_S50MX85I_V1 

AFBR-S50MX85I: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for extended medium range 3D applications. Version 1 - current version!

AFBR_S50SX85K_V1 

AFBR-S50MX85G: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for extended short range 3D applications. Version 1 - current version!

AFBR_S50MX85G_V1 

AFBR-S50MX85G: an ADS0032 based multi-pixel range finder device w/ 4x8 pixel matrix and infra-red, 850 nm, laser source for extended medium range 3D applications. Version 1 - current version!

Function Documentation

◆ Argus_CreateHandle()

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:

void * malloc(size_t size)

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. *

void * Argus_Malloc (size_t size)

Also see the Argus_DestroyHandle method for the corresponding deallocation of the allocated memory.

Note
Although the method is using memory allocated on the heap, it is eventually no dynamic memory allocation, since the block of memory is kept all the time and no memory blocks are dynamically freed and re-allocated. If the usage of heap must be avoided, one can always implement its own version of the Argus_Malloc function to create the memory elsewhere.
Returns
Returns a pointer to the newly allocated device handler object. Returns a null pointer if the allocation failed!
Examples
01_simple_example.c, 01_simple_example_with_hal_self_test.c, 02_advanced_example.c, 02_advanced_example_with_hal_self_test.c, 03_high_speed_example.c, 04_multi_device_example.c, and 05_simple_example_debug.c.

◆ Argus_Deinit()

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.

Parameters
hndThe API handle; contains all internal states and data.
Returns
Returns the status (STATUS_OK on success).

◆ Argus_DestroyHandle()

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,

void free(void * ptr)

. 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.

void Argus_Free (void * ptr)

Also see the Argus_CreateHandle method for the corresponding allocation of the required memory.

Parameters
hndThe device handle object to be deallocated.
Returns
Returns the status (STATUS_OK on success).

◆ Argus_GetAPIVersion()

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:

  • [ 31 .. 24 ] - Major Version Number
  • [ 23 .. 16 ] - Minor Version Number
  • [ 15 .. 0 ] - Bugfix Version Number

To obtain the parts from the returned uin32_t value:

uint32_t value = Argus_GetAPIVersion();
uint8_t a = (value >> 24) & 0xFFU;
uint8_t b = (value >> 16) & 0xFFU;
uint8_t c = value & 0xFFFFU;
uint32_t Argus_GetAPIVersion(void)
Gets the version number of the current API library.
Returns
Returns the current version number.
Examples
01_simple_example.c, 01_simple_example_with_hal_self_test.c, 02_advanced_example.c, 02_advanced_example_with_hal_self_test.c, 03_high_speed_example.c, 04_multi_device_example.c, and 05_simple_example_debug.c.

◆ Argus_GetBuildNumber()

char const * Argus_GetBuildNumber ( void  )

Gets the build number of the current API library.


Returns
Returns the current build number as a C-string.

◆ Argus_GetChipID()

uint32_t Argus_GetChipID ( argus_hnd_t hnd)

Gets the unique identification number of the chip.


Parameters
hndThe API handle; contains all internal states and data.
Returns
Returns the unique identification number.
Examples
01_simple_example.c, 01_simple_example_with_hal_self_test.c, 02_advanced_example.c, 02_advanced_example_with_hal_self_test.c, 03_high_speed_example.c, 04_multi_device_example.c, and 05_simple_example_debug.c.

◆ Argus_GetChipVersion()

argus_chip_version_t Argus_GetChipVersion ( argus_hnd_t hnd)

Gets the version number of the chip.


Parameters
hndThe API handle; contains all internal states and data.
Returns
Returns the current version number.

◆ Argus_GetLaserType()

argus_laser_type_t Argus_GetLaserType ( argus_hnd_t hnd)

Gets the type number of the device laser.


Parameters
hndThe API handle; contains all internal states and data.
Returns
Returns the current device laser type number.

◆ Argus_GetModuleName()

char const * Argus_GetModuleName ( argus_hnd_t hnd)

Gets the name string of the module.


Parameters
hndThe API handle; contains all internal states and data.
Returns
Returns the current module name.
Examples
01_simple_example.c, 01_simple_example_with_hal_self_test.c, 02_advanced_example.c, 02_advanced_example_with_hal_self_test.c, 03_high_speed_example.c, 04_multi_device_example.c, and 05_simple_example_debug.c.

◆ Argus_GetModuleVersion()

argus_module_version_t Argus_GetModuleVersion ( argus_hnd_t hnd)

Gets the version/variant of the module.


Parameters
hndThe API handle; contains all internal states and data.
Returns
Returns the current module number.

◆ Argus_GetSPISlave()

s2pi_slave_t Argus_GetSPISlave ( argus_hnd_t hnd)

Gets the SPI hardware slave identifier.


Parameters
hndThe API handle; contains all internal states and data.
Returns
The SPI hardware slave identifier.

◆ Argus_Init()

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:

  • Initialization of the internal state represented by the handle object.
  • Setup the device such that an safe configuration is present in the registers.
  • Initialize sub modules such as calibration or measurement modules.

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.

Parameters
hndThe API handle; contains all internal states and data.
spi_slaveThe 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.
Returns
Returns the status (STATUS_OK on success).
Examples
01_simple_example.c, 01_simple_example_with_hal_self_test.c, 02_advanced_example.c, 02_advanced_example_with_hal_self_test.c, 04_multi_device_example.c, and 05_simple_example_debug.c.

◆ Argus_InitMode()

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:

  • Initialization of the internal state represented by the handle object.
  • Setup the device such that an safe configuration is present in the registers.
  • Initialize sub modules such as calibration or measurement modules.

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.

Parameters
hndThe API handle; contains all internal states and data.
spi_slaveThe 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.
modeThe specified measurement mode to be initialized. Pass 0 as special value to select default measurement mode (see Argus_Init).
Returns
Returns the status (STATUS_OK on success).
Examples
03_high_speed_example.c.

◆ Argus_Reinit()

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.

Note
If a full re-initialization is not desired, refer to the Argus_RestoreDeviceState function that will only re-write the register map to the device to restore its state after an power cycle.
Parameters
hndThe API handle; contains all internal states and data.
Returns
Returns the status (STATUS_OK on success).

◆ Argus_ReinitMode()

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.

Note
If a full re-initialization is not desired, refer to the Argus_RestoreDeviceState function that will only re-write the register map to the device to restore its state after an power cycle.
Parameters
hndThe API handle; contains all internal states and data.
modeThe specified measurement mode to be initialized. Pass 0 as special value to select the current measurement mode (see Argus_Init).
Returns
Returns the status (STATUS_OK on success).

◆ Argus_RestoreDeviceState()

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:

  1. In case of ongoing measurements, stop the measurements via the Argus_StopMeasurementTimer function (if started by the Argus_StartMeasurementTimer function).
  2. Shut down the device by removing the 5V power supply, e.g. via a GPIO pin that switches a MOSFET circuit.
  3. After the desired sleep period, power the device by switching the 5V power supply on again. Wait until the power-on-reset (POR) is finished (approx. 1 ms) or just repeat step 4 until it succeeds.
  4. Call the Argus_RestoreDeviceState function to trigger the restoration of the device state in the API. Note that the function will return an error code if it fails. One can repeat the execution of that function a few times until it succeeds.
  5. Continue with measurements via Argus_StartMeasurementTimer of Argus_TriggerMeasurement functions as desired.
Note
If a complete re-initialization (= soft-reset) is desired, see the Argus_Reinit functionality.
Changing a configuration or calibration parameter will always invalidate the device state as well as the state machine of the dynamic configuration adaption (DCA) algorithm. In that case, the device/API needs a few measurements to adopt to the present environmental conditions before the first valid measurement result can be obtained. This is almost similar to re-initializing the device (see Argus_Reinit) which would also re-read the EEPROM. On the other hand, the Argus_RestoreDeviceState does not reset or re-initialize anything. It just makes sure that the device register map (which has changed to its reset values after the power cycle) is what the API expects upon the next measurement.
Parameters
hndThe device handle object to be invalidated.
Returns
Returns the status (STATUS_OK on success).