ranging_base_fixed_point.h¶
Ranging module using fixed point instead of floating point unit.
- Copyright
Copyright (C) 2020 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
-
CLOCK_CYCLE_COMPARE 0.5¶
Functions
-
fp_format_t ranging_base_fixed_point_init(ranging_dynamic_constants_t *ranging_constants, uint8_t precision_bits, int32_t offset)¶
Initialize the fixed point ranging calculation.
This is used to compute the floating point constants to Q number representation to maximize efficiency during real time ranging computation.
- Parameters
ranging_constants – [in] Dynamic ranging constants structure.
precision_bits – [in] Number of precision bits.
offset – [in] Ranging offset for distance computation.
- Returns
Instance of fixed point object.
-
void ranging_base_get_propagation_delay_array_fixed_point(fp_format_t *ranging_fp_struct, ranging_dynamic_constants_t *ranging_constants, ranging_master_slave_info_t *ranging_data, uint16_t size, q_num_t *raw_prop_delay)¶
Get propagation delays given an array.
- Parameters
ranging_fp_struct – [in] Ranging fixed point instance.
ranging_constants – [in] Dynamic ranging constants structure.
ranging_data – [in] Ranging data array.
size – [in] Size of arrays.
raw_prop_delay – [out] Propagation delay array.
-
q_num_t ranging_base_calculate_average_fixed_point(fp_format_t *ranging_fp_struct, q_num_t *data, uint16_t size)¶
Get an average removing value below a threshold.
- Parameters
ranging_fp_struct – [in] Ranging fixed point instance.
data – [in] Data to average.
size – [in] Size of the data to average.
- Returns
Average of data.
-
q_num_t ranging_base_convert_to_distance_fixed_point(fp_format_t *ranging_fp_struct, ranging_dynamic_constants_t *ranging_const, q_num_t prop_delay)¶
Get propagation delay for distance calculation using fixed point.
- Parameters
ranging_fp_struct – [in] Ranging fixed point instance.
ranging_constants – [in] Dynamic ranging constants structure.
prop_delay – [in] Propagation delay value.
- Returns
Distance in meters.
-
struct ranging_dynamic_constants_t¶
- #include <ranging_base_fixed_point.h>
Ranging dynamic constants.
Public Members
-
q_num_t slope_q¶
Ranging slope in Q number representation
-
q_num_t offset_q¶
Ranging offset in Q number representation
-
q_num_t eighth_q¶
0.125 in Q number representation
-
q_num_t quarter_q¶
0.25 in Q number representation
-
q_num_t half_q¶
0.5 in Q number representation
-
q_num_t precision_q¶
User precision in Q number representation
-
q_num_t clk_cyc_comp_q¶
Clock cycle compare in Q number representation
-
q_num_t slope_q¶