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 Examples

Example and Demo Projects for the AFBR-S50 API. More...

Collaboration diagram for AFBR-S50 API Examples:

Macros

#define API_EXAMPLE   1
 
#define RUN_HAL_TESTS   1
 
#define RUN_XTALK_CALIBRATION   0
 
#define SPI_SLAVE   1
 

Functions

void ExampleMain (void)
 Application entry point for the specified example.
 
void HandleError (status_t status, bool stop, char const *msg)
 A callback function from the example code whenever an error occurs.
 

Detailed Description

Example and Demo Projects for the AFBR-S50 API.


A series of example and demo projects that utilize the AFBR-S50 API in several ways.

The following example projects are available:

Warning
The example code provides is not intended to be used as a for production systems. It is intended to demonstrate the usage of the API and to provide a starting point for custom applications.

Macro Definition Documentation

◆ API_EXAMPLE

#define API_EXAMPLE   1

Selector for example:

◆ RUN_HAL_TESTS

#define RUN_HAL_TESTS   1

Selector for HAL test demo:

  • 0: no HAL tests are executed.
  • 1: HAL tests are executed before any API code is executed.

◆ RUN_XTALK_CALIBRATION

#define RUN_XTALK_CALIBRATION   0

Selector for XTALK calibration demo:

  • 0: no XTALK calibration is executed.
  • 1: XTALK calibration is executed before any API code is executed.

◆ SPI_SLAVE

Function Documentation

◆ ExampleMain()

void ExampleMain ( void  )

Application entry point for the specified example.

Test example configuration!


The main function of the specified example, called after startup code and hardware initialization.

This function will never be exited!

◆ HandleError()

void HandleError ( status_t  status,
bool  stop,
char const *  msg 
)

A callback function from the example code whenever an error occurs.


The example code calls this function whenever an unexpected error occurs, for example, if an API function returns an error code.

This implementation of the function will print the error message. If specified, the program execution will be stopped with an infinite loop. Otherwise, the program will continue to run and the error is printed and ignored.

Warning
This is only a simple example implementation that does not handle errors in a production system. It is intended to demonstrate the usage of the API and to provide a starting point for custom applications.

This function needs to be replaced with a more sophisticated implementation to handle errors in a production system. For example, it could reset the device or try to recover from the error by re-initializing the device.

Parameters
statusThe specified status to be checked for errors.
stopWhether to stop the program (e.g. in case of a critical error).
msgThe associated error message to be printed in case of errors.
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.