Code petit robot

Dependencies:   X_NUCLEO_COMMON X_NUCLEO_IHM01A1 mbed

Committer:
julientiron
Date:
Fri Mar 25 21:27:03 2016 +0000
Revision:
0:1cb50d31c3b5
Code petit robot

Who changed what in which revision?

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