AFBR-S50 API Reference Manual  v1.6.5
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
examples.h
Go to the documentation of this file.
1 /*************************************************************************/
37 #ifndef ARGUS_EXAMPLE_H
38 #define ARGUS_EXAMPLE_H
39 
40 /*!***************************************************************************
41  * @defgroup example_apps AFBR-S50 API Examples
42  * @ingroup demo_apps
43  *
44  * @brief Example and Demo Projects for the AFBR-S50 API.
45  *
46  * @details A series of example and demo projects that utilize the AFBR-S50
47  * API in several ways.
48  *
49  * The following example projects are available:
50  *
51  * - 01_simple_example.c: Uses the API in the most straightforward
52  * way by invoking single measurements in a blocking manner.
53  *
54  * - 02_advanced_example.c: A more sophisticated example that
55  * utilizes a timer to trigger periodic measurements asynchronously
56  * from an interrupt service routine.
57  *
58  * - 03_high_speed_example.c: Demonstrates the high speed
59  * configuration of the device that allows measurement rates
60  * up to 3000 frames per second (depending on hardware!!).
61  *
62  * - 04_multi_device_example.c: Demonstrates the usage of multiple
63  * devices on a single MCU.
64  *
65  * - 05_simple_example_debug.c: Demonstrates how to obtain debug
66  * information.
67  *
68  * @warning The example code provides is not intended to be used as a for
69  * production systems. It is intended to demonstrate the usage of
70  * the API and to provide a starting point for custom applications.
71  *
72  * @addtogroup example_apps
73  * @{
74  *****************************************************************************/
75 
83 #ifndef API_EXAMPLE
84 #define API_EXAMPLE 1
85 #endif
86 
90 #ifndef RUN_HAL_TESTS
91 #define RUN_HAL_TESTS 1
92 #endif
93 
97 #ifndef RUN_XTALK_CALIBRATION
98 #define RUN_XTALK_CALIBRATION 0
99 #endif
100 
102 #ifndef SPI_SLAVE
103 #define SPI_SLAVE 1
104 #endif
105 
107 #if API_EXAMPLE < 1 || API_EXAMPLE > 6
108 #error The selected API_EXAMPLE is not available!
109 #endif
110 
111 #include "board/board.h"
112 #include "platform/argus_print.h" // declaration of print()
113 
114 /*!***************************************************************************
115  * @brief Application entry point for the specified example.
116  *
117  * @details The main function of the specified example, called after startup code
118  * and hardware initialization.
119  *
120  * This function will never be exited!
121  *****************************************************************************/
122 void ExampleMain(void);
123 
124 /*!***************************************************************************
125  * @brief A callback function from the example code whenever an error occurs.
126  *
127  * @details The example code calls this function whenever an unexpected error
128  * occurs, for example, if an API function returns an error code.
129  *
130  * This implementation of the function will print the error message.
131  * If specified, the program execution will be stopped with an
132  * infinite loop. Otherwise, the program will continue to run and the
133  * error is printed and ignored.
134  *
135  * @warning This is only a simple example implementation that does not handle
136  * errors in a production system. It is intended to demonstrate the
137  * usage of the API and to provide a starting point for custom
138  * applications.
139  *
140  * This function needs to be replaced with a more sophisticated
141  * implementation to handle errors in a production system.
142  * For example, it could reset the device or try to recover from
143  * the error by re-initializing the device.
144  *
145  * @param status The specified status to be checked for errors.
146  * @param stop Whether to stop the program (e.g. in case of a critical error).
147  * @param msg The associated error message to be printed in case of errors.
148  *****************************************************************************/
149 void HandleError(status_t status, bool stop, char const * msg);
150 
152 #endif /* ARGUS_EXAMPLE_H */
HandleError
void HandleError(status_t status, bool stop, char const *msg)
A callback function from the example code whenever an error occurs.
Definition: main.c:62
argus_print.h
This file is part of the AFBR-S50 API.
ExampleMain
void ExampleMain(void)
Application entry point for the specified example.
Definition: 01_simple_example.c:206
status
static status_t status
Definition: argus_xtalk_cal_cli.c:140
status_t
int32_t status_t
Type used for all status and error return values.
Definition: argus_status.h:70