AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
|
AFBR-S50 Reference Board CAN-bus example application. More...
Modules | |
CAN API interface | |
CAN interface for the AFBR-S50 Reference Board CAN application. | |
CAN Application Version | |
AFBR-S50 CAN Application version number. | |
UART API interface | |
UART interface for the AFBR-S50 Reference Board CAN application. | |
Macros | |
#define | SPI_SLAVE 1 |
#define | SPI_BAUD_RATE 6000000 |
Functions | |
static void | print_help (void) |
Prints a help string to the serial interface. | |
status_t | measurement_ready_callback (status_t status, argus_hnd_t *device) |
Measurement data ready callback function. | |
int | main (void) |
Application entry point. | |
void | start_measurements (void) |
Starts measurements via the AFBR-S50 API. | |
void | stop_measurements (void) |
Stops the currently ongoing measurements via the AFBR-S50 API. | |
void | handle_error (status_t status, char const *msg) |
A very brief example for error handling. | |
Variables | |
static volatile uint8_t | myDataReadyEvents = 0 |
argus_hnd_t * | hnd = 0 |
AFBR-S50 Reference Board CAN-bus example application.
This is the CAN interface example application that can be run in the AFBR-S50 Reference Board by MikroElektronika based on the Renesas RA4M2 micro controller.
The application provides a simple CAN interface as an reference for the customers own implementation.
See the following documentation for more information:
#define SPI_BAUD_RATE 6000000 |
Define the SPI baud rate (to be used in the SPI module).
#define SPI_SLAVE 1 |
Define the SPI slave (to be used in the SPI module).
void handle_error | ( | status_t | status, |
char const * | msg | ||
) |
A very brief example for error handling.
Checks the specified status for errors (i.e. negative values) and prints a specified error message if any. An endless loop is entered to halt program execution.
status | The specified status to be checked for errors. |
msg | The associated error message to be printed in case of errors. |
int main | ( | void | ) |
Application entry point.
The main function of the program, called after startup code This function should never be exited.
status_t measurement_ready_callback | ( | status_t | status, |
argus_hnd_t * | device | ||
) |
|
static |
Prints a help string to the serial interface.
void start_measurements | ( | void | ) |
Starts measurements via the AFBR-S50 API.
The measurements are started via the AFBR-S50 API using the current device configuration. Nothing happens if the device is already executing measurements.
In case of error, the handle_error method is called.
void stop_measurements | ( | void | ) |
Stops the currently ongoing measurements via the AFBR-S50 API.
The measurements are stopped via the AFBR-S50 API. Nothing happens if the device does not currently execute measurements.
In case of error, the handle_error method is called.
argus_hnd_t* hnd = 0 |
The AFBR-S50 Data Handle.
|
static |
Global measurement data ready event counter.
Determines the number of measurement data ready events happened and thus the number of timer the Argus_EvaluateData function must be called to free API internal date structures that buffer the raw sensor readout data.
The Argus_EvaluateData function must be called outside of the interrupt callback scope (i.e. from the main thread/task) to avoid huge delays due to the heavy data evaluation.
Note that the Argus_EvaluateData function must be called once for each callback event since it clears the internal state of the raw data buffer. If not called, the API gets stuck waiting for the raw data buffer to be freed and ready to be filled with new measurement data.
In automatic measurement mode, i.e. if the measurements are automatically triggered on a time based schedule from the periodic interrupt timer (PIT), the callback may occur faster than the Argus_EvaluateData function gets called from the main thread/task. This usually happens at high frame rates or too much CPU load on the main thread/task. In that case, the API delays new measurements until the previous buffers are cleared. Since the API contains two distinct raw data buffers, this counter raises up to 2 in the worst case scenario.