mbed compatible API for the VL53L0X Time-of-Flight sensor

Dependents:   VL53L0X_SingleRanging_Example robot_sm VL53L0X_SingleRanging_HighAccuracy_HANSL ENGR6002_P001unk

Committer:
mjarvisal
Date:
Tue Aug 23 05:14:05 2016 +0000
Revision:
0:e6fcdb78a136
Initial release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mjarvisal 0:e6fcdb78a136 1 /*******************************************************************************
mjarvisal 0:e6fcdb78a136 2 Copyright © 2015, STMicroelectronics International N.V.
mjarvisal 0:e6fcdb78a136 3 All rights reserved.
mjarvisal 0:e6fcdb78a136 4
mjarvisal 0:e6fcdb78a136 5 Redistribution and use in source and binary forms, with or without
mjarvisal 0:e6fcdb78a136 6 modification, are permitted provided that the following conditions are met:
mjarvisal 0:e6fcdb78a136 7 * Redistributions of source code must retain the above copyright
mjarvisal 0:e6fcdb78a136 8 notice, this list of conditions and the following disclaimer.
mjarvisal 0:e6fcdb78a136 9 * Redistributions in binary form must reproduce the above copyright
mjarvisal 0:e6fcdb78a136 10 notice, this list of conditions and the following disclaimer in the
mjarvisal 0:e6fcdb78a136 11 documentation and/or other materials provided with the distribution.
mjarvisal 0:e6fcdb78a136 12 * Neither the name of STMicroelectronics nor the
mjarvisal 0:e6fcdb78a136 13 names of its contributors may be used to endorse or promote products
mjarvisal 0:e6fcdb78a136 14 derived from this software without specific prior written permission.
mjarvisal 0:e6fcdb78a136 15
mjarvisal 0:e6fcdb78a136 16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
mjarvisal 0:e6fcdb78a136 17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
mjarvisal 0:e6fcdb78a136 18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
mjarvisal 0:e6fcdb78a136 19 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
mjarvisal 0:e6fcdb78a136 20 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
mjarvisal 0:e6fcdb78a136 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
mjarvisal 0:e6fcdb78a136 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mjarvisal 0:e6fcdb78a136 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
mjarvisal 0:e6fcdb78a136 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mjarvisal 0:e6fcdb78a136 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
mjarvisal 0:e6fcdb78a136 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mjarvisal 0:e6fcdb78a136 27 ********************************************************************************/
mjarvisal 0:e6fcdb78a136 28 /**
mjarvisal 0:e6fcdb78a136 29 * @file vl53l0_types.h
mjarvisal 0:e6fcdb78a136 30 * @brief VL53L0 types definition
mjarvisal 0:e6fcdb78a136 31 */
mjarvisal 0:e6fcdb78a136 32
mjarvisal 0:e6fcdb78a136 33 #ifndef VL53L0X_TYPES_H_
mjarvisal 0:e6fcdb78a136 34 #define VL53L0X_TYPES_H_
mjarvisal 0:e6fcdb78a136 35
mjarvisal 0:e6fcdb78a136 36 /** @defgroup porting_type Basic type definition
mjarvisal 0:e6fcdb78a136 37 * @ingroup VL53L0X_platform_group
mjarvisal 0:e6fcdb78a136 38 *
mjarvisal 0:e6fcdb78a136 39 * @brief file vl53l0_types.h files hold basic type definition that may requires porting
mjarvisal 0:e6fcdb78a136 40 *
mjarvisal 0:e6fcdb78a136 41 * contains type that must be defined for the platform\n
mjarvisal 0:e6fcdb78a136 42 * when target platform and compiler provide stdint.h and stddef.h it is enough to include it.\n
mjarvisal 0:e6fcdb78a136 43 * If stdint.h is not available review and adapt all signed and unsigned 8/16/32 bits basic types. \n
mjarvisal 0:e6fcdb78a136 44 * If stddef.h is not available review and adapt NULL definition .
mjarvisal 0:e6fcdb78a136 45 */
mjarvisal 0:e6fcdb78a136 46 #include <stdint.h>
mjarvisal 0:e6fcdb78a136 47 #include <stddef.h>
mjarvisal 0:e6fcdb78a136 48
mjarvisal 0:e6fcdb78a136 49 #ifndef NULL
mjarvisal 0:e6fcdb78a136 50 #error "Error NULL definition should be done. Please add required include "
mjarvisal 0:e6fcdb78a136 51 #endif
mjarvisal 0:e6fcdb78a136 52
mjarvisal 0:e6fcdb78a136 53
mjarvisal 0:e6fcdb78a136 54 #if ! defined(STDINT_H) && !defined(_GCC_STDINT_H) &&!defined(__STDINT_DECLS) && !defined(_GCC_WRAP_STDINT_H)
mjarvisal 0:e6fcdb78a136 55
mjarvisal 0:e6fcdb78a136 56 #pragma message("Please review type definition of STDINT define for your platform and add to list above ")
mjarvisal 0:e6fcdb78a136 57
mjarvisal 0:e6fcdb78a136 58 /*
mjarvisal 0:e6fcdb78a136 59 * target platform do not provide stdint or use a different #define than above
mjarvisal 0:e6fcdb78a136 60 * to avoid seeing the message below addapt the #define list above or implement
mjarvisal 0:e6fcdb78a136 61 * all type and delete these pragma
mjarvisal 0:e6fcdb78a136 62 */
mjarvisal 0:e6fcdb78a136 63
mjarvisal 0:e6fcdb78a136 64 /** \ingroup VL53L0X_portingType_group
mjarvisal 0:e6fcdb78a136 65 * @{
mjarvisal 0:e6fcdb78a136 66 */
mjarvisal 0:e6fcdb78a136 67
mjarvisal 0:e6fcdb78a136 68
mjarvisal 0:e6fcdb78a136 69 typedef unsigned long long uint64_t;
mjarvisal 0:e6fcdb78a136 70
mjarvisal 0:e6fcdb78a136 71
mjarvisal 0:e6fcdb78a136 72 /** @brief Typedef defining 32 bit unsigned int type.\n
mjarvisal 0:e6fcdb78a136 73 * The developer should modify this to suit the platform being deployed.
mjarvisal 0:e6fcdb78a136 74 */
mjarvisal 0:e6fcdb78a136 75 typedef unsigned int uint32_t;
mjarvisal 0:e6fcdb78a136 76
mjarvisal 0:e6fcdb78a136 77 /** @brief Typedef defining 32 bit int type.\n
mjarvisal 0:e6fcdb78a136 78 * The developer should modify this to suit the platform being deployed.
mjarvisal 0:e6fcdb78a136 79 */
mjarvisal 0:e6fcdb78a136 80 typedef int int32_t;
mjarvisal 0:e6fcdb78a136 81
mjarvisal 0:e6fcdb78a136 82 /** @brief Typedef defining 16 bit unsigned short type.\n
mjarvisal 0:e6fcdb78a136 83 * The developer should modify this to suit the platform being deployed.
mjarvisal 0:e6fcdb78a136 84 */
mjarvisal 0:e6fcdb78a136 85 typedef unsigned short uint16_t;
mjarvisal 0:e6fcdb78a136 86
mjarvisal 0:e6fcdb78a136 87 /** @brief Typedef defining 16 bit short type.\n
mjarvisal 0:e6fcdb78a136 88 * The developer should modify this to suit the platform being deployed.
mjarvisal 0:e6fcdb78a136 89 */
mjarvisal 0:e6fcdb78a136 90 typedef short int16_t;
mjarvisal 0:e6fcdb78a136 91
mjarvisal 0:e6fcdb78a136 92 /** @brief Typedef defining 8 bit unsigned char type.\n
mjarvisal 0:e6fcdb78a136 93 * The developer should modify this to suit the platform being deployed.
mjarvisal 0:e6fcdb78a136 94 */
mjarvisal 0:e6fcdb78a136 95 typedef unsigned char uint8_t;
mjarvisal 0:e6fcdb78a136 96
mjarvisal 0:e6fcdb78a136 97 /** @brief Typedef defining 8 bit char type.\n
mjarvisal 0:e6fcdb78a136 98 * The developer should modify this to suit the platform being deployed.
mjarvisal 0:e6fcdb78a136 99 */
mjarvisal 0:e6fcdb78a136 100 typedef signed char int8_t;
mjarvisal 0:e6fcdb78a136 101
mjarvisal 0:e6fcdb78a136 102 /** @} */
mjarvisal 0:e6fcdb78a136 103 #endif /* _STDINT_H */
mjarvisal 0:e6fcdb78a136 104
mjarvisal 0:e6fcdb78a136 105
mjarvisal 0:e6fcdb78a136 106 /** use where fractional values are expected
mjarvisal 0:e6fcdb78a136 107 *
mjarvisal 0:e6fcdb78a136 108 * Given a floating point value f it's .16 bit point is (int)(f*(1<<16))*/
mjarvisal 0:e6fcdb78a136 109 typedef uint32_t FixPoint1616_t;
mjarvisal 0:e6fcdb78a136 110
mjarvisal 0:e6fcdb78a136 111 #endif /* VL53L0X_TYPES_H_ */