srac_api.h

SPARK Ranging Core Application Programming Interface.

Copyright

Copyright (C) 2023 SPARK Microsystems International Inc. All rights reserved.

License

This source code is proprietary and subject to the SPARK Microsystems Software EULA found in this package in file EULA.txt.

Author

SPARK FW Team.

Defines

SRAC_DEFAULT_OFFSET_MM 1061400

Default calibration offset value (millimeters)

Typedefs

typedef struct srac_data srac_data_t

Phases value, last received preamble phase correlation data.

typedef struct srac_data_set srac_data_set_t

Phases value, last received preamble phase correlation data.

Functions

uint32_t srac_process_distance(srac_data_set_t *ranging_data, uint8_t sample_count, uint32_t calibration_offset, srac_error_t *err)

Calculate distance from provided data.

Parameters:
  • ranging_data[in] Ranging data buffer.

  • sample_count[in] SPARK Ranging Core sample count.

  • calibration_offset[in] Distance calibration offset.

  • err[out] Ranging Core error code.

Returns:

Distance in centimeters.

uint32_t srac_calibrate(srac_data_set_t *ranging_data, uint8_t sample_count, srac_error_t *err)

Calibrate distance measurement at a predefined distance of 50 cm between both devices.

Note

Distance is calculated without any offset and then the calibration value is determined.

Parameters:
  • ranging_data[in] Ranging data buffer.

  • sample_count[in] SPARK Ranging Core sample count.

  • err[out] Ranging Core error code.

Returns:

Calibration offset in centimeters.

struct srac_data
#include <srac_api.h>

Phases value, last received preamble phase correlation data.

Public Members

uint8_t receiver_waited_time_1

Receiver waited time (MSB)

uint8_t receiver_waited_time_0

Receiver waited time (LSB)

int8_t phase_correlation_metric_1

phase correlation metric 1

int8_t phase_correlation_metric_2

phase correlation metric 2

int8_t phase_correlation_metric_3

phase correlation metric 3

int8_t phase_correlation_metric_4

phase correlation metric 4

struct srac_data_set
#include <srac_api.h>

Phases value, last received preamble phase correlation data.

Public Members

srac_data_t local_data

Local ranging data

srac_data_t remote_data

Remote ranging data