1 /******************************************************************************* 2 Copyright � 2016, STMicroelectronics International N.V. 3 All rights reserved. 4 5 Redistribution and use in source and binary forms, with or without 6 modification, are permitted provided that the following conditions are met: 7 * Redistributions of source code must retain the above copyright 8 notice, this list of conditions and the following disclaimer. 9 * Redistributions in binary form must reproduce the above copyright 10 notice, this list of conditions and the following disclaimer in the 11 documentation and/or other materials provided with the distribution. 12 * Neither the name of STMicroelectronics nor the 13 names of its contributors may be used to endorse or promote products 14 derived from this software without specific prior written permission. 15 16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND 19 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED. 20 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 *******************************************************************************/ 28 29 #ifndef _VL53L0X_API_CORE_H_ 30 #define _VL53L0X_API_CORE_H_ 31 32 #include "vl53l0x_def.h" 33 #include "vl53l0x_platform.h" 34 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 41 VL53L0X_Error VL53L0X_reverse_bytes(uint8_t *data, uint32_t size); 42 43 VL53L0X_Error VL53L0X_measurement_poll_for_completion(VL53L0X_DEV Dev); 44 45 uint8_t VL53L0X_encode_vcsel_period(uint8_t vcsel_period_pclks); 46 47 uint8_t VL53L0X_decode_vcsel_period(uint8_t vcsel_period_reg); 48 49 uint32_t VL53L0X_isqrt(uint32_t num); 50 51 uint32_t VL53L0X_quadrature_sum(uint32_t a, uint32_t b); 52 53 VL53L0X_Error VL53L0X_get_info_from_device(VL53L0X_DEV Dev, uint8_t option); 54 55 VL53L0X_Error VL53L0X_set_vcsel_pulse_period(VL53L0X_DEV Dev, 56 VL53L0X_VcselPeriod VcselPeriodType, uint8_t VCSELPulsePeriodPCLK); 57 58 VL53L0X_Error VL53L0X_get_vcsel_pulse_period(VL53L0X_DEV Dev, 59 VL53L0X_VcselPeriod VcselPeriodType, uint8_t *pVCSELPulsePeriodPCLK); 60 61 uint32_t VL53L0X_decode_timeout(uint16_t encoded_timeout); 62 63 VL53L0X_Error get_sequence_step_timeout(VL53L0X_DEV Dev, 64 VL53L0X_SequenceStepId SequenceStepId, 65 uint32_t *pTimeOutMicroSecs); 66 67 VL53L0X_Error set_sequence_step_timeout(VL53L0X_DEV Dev, 68 VL53L0X_SequenceStepId SequenceStepId, 69 uint32_t TimeOutMicroSecs); 70 71 VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV Dev, 72 uint32_t MeasurementTimingBudgetMicroSeconds); 73 74 VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV Dev, 75 uint32_t *pMeasurementTimingBudgetMicroSeconds); 76 77 VL53L0X_Error VL53L0X_load_tuning_settings(VL53L0X_DEV Dev, 78 uint8_t *pTuningSettingBuffer); 79 80 VL53L0X_Error VL53L0X_calc_sigma_estimate(VL53L0X_DEV Dev, 81 VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, 82 FixPoint1616_t *pSigmaEstimate, uint32_t *pDmax_mm); 83 84 VL53L0X_Error VL53L0X_get_total_xtalk_rate(VL53L0X_DEV Dev, 85 VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, 86 FixPoint1616_t *ptotal_xtalk_rate_mcps); 87 88 VL53L0X_Error VL53L0X_get_total_signal_rate(VL53L0X_DEV Dev, 89 VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, 90 FixPoint1616_t *ptotal_signal_rate_mcps); 91 92 VL53L0X_Error VL53L0X_get_pal_range_status(VL53L0X_DEV Dev, 93 uint8_t DeviceRangeStatus, 94 FixPoint1616_t SignalRate, 95 uint16_t EffectiveSpadRtnCount, 96 VL53L0X_RangingMeasurementData_t *pRangingMeasurementData, 97 uint8_t *pPalRangeStatus); 98 99 uint32_t VL53L0X_calc_timeout_mclks(VL53L0X_DEV Dev, 100 uint32_t timeout_period_us, uint8_t vcsel_period_pclks); 101 102 uint16_t VL53L0X_encode_timeout(uint32_t timeout_macro_clks); 103 104 #ifdef __cplusplus 105 } 106 #endif 107 108 #endif /* _VL53L0X_API_CORE_H_ */ 109