Creating a project about VL6180XA1 for TT_Mxx

Committer:
ThunderSoft
Date:
Fri Apr 26 09:34:53 2019 +0000
Revision:
3:7a97a01bad5e
Parent:
0:293917667c17
"update the mbed-os code to support TT_M4G9"

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ThunderSoft 0:293917667c17 1 /*******************************************************************************
ThunderSoft 0:293917667c17 2 Copyright © 2014, STMicroelectronics International N.V.
ThunderSoft 0:293917667c17 3 All rights reserved.
ThunderSoft 0:293917667c17 4
ThunderSoft 0:293917667c17 5 Redistribution and use in source and binary forms, with or without
ThunderSoft 0:293917667c17 6 modification, are permitted provided that the following conditions are met:
ThunderSoft 0:293917667c17 7 * Redistributions of source code must retain the above copyright
ThunderSoft 0:293917667c17 8 notice, this list of conditions and the following disclaimer.
ThunderSoft 0:293917667c17 9 * Redistributions in binary form must reproduce the above copyright
ThunderSoft 0:293917667c17 10 notice, this list of conditions and the following disclaimer in the
ThunderSoft 0:293917667c17 11 documentation and/or other materials provided with the distribution.
ThunderSoft 0:293917667c17 12 * Neither the name of STMicroelectronics nor the
ThunderSoft 0:293917667c17 13 names of its contributors may be used to endorse or promote products
ThunderSoft 0:293917667c17 14 derived from this software without specific prior written permission.
ThunderSoft 0:293917667c17 15
ThunderSoft 0:293917667c17 16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ThunderSoft 0:293917667c17 17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
ThunderSoft 0:293917667c17 18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
ThunderSoft 0:293917667c17 19 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
ThunderSoft 0:293917667c17 20 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
ThunderSoft 0:293917667c17 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
ThunderSoft 0:293917667c17 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
ThunderSoft 0:293917667c17 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ThunderSoft 0:293917667c17 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
ThunderSoft 0:293917667c17 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
ThunderSoft 0:293917667c17 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ThunderSoft 0:293917667c17 27 ********************************************************************************/
ThunderSoft 0:293917667c17 28 /*
ThunderSoft 0:293917667c17 29 * $Date: 2015-01-08 14:35:34 +0100 (Thu, 08 Jan 2015) $
ThunderSoft 0:293917667c17 30 * $Revision: 2042 $
ThunderSoft 0:293917667c17 31 */
ThunderSoft 0:293917667c17 32
ThunderSoft 0:293917667c17 33 /**
ThunderSoft 0:293917667c17 34 * @file VL6180x_cfg.h
ThunderSoft 0:293917667c17 35 *
ThunderSoft 0:293917667c17 36 * Proximity and ALS configuration
ThunderSoft 0:293917667c17 37 */
ThunderSoft 0:293917667c17 38
ThunderSoft 0:293917667c17 39 #ifndef VL6180x_CFG_H_
ThunderSoft 0:293917667c17 40 #define VL6180x_CFG_H_
ThunderSoft 0:293917667c17 41
ThunderSoft 0:293917667c17 42 /** @defgroup api_config Configuration
ThunderSoft 0:293917667c17 43 * @brief API static configuration
ThunderSoft 0:293917667c17 44 */
ThunderSoft 0:293917667c17 45
ThunderSoft 0:293917667c17 46
ThunderSoft 0:293917667c17 47
ThunderSoft 0:293917667c17 48 /** @ingroup api_config
ThunderSoft 0:293917667c17 49 * @{*/
ThunderSoft 0:293917667c17 50
ThunderSoft 0:293917667c17 51
ThunderSoft 0:293917667c17 52 /**
ThunderSoft 0:293917667c17 53 * @def VL6180x_UPSCALE_SUPPORT
ThunderSoft 0:293917667c17 54 * @brief Configure up-scale capabilities and default up-scale factor for ranging operations
ThunderSoft 0:293917667c17 55 *
ThunderSoft 0:293917667c17 56 * @li 1 : Fixed scaling by 1 (no up-scaling support)
ThunderSoft 0:293917667c17 57 * @li 2 : Fixed scaling by 2
ThunderSoft 0:293917667c17 58 * @li 3 : Fixed scaling by 3
ThunderSoft 0:293917667c17 59 * @li -1 -2 -3 : Run time programmable through @a VL6180x_UpscaleSetScaling(). Default scaling factore is -VL6180x_UPSCALE_SUPPORT \n
ThunderSoft 0:293917667c17 60 */
ThunderSoft 0:293917667c17 61 //#define VL6180x_UPSCALE_SUPPORT -1
ThunderSoft 0:293917667c17 62
ThunderSoft 0:293917667c17 63 /**
ThunderSoft 0:293917667c17 64 * @def VL6180x_ALS_SUPPORT
ThunderSoft 0:293917667c17 65 * @brief Enable ALS support
ThunderSoft 0:293917667c17 66 *
ThunderSoft 0:293917667c17 67 * Set to 0 if ALS is not used in application. This can help reducing code size if it is a concern.
ThunderSoft 0:293917667c17 68 */
ThunderSoft 0:293917667c17 69 #define VL6180x_ALS_SUPPORT 1
ThunderSoft 0:293917667c17 70
ThunderSoft 0:293917667c17 71 /**
ThunderSoft 0:293917667c17 72 * @def VL6180x_HAVE_DMAX_RANGING
ThunderSoft 0:293917667c17 73 * @brief Enable DMax calculation for ranging applications.
ThunderSoft 0:293917667c17 74 *
ThunderSoft 0:293917667c17 75 * When set to 1, __Dmax__ is returned by API typically when @a VL6180x_RangePollMeasurement() high level
ThunderSoft 0:293917667c17 76 * function is called (this is returned in @a VL6180x_RangeData_t structure).
ThunderSoft 0:293917667c17 77 * __Dmax__ is an estimation of the maximum distance (in mm) the product can report a valid distance of a 17% target for
ThunderSoft 0:293917667c17 78 * the current ambient light conditions (__Dmax__ decreases when ambient light increases). __Dmax__ should be used only
ThunderSoft 0:293917667c17 79 * when the product is not able to return a valid distance (no object or object is too far from the ranging sensor).
ThunderSoft 0:293917667c17 80 * Typically, this is done by checking the __errorStatus__ field of the @a VL6180x_RangeData_t structure returned by
ThunderSoft 0:293917667c17 81 * the @a VL6180x_RangePollMeasurement() function.
ThunderSoft 0:293917667c17 82 * You may refer to ::RangeError_u to get full list of supported error codes.
ThunderSoft 0:293917667c17 83 * @warning Dmax is estimated for a 17% grey target. If the real target has a reflectance lower than 17%, report Dmax could be over-estimated
ThunderSoft 0:293917667c17 84 */
ThunderSoft 0:293917667c17 85 #define VL6180x_HAVE_DMAX_RANGING 1
ThunderSoft 0:293917667c17 86
ThunderSoft 0:293917667c17 87 /**
ThunderSoft 0:293917667c17 88 * @def VL6180x_WRAP_AROUND_FILTER_SUPPORT
ThunderSoft 0:293917667c17 89 * @brief Enable wrap around filter (WAF) feature
ThunderSoft 0:293917667c17 90 *
ThunderSoft 0:293917667c17 91 * In specific conditions, when targeting a mirror or a very reflective metal, a __wrap around__ effect can occur internally to the
ThunderSoft 0:293917667c17 92 * ranging product which results in returning a wrong distance (under-estimated). Goal of the WAF is to detect this wrap arround effect
ThunderSoft 0:293917667c17 93 * and to filter it by returning a non-valid distance : __errorStatus__ set to 16 (see ::RangeError_u)
ThunderSoft 0:293917667c17 94 * @warning Wrap-around filter can not be used when device is running in continuous mode
ThunderSoft 0:293917667c17 95 *
ThunderSoft 0:293917667c17 96 * @li 0 : Filter is not supported, no filtering code is included in API
ThunderSoft 0:293917667c17 97 * @li 1 : Filter is supported and active by default
ThunderSoft 0:293917667c17 98 * @li -1 : Filter is supported but is not active by default @a VL6180x_FilterSetState() can turn it on and off at any time
ThunderSoft 0:293917667c17 99 */
ThunderSoft 0:293917667c17 100 #define VL6180x_WRAP_AROUND_FILTER_SUPPORT 1
ThunderSoft 0:293917667c17 101
ThunderSoft 0:293917667c17 102 /**
ThunderSoft 0:293917667c17 103 * @def VL6180x_EXTENDED_RANGE
ThunderSoft 0:293917667c17 104 * @brief Enable extended ranging support
ThunderSoft 0:293917667c17 105 *
ThunderSoft 0:293917667c17 106 * Device that do not formally support extended ranging should only be used with a scaling factor of 1.
ThunderSoft 0:293917667c17 107 * Correct operation with scaling factor other than 1 (>200mm ) is not granted by ST.
ThunderSoft 0:293917667c17 108 */
ThunderSoft 0:293917667c17 109 //#define VL6180x_EXTENDED_RANGE 0
ThunderSoft 0:293917667c17 110
ThunderSoft 0:293917667c17 111 #define EXTENDED_RANGE_50CM 0
ThunderSoft 0:293917667c17 112 //#define EXTENDED_RANGE_50CM 1
ThunderSoft 0:293917667c17 113
ThunderSoft 0:293917667c17 114 #if EXTENDED_RANGE_50CM
ThunderSoft 0:293917667c17 115 #define VL6180x_UPSCALE_SUPPORT -3
ThunderSoft 0:293917667c17 116 #define VL6180x_EXTENDED_RANGE 1
ThunderSoft 0:293917667c17 117 #else
ThunderSoft 0:293917667c17 118 #define VL6180x_UPSCALE_SUPPORT -1
ThunderSoft 0:293917667c17 119 #define VL6180x_EXTENDED_RANGE 0
ThunderSoft 0:293917667c17 120 #endif
ThunderSoft 0:293917667c17 121
ThunderSoft 0:293917667c17 122 #if (VL6180x_EXTENDED_RANGE) && (VL6180x_ALS_SUPPORT)
ThunderSoft 0:293917667c17 123 #warning "Als support should be OFF for extended range"
ThunderSoft 0:293917667c17 124 #endif
ThunderSoft 0:293917667c17 125
ThunderSoft 0:293917667c17 126 #endif
ThunderSoft 0:293917667c17 127 /** @} */ // end of api_config
ThunderSoft 0:293917667c17 128
ThunderSoft 0:293917667c17 129 /* VL6180x_CFG_H_ */
ThunderSoft 0:293917667c17 130