1 
2 /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
3 /******************************************************************************
4  * Copyright (c) 2020, STMicroelectronics - All Rights Reserved
5 
6  This file is part of VL53L1 and is dual licensed,
7  either GPL-2.0+
8  or 'BSD 3-clause "New" or "Revised" License' , at your option.
9  ******************************************************************************
10  */
11 
12 /**
13  * @file vl53l1_def.h
14  *
15  * @brief Type definitions for VL53L1 API.
16  *
17  */
18 
19 
20 #ifndef _VL53L1_DEF_H_
21 #define _VL53L1_DEF_H_
22 
23 #include "vl53l1_ll_def.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /** @defgroup VL53L1_globaldefine_group VL53L1 Defines
30  *  @brief    VL53L1 Defines
31  *  @{
32  */
33 
34 
35 /** VL53L1 IMPLEMENTATION major version */
36 #define VL53L1_IMPLEMENTATION_VER_MAJOR       2
37 /** VL53L1 IMPLEMENTATION minor version */
38 #define VL53L1_IMPLEMENTATION_VER_MINOR       4
39 /** VL53L1 IMPLEMENTATION sub version */
40 #define VL53L1_IMPLEMENTATION_VER_SUB         5
41 /** VL53L1 IMPLEMENTATION sub version */
42 #define VL53L1_IMPLEMENTATION_VER_REVISION  2548
43 
44 /****************************************
45  * PRIVATE define do not edit
46  ****************************************/
47 
48 /** @brief Defines the parameters of the Get Version Functions
49  */
50 typedef struct {
51 	uint32_t     revision; /*!< revision number */
52 	uint8_t      major;    /*!< major number */
53 	uint8_t      minor;    /*!< minor number */
54 	uint8_t      build;    /*!< build number */
55 } VL53L1_Version_t;
56 
57 
58 #define VL53L1_DEVINFO_STRLEN 32
59 
60 /** @brief Defines the parameters of the Get Device Info Functions
61  */
62 typedef struct {
63 	char Name[VL53L1_DEVINFO_STRLEN];
64 		/*!< Full Name of the Device e.g. VL53L1 cut1.1 */
65 	char Type[VL53L1_DEVINFO_STRLEN];
66 		/*!< Type of the Device e.g VL53L1 */
67 	char ProductId[VL53L1_DEVINFO_STRLEN];
68 		/*!< Product Identifier String
69 		 * @warning Not yet implemented
70 		 */
71 	uint8_t ProductType;
72 		/*!< Product Type, VL53L1 = 0xCC, VL53L3 = 0xAA
73 		 * Stands as module_type in the datasheet
74 		 */
75 	uint8_t ProductRevisionMajor;
76 		/*!< Product revision major */
77 	uint8_t ProductRevisionMinor;
78 		/*!< Product revision minor */
79 } VL53L1_DeviceInfo_t;
80 
81 
82 
83 /** @defgroup VL53L1_define_PresetModes_group Defines Preset modes
84  *  Defines all possible preset modes for the device
85  *  @{
86  */
87 typedef uint8_t VL53L1_PresetModes;
88 
89 #define VL53L1_PRESETMODE_AUTONOMOUS                ((VL53L1_PresetModes)  3)
90 #define VL53L1_PRESETMODE_LITE_RANGING              ((VL53L1_PresetModes)  4)
91 #define VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS       ((VL53L1_PresetModes)  8)
92 
93 	/* ... Modes to be added depending on device */
94 /** @} VL53L1_define_PresetModes_group */
95 
96 
97 /** @defgroup VL53L1_define_DistanceModes_group Defines Distance modes
98  *  Defines all possible Distance modes for the device
99  *  @{
100  */
101 typedef uint8_t VL53L1_DistanceModes;
102 
103 #define VL53L1_DISTANCEMODE_SHORT             ((VL53L1_DistanceModes)  1)
104 #define VL53L1_DISTANCEMODE_MEDIUM            ((VL53L1_DistanceModes)  2)
105 #define VL53L1_DISTANCEMODE_LONG              ((VL53L1_DistanceModes)  3)
106 /** @} VL53L1_define_DistanceModes_group */
107 
108 
109 /** @defgroup VL53L1_define_XtalkCal_group Defines Xtalk Calibration modes
110  *  Defines all possible Offset Calibration modes for the device
111  *  @{
112  */
113 typedef uint8_t VL53L1_XtalkCalibrationModes;
114 
115 #define VL53L1_XTALKCALIBRATIONMODE_NO_TARGET \
116 	((VL53L1_OffsetCalibrationModes) 0)
117 /*!< To perform Xtalk calibration with no target below 80 cm */
118 #define VL53L1_XTALKCALIBRATIONMODE_SINGLE_TARGET \
119 	((VL53L1_OffsetCalibrationModes)  1)
120 /*!< To perform Xtalk calibration with one target */
121 #define VL53L1_XTALKCALIBRATIONMODE_FULL_ROI \
122 	((VL53L1_OffsetCalibrationModes)  2)
123 /*!< To perform Xtalk calibration based on histogram with full ROI */
124 
125 /** @} VL53L1_define_XtalkCal_group */
126 
127 /** @defgroup VL53L1_define_OffsetCal_group Defines Offset Calibration modes
128  *  Defines all possible Offset Calibration modes for the device
129  *  @{
130  */
131 typedef uint8_t VL53L1_OffsetCalibrationModes;
132 
133 #define VL53L1_OFFSETCALIBRATIONMODE_STANDARD \
134 	((VL53L1_OffsetCalibrationModes)  1)
135 #define VL53L1_OFFSETCALIBRATIONMODE_PRERANGE_ONLY  \
136 	((VL53L1_OffsetCalibrationModes)  2)
137 
138 /** @} VL53L1_define_OffsetCal_group */
139 
140 
141 
142 
143 
144 /** @defgroup VL53L1_CheckEnable_group Check Enable list
145  *  @brief Check Enable code
146  *
147  *  Define used to specify the LimitCheckId.
148  *  Use @a VL53L1_GetLimitCheckInfo() to get the string.
149  *  @{
150  */
151 
152 #define VL53L1_CHECKENABLE_SIGMA_FINAL_RANGE           0
153 #define VL53L1_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE     1
154 
155 #define VL53L1_CHECKENABLE_NUMBER_OF_CHECKS            2
156 
157 /** @}  end of VL53L1_CheckEnable_group */
158 
159 
160 /** @defgroup VL53L1_ThresholdMode_gropup Detection Functionality
161  *  @brief Defines the different functionalities for the detection feature
162  *  @{
163  */
164 typedef uint8_t VL53L1_ThresholdMode;
165 
166 #define VL53L1_THRESHOLD_CROSSED_LOW   \
167 	((VL53L1_ThresholdMode)  0)
168 	/*!< Trigger interrupt if value < thresh_low */
169 #define VL53L1_THRESHOLD_CROSSED_HIGH   \
170 	((VL53L1_ThresholdMode)  1)
171 	/*!< Trigger interrupt if value > thresh_high */
172 #define VL53L1_THRESHOLD_OUT_OF_WINDOW    \
173 	((VL53L1_ThresholdMode)  2)
174 	/*!< Trigger interrupt if value < thresh_low OR value > thresh_high */
175 #define VL53L1_THRESHOLD_IN_WINDOW        \
176 	((VL53L1_ThresholdMode)  3)
177 	/*!< Trigger interrupt if value > thresh_low AND value < thresh_high */
178 
179 /** @} end of VL53L1_ThresholdMode_gropup */
180 
181 /** @brief Defines parameters for Distance detection Thresholds configuration
182  */
183 typedef struct {
184 	VL53L1_ThresholdMode CrossMode;
185 	uint16_t High; /*!< Distance threshold high limit in mm */
186 	uint16_t Low;  /*!< Distance threshold low limit  in mm */
187 } VL53L1_DistanceThreshold_t;
188 
189 /** @brief Defines parameters for Signal rate detection Thresholds configuration
190  */
191 typedef struct {
192 	VL53L1_ThresholdMode CrossMode;
193 	FixPoint1616_t High; /*!< Signal rate threshold high limit */
194 	FixPoint1616_t Low;  /*!< Signal rate threshold low limit */
195 } VL53L1_RateThreshold_t;
196 
197 /** @defgroup VL53L1_DetectionMode_group Gpio Functionality
198  *  @brief Defines conditions leading to device's IT on GPIO
199  *  @{
200  */
201 typedef uint8_t VL53L1_DetectionMode;
202 
203 #define VL53L1_DETECTION_NORMAL_RUN   \
204 	((VL53L1_DetectionMode)  0)
205 	/*!< Trigger interrupt on new measurement regardless of threshold
206 	 * just like after a VL53L1_SetPresetMode() call
207 	 */
208 #define VL53L1_DETECTION_DISTANCE_ONLY   \
209 	((VL53L1_DetectionMode)  1)
210 	/*!< Trigger interrupt if "threshold event" occurs on distance */
211 #define VL53L1_DETECTION_RATE_ONLY   \
212 	((VL53L1_DetectionMode)  2)
213 	/*!< Trigger interrupt if "threshold event" occurs on signal rate */
214 #define VL53L1_DETECTION_DISTANCE_AND_RATE   \
215 	((VL53L1_DetectionMode)  3)
216 	/*!< Trigger interrupt if "threshold event" occurs on distance AND rate
217 	 */
218 #define VL53L1_DETECTION_DISTANCE_OR_RATE   \
219 	((VL53L1_DetectionMode)  4)
220 	/*!< Trigger interrupt if "threshold event" occurs on distance OR rate
221 	 */
222 
223 /** @} end of VL53L1_DetectionMode_group */
224 
225 /** @brief Defines parameters for User/object Detection configuration
226  */
227 typedef struct {
228 	VL53L1_DetectionMode DetectionMode;	/*!< See #VL53L1_DetectionMode*/
229 	uint8_t IntrNoTarget; /*!< 1 to trigger IT in case of no target found */
230 	VL53L1_DistanceThreshold_t Distance; /*!< limits in mm */
231 	VL53L1_RateThreshold_t Rate;/*!< limits in FixPoint1616_t */
232 } VL53L1_DetectionConfig_t;
233 
234 
235 /** @brief Defines all parameters for the device
236  */
237 typedef struct {
238 	VL53L1_PresetModes PresetMode;
239 	/*!< Defines the operating mode to be used for the next measure */
240 	VL53L1_DistanceModes DistanceMode;
241 	/*!< Defines the operating mode to be used for the next measure */
242 	uint32_t MeasurementTimingBudgetMicroSeconds;
243 	/*!< Defines the allowed total time for a single measurement */
244 	uint8_t LimitChecksEnable[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS];
245 	/*!< This Array store all the Limit Check enable for this device. */
246 	uint8_t LimitChecksStatus[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS];
247 	/*!< This Array stores all the Status of the check linked to last
248 	 * measurement.
249 	 */
250 	FixPoint1616_t LimitChecksValue[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS];
251 	/*!< This Array stores all the Limit Check value for this device */
252 	FixPoint1616_t LimitChecksCurrent[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS];
253 	/*!< This Array stores all the Limit Check current value from latest
254 	 * ranging
255 	 */
256 } VL53L1_DeviceParameters_t;
257 
258 
259 /** @defgroup VL53L1_define_State_group Defines the current status of the device
260  *  Defines the current status of the device
261  *  @{
262  */
263 
264 typedef uint8_t VL53L1_State;
265 
266 #define VL53L1_STATE_POWERDOWN       ((VL53L1_State)  0)
267 	/*!< Device is in HW reset  */
268 #define VL53L1_STATE_WAIT_STATICINIT ((VL53L1_State)  1)
269 	/*!< Device is initialized and wait for static initialization  */
270 #define VL53L1_STATE_STANDBY         ((VL53L1_State)  2)
271 	/*!< Device is in Low power Standby mode   */
272 #define VL53L1_STATE_IDLE            ((VL53L1_State)  3)
273 	/*!< Device has been initialized and ready to do measurements  */
274 #define VL53L1_STATE_RUNNING         ((VL53L1_State)  4)
275 	/*!< Device is performing measurement */
276 #define VL53L1_STATE_RESET           ((VL53L1_State)  5)
277 	/*!< Soft reset has been run on Device */
278 #define VL53L1_STATE_UNKNOWN         ((VL53L1_State)  98)
279 	/*!< Device is in unknown state and need to be rebooted  */
280 #define VL53L1_STATE_ERROR           ((VL53L1_State)  99)
281 	/*!< Device is in error state and need to be rebooted  */
282 
283 /** @} VL53L1_define_State_group */
284 
285 
286 
287 /**
288  * @struct VL53L1_RangingMeasurementData_t
289  * @brief Single Range measurement data.
290  */
291 typedef struct {
292 	uint32_t TimeStamp;
293 		/*!< 32-bit time stamp.
294 		 * @warning Not yet implemented
295 		 */
296 
297 	uint8_t StreamCount;
298 		/*!< 8-bit Stream Count. */
299 
300 	uint8_t RangeQualityLevel;
301 		/*!< indicate a quality level in percentage from 0 to 100
302 		 * @warning Not yet implemented
303 		 */
304 
305 	FixPoint1616_t SignalRateRtnMegaCps;
306 		/*!< Return signal rate (MCPS)\n these is a 16.16 fix point
307 		 *  value, which is effectively a measure of target
308 		 *  reflectance.
309 		 */
310 
311 	FixPoint1616_t AmbientRateRtnMegaCps;
312 		/*!< Return ambient rate (MCPS)\n these is a 16.16 fix point
313 		 *  value, which is effectively a measure of the ambient
314 		 *  light.
315 		 */
316 
317 	uint16_t EffectiveSpadRtnCount;
318 		/*!< Return the effective SPAD count for the return signal.
319 		 *  To obtain Real value it should be divided by 256
320 		 */
321 
322 	FixPoint1616_t SigmaMilliMeter;
323 		/*!< Return the Sigma value in millimeter */
324 
325 	int16_t RangeMilliMeter;
326 		/*!< range distance in millimeter. This should be between
327 		 *  RangeMinMilliMeter and RangeMaxMilliMeter
328 		 */
329 
330 	uint8_t RangeFractionalPart;
331 		/*!< Fractional part of range distance. Final value is a
332 		 *  RangeMilliMeter + RangeFractionalPart/256.
333 		 *  @warning Not yet implemented
334 		 */
335 
336 	uint8_t RangeStatus;
337 		/*!< Range Status for the current measurement. This is device
338 		 *  dependent. Value = 0 means value is valid.
339 		 */
340 } VL53L1_RangingMeasurementData_t;
341 
342 
343 
344 /** @brief Defines User Zone(ROI) parameters
345  *
346  */
347 typedef struct {
348 
349 	uint8_t   TopLeftX;   /*!< Top Left x coordinate:  0-15 range */
350 	uint8_t   TopLeftY;   /*!< Top Left y coordinate:  0-15 range */
351 	uint8_t   BotRightX;  /*!< Bot Right x coordinate: 0-15 range */
352 	uint8_t   BotRightY;  /*!< Bot Right y coordinate: 0-15 range */
353 
354 } VL53L1_UserRoi_t;
355 
356 
357 /** @brief Defines ROI configuration parameters
358  *
359  *  Support up a max of 16 zones, Each Zone has the same size
360  *
361  */
362 
363 /**
364  * @struct VL53L1_CustomerNvmManaged_t
365  *
366  */
367 
368 typedef struct {
369 	uint8_t   global_config__spad_enables_ref_0;
370 	uint8_t   global_config__spad_enables_ref_1;
371 	uint8_t   global_config__spad_enables_ref_2;
372 	uint8_t   global_config__spad_enables_ref_3;
373 	uint8_t   global_config__spad_enables_ref_4;
374 	uint8_t   global_config__spad_enables_ref_5;
375 	uint8_t   global_config__ref_en_start_select;
376 	uint8_t   ref_spad_man__num_requested_ref_spads;
377 	uint8_t   ref_spad_man__ref_location;
378 	uint32_t  algo__crosstalk_compensation_plane_offset_kcps;
379 	int16_t   algo__crosstalk_compensation_x_plane_gradient_kcps;
380 	int16_t   algo__crosstalk_compensation_y_plane_gradient_kcps;
381 	uint16_t  ref_spad_char__total_rate_target_mcps;
382 	int16_t   algo__part_to_part_range_offset_mm;
383 	int16_t   mm_config__inner_offset_mm;
384 	int16_t   mm_config__outer_offset_mm;
385 } VL53L1_CustomerNvmManaged_t;
386 
387 /**
388  * @struct  VL53L1_CalibrationData_t
389  * @brief   Structure for storing the Calibration Data
390  *
391  */
392 
393 typedef struct {
394 
395 	uint32_t                             struct_version;
396 	VL53L1_CustomerNvmManaged_t          customer;
397 	VL53L1_additional_offset_cal_data_t  add_off_cal_data;
398 	VL53L1_optical_centre_t              optical_centre;
399 	VL53L1_gain_calibration_data_t       gain_cal;
400 	VL53L1_cal_peak_rate_map_t           cal_peak_rate_map;
401 } VL53L1_CalibrationData_t;
402 
403 #define VL53L1_ADDITIONAL_CALIBRATION_DATA_STRUCT_VERSION  0x20
404 /** VL53L1 additional Calibration Data struct version final struct version
405  * is given by adding it to  VL53L1_LL_CALIBRATION_DATA_STRUCT_VERSION
406  */
407 
408 #define VL53L1_CALIBRATION_DATA_STRUCT_VERSION \
409 		(VL53L1_LL_CALIBRATION_DATA_STRUCT_VERSION + \
410 		VL53L1_ADDITIONAL_CALIBRATION_DATA_STRUCT_VERSION)
411 /* VL53L1 Calibration Data struct version */
412 
413 /**
414  * @struct  VL53L1_AdditionalData_t
415  * @brief   Structure for storing the Additional Data
416  *
417  */
418 typedef VL53L1_additional_data_t VL53L1_AdditionalData_t;
419 
420 
421 typedef uint8_t VL53L1_SequenceStepId;
422 
423 #define	 VL53L1_SEQUENCESTEP_VHV		 ((VL53L1_SequenceStepId) 0)
424 /*!<VHV. */
425 #define	 VL53L1_SEQUENCESTEP_PHASECAL		 ((VL53L1_SequenceStepId) 1)
426 /*!<Phase Calibration. */
427 #define	 VL53L1_SEQUENCESTEP_REFPHASE		 ((VL53L1_SequenceStepId) 2)
428 /*!<Reference Phase. */
429 #define	 VL53L1_SEQUENCESTEP_DSS1		 ((VL53L1_SequenceStepId) 3)
430 /*!<DSS1. */
431 #define	 VL53L1_SEQUENCESTEP_DSS2		 ((VL53L1_SequenceStepId) 4)
432 /*!<DSS2. */
433 #define	 VL53L1_SEQUENCESTEP_MM1		 ((VL53L1_SequenceStepId) 5)
434 /*!<Mode Mitigation 1. */
435 #define	 VL53L1_SEQUENCESTEP_MM2		 ((VL53L1_SequenceStepId) 6)
436 /*!<Mode Mitigation 2. */
437 #define	 VL53L1_SEQUENCESTEP_RANGE		 ((VL53L1_SequenceStepId) 7)
438 /*!<Final Range step. */
439 
440 #define	 VL53L1_SEQUENCESTEP_NUMBER_OF_ITEMS			 8
441 /*!<Number of Sequence Step Managed by the API. */
442 
443 
444 /** @defgroup VL53L1_define_RangeStatus_group Defines the Range Status
445  *	@{
446  */
447 #define	 VL53L1_RANGESTATUS_RANGE_VALID				0
448 /*!<The Range is valid. */
449 #define	 VL53L1_RANGESTATUS_SIGMA_FAIL				1
450 /*!<Sigma Fail. */
451 #define	 VL53L1_RANGESTATUS_SIGNAL_FAIL				2
452 /*!<Signal fail. */
453 #define	 VL53L1_RANGESTATUS_RANGE_VALID_MIN_RANGE_CLIPPED	3
454 /*!<Target is below minimum detection threshold. */
455 #define	 VL53L1_RANGESTATUS_OUTOFBOUNDS_FAIL			4
456 /*!<Phase out of valid limits -  different to a wrap exit. */
457 #define	 VL53L1_RANGESTATUS_HARDWARE_FAIL			5
458 /*!<Hardware fail. */
459 #define	 VL53L1_RANGESTATUS_RANGE_VALID_NO_WRAP_CHECK_FAIL	6
460 /*!<The Range is valid but the wraparound check has not been done. */
461 #define	VL53L1_RANGESTATUS_WRAP_TARGET_FAIL			7
462 /*!<Wrapped target - no matching phase in other VCSEL period timing. */
463 #define	VL53L1_RANGESTATUS_PROCESSING_FAIL			8
464 /*!<Internal algo underflow or overflow in lite ranging. */
465 #define	VL53L1_RANGESTATUS_XTALK_SIGNAL_FAIL			9
466 /*!<Specific to lite ranging. */
467 #define	VL53L1_RANGESTATUS_SYNCRONISATION_INT			10
468 /*!<1st interrupt when starting ranging in back to back mode. Ignore data. */
469 #define	VL53L1_RANGESTATUS_RANGE_VALID_MERGED_PULSE		11
470 /*!<All Range ok but object is result of multiple pulses merging together.
471  * Used by RQL for merged pulse detection
472  */
473 #define	VL53L1_RANGESTATUS_TARGET_PRESENT_LACK_OF_SIGNAL	12
474 /*!<Used  by RQL  as different to phase fail. */
475 #define	VL53L1_RANGESTATUS_MIN_RANGE_FAIL			13
476 /*!<User ROI input is not valid e.g. beyond SPAD Array.*/
477 #define	VL53L1_RANGESTATUS_RANGE_INVALID			14
478 /*!<lld returned valid range but negative value ! */
479 #define	 VL53L1_RANGESTATUS_NONE				255
480 /*!<No Update. */
481 
482 /** @} VL53L1_define_RangeStatus_group */
483 
484 
485 /** @brief  Contains the Internal data of the Bare Driver
486  */
487 
488 typedef struct {
489 	VL53L1_LLDriverData_t   LLData;
490 	/*!< Low Level Driver data structure */
491 
492 	VL53L1_LLDriverResults_t llresults;
493 	/*!< Low Level Driver data structure */
494 
495 	VL53L1_State      PalState; /* Store the pal state */
496 	VL53L1_DeviceParameters_t CurrentParameters;
497 	/*!< Current Device Parameter */
498 
499 } VL53L1_DevData_t;
500 
501 
502 /* MACRO Definitions */
503 /** @defgroup VL53L1_define_GeneralMacro_group General Macro Defines
504  *  General Macro Defines
505  *  @{
506  */
507 
508 /* Defines */
509 #define VL53L1_SETPARAMETERFIELD(Dev, field, value) \
510 	(VL53L1DevDataSet(Dev, CurrentParameters.field, value))
511 
512 #define VL53L1_GETPARAMETERFIELD(Dev, field, variable) \
513 	(variable = VL53L1DevDataGet(Dev, CurrentParameters).field)
514 
515 
516 #define VL53L1_SETARRAYPARAMETERFIELD(Dev, field, index, value) \
517 	(VL53L1DevDataSet(Dev, CurrentParameters.field[index], value))
518 
519 #define VL53L1_GETARRAYPARAMETERFIELD(Dev, field, index, variable) \
520 	(variable = VL53L1DevDataGet(Dev, CurrentParameters).field[index])
521 
522 
523 #define VL53L1_SETDEVICESPECIFICPARAMETER(Dev, field, value) \
524 	(VL53L1DevDataSet(Dev, DeviceSpecificParameters.field, value))
525 
526 #define VL53L1_GETDEVICESPECIFICPARAMETER(Dev, field) \
527 	(VL53L1DevDataGet(Dev, DeviceSpecificParameters).field)
528 
529 
530 #define VL53L1_FIXPOINT1616TOFIXPOINT44(Value) \
531 	(uint16_t)((Value>>12)&0xFFFF)
532 #define VL53L1_FIXPOINT44TOFIXPOINT1616(Value) \
533 	(FixPoint1616_t)((uint32_t)Value<<12)
534 
535 #define VL53L1_FIXPOINT1616TOFIXPOINT72(Value) \
536 	(uint16_t)((Value>>14)&0xFFFF)
537 #define VL53L1_FIXPOINT72TOFIXPOINT1616(Value) \
538 	(FixPoint1616_t)((uint32_t)Value<<14)
539 
540 #define VL53L1_FIXPOINT1616TOFIXPOINT97(Value) \
541 	(uint16_t)((Value>>9)&0xFFFF)
542 #define VL53L1_FIXPOINT97TOFIXPOINT1616(Value) \
543 	(FixPoint1616_t)((uint32_t)Value<<9)
544 
545 #define VL53L1_FIXPOINT1616TOFIXPOINT88(Value) \
546 	(uint16_t)((Value>>8)&0xFFFF)
547 #define VL53L1_FIXPOINT88TOFIXPOINT1616(Value) \
548 	(FixPoint1616_t)((uint32_t)Value<<8)
549 
550 #define VL53L1_FIXPOINT1616TOFIXPOINT412(Value) \
551 	(uint16_t)((Value>>4)&0xFFFF)
552 #define VL53L1_FIXPOINT412TOFIXPOINT1616(Value) \
553 	(FixPoint1616_t)((uint32_t)Value<<4)
554 
555 #define VL53L1_FIXPOINT1616TOFIXPOINT313(Value) \
556 	(uint16_t)((Value>>3)&0xFFFF)
557 #define VL53L1_FIXPOINT313TOFIXPOINT1616(Value) \
558 	(FixPoint1616_t)((uint32_t)Value<<3)
559 
560 #define VL53L1_FIXPOINT1616TOFIXPOINT08(Value) \
561 	(uint8_t)((Value>>8)&0x00FF)
562 #define VL53L1_FIXPOINT08TOFIXPOINT1616(Value) \
563 	(FixPoint1616_t)((uint32_t)Value<<8)
564 
565 #define VL53L1_FIXPOINT1616TOFIXPOINT53(Value) \
566 	(uint8_t)((Value>>13)&0x00FF)
567 #define VL53L1_FIXPOINT53TOFIXPOINT1616(Value) \
568 	(FixPoint1616_t)((uint32_t)Value<<13)
569 
570 #define VL53L1_FIXPOINT1616TOFIXPOINT102(Value) \
571 	(uint16_t)((Value>>14)&0x0FFF)
572 #define VL53L1_FIXPOINT102TOFIXPOINT1616(Value) \
573 	(FixPoint1616_t)((uint32_t)Value<<14)
574 
575 #define VL53L1_FIXPOINT1616TOFIXPOINT142(Value) \
576 	(uint16_t)((Value>>14)&0xFFFF)
577 #define VL53L1_FIXPOINT142TOFIXPOINT1616(Value) \
578 	(FixPoint1616_t)((uint32_t)Value<<14)
579 
580 #define VL53L1_FIXPOINT1616TOFIXPOINT160(Value) \
581 	(uint16_t)((Value>>16)&0xFFFF)
582 #define VL53L1_FIXPOINT160TOFIXPOINT1616(Value) \
583 	(FixPoint1616_t)((uint32_t)Value<<16)
584 
585 #define VL53L1_MAKEUINT16(lsb, msb) (uint16_t)((((uint16_t)msb)<<8) + \
586 		(uint16_t)lsb)
587 
588 #ifndef SUPPRESS_UNUSED_WARNING
589 #define SUPPRESS_UNUSED_WARNING(x) ((void) (x))
590 #endif
591 
592 /** @} VL53L1_define_GeneralMacro_group */
593 
594 /** @} VL53L1_globaldefine_group */
595 
596 
597 
598 #ifdef __cplusplus
599 }
600 #endif
601 
602 
603 #endif /* _VL53L1_DEF_H_ */
604