AFBR-S50 API Reference Manual  v1.6.5
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
01_simple_example.c File Reference

This file is part of the AFBR-S50 SDK example application. More...

#include "examples.h"
#include "argus.h"
#include "platform/argus_print.h"
#include "argus_hal_test.h"
Include dependency graph for 01_simple_example.c:

Functions

static argus_hnd_tInitializeDevice (s2pi_slave_t slave)
 Creates and initializes a new device instance. More...
 
static void TriggerMeasurementBlocking (argus_hnd_t *device, argus_results_t *res)
 Triggers a measurement cycle in blocking manner. More...
 
static void PrintResults (argus_results_t const *res)
 Prints measurement results via UART. More...
 
static void PrintDeviceInfo (argus_hnd_t *device)
 Prints information about the initialized devices. More...
 
void ExampleMain (void)
 Application entry point for the simple example. More...
 

Detailed Description

This file is part of the AFBR-S50 SDK example application.

Copyright (c) 2023, Broadcom Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ InitializeDevice()

static argus_hnd_t* InitializeDevice ( s2pi_slave_t  slave)
static

Creates and initializes a new device instance.


Parameters
slaveThe SPI slave identifier number that is passed to the S2PI layers by the API whenever it calls a function.
Returns
The pointer to the handle of the created device instance. Used to identify the calling instance in case of multiple devices.
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, 05_simple_example_debug.c, and 06_low_power_example.c.

◆ PrintDeviceInfo()

static void PrintDeviceInfo ( argus_hnd_t device)
static

◆ PrintResults()

static void PrintResults ( argus_results_t const *  res)
static

Prints measurement results via UART.


Prints some measurement data via UART in the following format:

     ```
     123.456789 s; Range: 123456 mm;  Amplitude: 1234 LSB; Quality: 100;  Status: 0
     ```
Parameters
resA pointer to the latest measurement results structure.
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 06_low_power_example.c.

◆ TriggerMeasurementBlocking()

static void TriggerMeasurementBlocking ( argus_hnd_t device,
argus_results_t res 
)
static

Triggers a measurement cycle in blocking manner.


Parameters
deviceThe pointer to the handle of the calling API instance. Used to identify the calling instance in case of multiple devices.
resThe pointer to the results data structure where the final measurement results are stored.
Examples
01_simple_example.c, 01_simple_example_with_hal_self_test.c, 05_simple_example_debug.c, and 06_low_power_example.c.