FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
devices::vl53l0x::FixPoint9_7 Class Reference

Helper class to handle VL53L0X special fix-point 9.7 values. More...

#include <fastarduino/devices/vl53l0x_types.h>

Static Public Member Functions

static constexpr bool is_valid (float value)
 Check that a float value is valid for conversion to 9.7 fix-point. More...
 
static constexpr uint16_t convert (float value)
 Convert a float value into an 9.7 fix-point. More...
 
static constexpr float convert (uint16_t value)
 Convert an 9.7 fix-point value into a float. More...
 

Detailed Description

Helper class to handle VL53L0X special fix-point 9.7 values.

It provides 3 utility methods for conversion and validity checks. This class is used internally by vl53l0x::VL53L0X class and is normally not useful to application developers. Representation of 9.7 fix-point values is done as an uint16_t.

Definition at line 50 of file vl53l0x_types.h.

Member Function Documentation

◆ is_valid()

static constexpr bool devices::vl53l0x::FixPoint9_7::is_valid ( float  value)
inlinestaticconstexpr

Check that a float value is valid for conversion to 9.7 fix-point.

Parameters
valuethe value to check (as float)
Return values
trueif value is convertible to 9.7 fix-point.
falseif value is not convertible to 9.7 fix-point (negative or too big).

Definition at line 60 of file vl53l0x_types.h.

◆ convert() [1/2]

static constexpr uint16_t devices::vl53l0x::FixPoint9_7::convert ( float  value)
inlinestaticconstexpr

Convert a float value into an 9.7 fix-point.

Parameters
valuethe value to covnert (as float)
Return values
0if value is not covnertible to 9.7 fix-point
Returns
uint16_t 9.7 fix-point conversion of value if valid
See also
is_valid()

Definition at line 73 of file vl53l0x_types.h.

◆ convert() [2/2]

static constexpr float devices::vl53l0x::FixPoint9_7::convert ( uint16_t  value)
inlinestaticconstexpr

Convert an 9.7 fix-point value into a float.

Parameters
valueuint16_t 9.7 fix-point value to convert to float
Returns
float representation of value

Definition at line 83 of file vl53l0x_types.h.


The documentation for this class was generated from the following file: