use VL6180XA1 chip wothout X-NUCLEO-6180XA1 Board. Simple way to use the chip.

Dependents:   Check_VL6180XA1_ToF

Fork of X_NUCLEO_6180XA1 by ST

Revision:
57:fa4c622b04a7
Parent:
54:17f3bb228b13
--- a/Components/VL6180X/vl6180x_def.h	Mon Mar 13 17:57:03 2017 +0100
+++ b/Components/VL6180X/vl6180x_def.h	Mon Mar 13 19:08:10 2017 +0000
@@ -32,22 +32,22 @@
  */
 
 /**
- * @file VL6180x_def.h
+ * @file VL6180X_def.h
  *
  * @brief Type definitions for vl6180x api.
  *
  */
 
 
-#ifndef _VL6180x_DEF
-#define _VL6180x_DEF
+#ifndef _VL6180X_DEF
+#define _VL6180X_DEF
 
 /** API major version */
-#define VL6180x_API_REV_MAJOR   3
+#define VL6180X_API_REV_MAJOR   3
 /** API minor version */
-#define VL6180x_API_REV_MINOR   0
+#define VL6180X_API_REV_MINOR   0
 /** API sub version */
-#define VL6180x_API_REV_SUB     1
+#define VL6180X_API_REV_SUB     1
 
 #define VL6180X_STR_HELPER(x) #x
 #define VL6180X_STR(x) VL6180X_STR_HELPER(x)
@@ -59,36 +59,36 @@
  * check configuration macro raise error or warning and suggest a default value
  */
 
-#ifndef VL6180x_UPSCALE_SUPPORT
-#error "VL6180x_UPSCALE_SUPPORT not defined"
+#ifndef VL6180X_UPSCALE_SUPPORT
+#error "VL6180X_UPSCALE_SUPPORT not defined"
 /* TODO you must define value for  upscale support in your vl6180x_cfg.h  */
 #endif
 
-#ifndef VL6180x_ALS_SUPPORT
-#error "VL6180x_ALS_SUPPORT not defined"
-/* TODO you must define VL6180x_ALS_SUPPORT  with a value in your vl6180x_cfg.h  set to 0 do disable*/
+#ifndef VL6180X_ALS_SUPPORT
+#error "VL6180X_ALS_SUPPORT not defined"
+/* TODO you must define VL6180X_ALS_SUPPORT  with a value in your vl6180x_cfg.h  set to 0 do disable*/
 #endif
 
-#ifndef VL6180x_HAVE_DMAX_RANGING
-#error "VL6180x_HAVE_DMAX_RANGING not defined"
+#ifndef VL6180X_HAVE_DMAX_RANGING
+#error "VL6180X_HAVE_DMAX_RANGING not defined"
 /* TODO you may remove or comment these #error and keep the default below  or update your vl6180x_cfg.h .h file */
 /**
- * force VL6180x_HAVE_DMAX_RANGING to not supported when not part of cfg file
+ * force VL6180X_HAVE_DMAX_RANGING to not supported when not part of cfg file
  */
-#define VL6180x_HAVE_DMAX_RANGING   0
+#define VL6180X_HAVE_DMAX_RANGING   0
 #endif
 
-#ifndef VL6180x_EXTENDED_RANGE
-#define VL6180x_EXTENDED_RANGE   0
+#ifndef VL6180X_EXTENDED_RANGE
+#define VL6180X_EXTENDED_RANGE   0
 #endif
 
-#ifndef  VL6180x_WRAP_AROUND_FILTER_SUPPORT
-#error "VL6180x_WRAP_AROUND_FILTER_SUPPORT not defined ?"
+#ifndef  VL6180X_WRAP_AROUND_FILTER_SUPPORT
+#error "VL6180X_WRAP_AROUND_FILTER_SUPPORT not defined ?"
 /* TODO you may remove or comment these #error and keep the default below  or update vl6180x_cfg.h file */
 /**
- * force VL6180x_WRAP_AROUND_FILTER_SUPPORT to not supported when not part of cfg file
+ * force VL6180X_WRAP_AROUND_FILTER_SUPPORT to not supported when not part of cfg file
  */
-#define VL6180x_WRAP_AROUND_FILTER_SUPPORT 0
+#define VL6180X_WRAP_AROUND_FILTER_SUPPORT 0
 #endif
 
 
@@ -99,35 +99,35 @@
  ****************************************/
 
 /** Maximal buffer size ever use in i2c */
-#define VL6180x_MAX_I2C_XFER_SIZE   8 /* At present time it 6 byte max but that can change */
+#define VL6180X_MAX_I2C_XFER_SIZE   8 /* At present time it 6 byte max but that can change */
 
-#if VL6180x_UPSCALE_SUPPORT < 0
+#if VL6180X_UPSCALE_SUPPORT < 0
 /**
- * @def VL6180x_HAVE_UPSCALE_DATA
+ * @def VL6180X_HAVE_UPSCALE_DATA
  * @brief  is defined if device data structure has data so when user configurable up-scale is active
  */
-#define VL6180x_HAVE_UPSCALE_DATA /* have data only for user configurable up-scale config */
+#define VL6180X_HAVE_UPSCALE_DATA /* have data only for user configurable up-scale config */
 #endif
 
-#if VL6180x_WRAP_AROUND_FILTER_SUPPORT
+#if VL6180X_WRAP_AROUND_FILTER_SUPPORT
 /**
- * @def VL6180x_HAVE_WRAP_AROUND_DATA
+ * @def VL6180X_HAVE_WRAP_AROUND_DATA
  * @brief  is defined if device data structure has filter data so when active in cfg file
  */
-#define  VL6180x_HAVE_WRAP_AROUND_DATA
+#define  VL6180X_HAVE_WRAP_AROUND_DATA
 #endif
 
-#if VL6180x_ALS_SUPPORT != 0
+#if VL6180X_ALS_SUPPORT != 0
 /**
- * @def  VL6180x_HAVE_ALS_DATA
+ * @def  VL6180X_HAVE_ALS_DATA
  * @brief is defined when als data are include in device data structure so when als suport if configured
  */
-#define VL6180x_HAVE_ALS_DATA
+#define VL6180X_HAVE_ALS_DATA
 #endif
 
 
-#if VL6180x_WRAP_AROUND_FILTER_SUPPORT || VL6180x_HAVE_DMAX_RANGING
-	#define	VL6180x_HAVE_RATE_DATA
+#if VL6180X_WRAP_AROUND_FILTER_SUPPORT || VL6180X_HAVE_DMAX_RANGING
+	#define	VL6180X_HAVE_RATE_DATA
 #endif
 
 /** Error and warning code returned by API
@@ -135,9 +135,9 @@
  * negative value are true error mostly fatal\n
  * positive value  are warning most of time it's ok to continue\n
  */
-enum VL6180x_ErrCode_t{
+enum VL6180X_ErrCode_t{
 	API_NO_ERROR        = 0,
-    CALIBRATION_WARNING = 1,  /*!< warning invalid calibration data may be in used \a  VL6180x_InitData() \a VL6180x_GetOffsetCalibrationData \a VL6180x_SetOffsetCalibrationData*/
+    CALIBRATION_WARNING = 1,  /*!< warning invalid calibration data may be in used \a  VL6180X_InitData() \a VL6180X_GetOffsetCalibrationData \a VL6180X_SetOffsetCalibrationData*/
     MIN_CLIPED          = 2,  /*!< warning parameter passed was clipped to min before to be applied */
     NOT_GUARANTEED      = 3,  /*!< Correct operation is not guaranteed typically using extended ranging on vl6180x */
     NOT_READY           = 4,  /*!< the data is not ready retry */
@@ -184,7 +184,7 @@
     FilterType1_t Previous_VAVGDiff;                /*!< internal use */
 };
 
-#if  VL6180x_HAVE_DMAX_RANGING
+#if  VL6180X_HAVE_DMAX_RANGING
 typedef int32_t DMaxFix_t;
 struct DMaxData_t {
     uint32_t ambTuningWindowFactor_K; /*!<  internal algo tuning (*1000) */
@@ -201,14 +201,14 @@
 #endif
 
 /**
- * @struct VL6180xDevData_t
+ * @struct VL6180XDevData_t
  *
- * @brief Per VL6180x device St private data structure \n
+ * @brief Per VL6180X device St private data structure \n
  * End user should never access any of these field directly
  *
- * These must never access directly but only via VL6180xDev/SetData(dev, field) macro
+ * These must never access directly but only via VL6180XDev/SetData(dev, field) macro
  */
-struct VL6180xDevData_t {
+struct VL6180XDevData_t {
 
     uint32_t Part2PartAmbNVM;  /*!< backed up NVM value */
     uint32_t XTalkCompRate_KCps; /*! Cached XTlak Compensation Rate */
@@ -216,48 +216,48 @@
     uint16_t EceFactorM;        /*!< Ece Factor M numerator  */
     uint16_t EceFactorD;        /*!< Ece Factor D denominator*/
 
-#ifdef VL6180x_HAVE_ALS_DATA
+#ifdef VL6180X_HAVE_ALS_DATA
     uint16_t IntegrationPeriod; /*!< cached als Integration period avoid slow read from device at each measure */
     uint16_t AlsGainCode;       /*!< cached Als gain avoid slow read from device at each measure */
     uint16_t AlsScaler;         /*!< cached Als scaler avoid slow read from device at each measure */
 #endif
 
-#ifdef VL6180x_HAVE_UPSCALE_DATA
+#ifdef VL6180X_HAVE_UPSCALE_DATA
     uint8_t UpscaleFactor;      /*!<  up-scaling factor*/
 #endif
 
-#ifdef  VL6180x_HAVE_WRAP_AROUND_DATA
+#ifdef  VL6180X_HAVE_WRAP_AROUND_DATA
     uint8_t WrapAroundFilterActive; /*!< Filter on/off */
     struct FilterData_t FilterData; /*!< Filter internal data state history ... */
 #endif
 
-#if  VL6180x_HAVE_DMAX_RANGING
+#if  VL6180X_HAVE_DMAX_RANGING
     struct DMaxData_t DMaxData;
     uint8_t DMaxEnable;
 #endif
     int8_t  Part2PartOffsetNVM;     /*!< backed up NVM value */
 };
 
-#if VL6180x_SINGLE_DEVICE_DRIVER
-extern  struct VL6180xDevData_t SingleVL6180xDevData;
-#define VL6180xDevDataGet(dev, field) (SingleVL6180xDevData.field)
-/* is also used as direct accessor like VL6180xDevDataGet(dev, x)++*/
-#define VL6180xDevDataSet(dev, field, data) (SingleVL6180xDevData.field)=(data)
+#if VL6180X_SINGLE_DEVICE_DRIVER
+extern  struct VL6180XDevData_t SingleVL6180XDevData;
+#define VL6180XDevDataGet(dev, field) (SingleVL6180XDevData.field)
+/* is also used as direct accessor like VL6180XDevDataGet(dev, x)++*/
+#define VL6180XDevDataSet(dev, field, data) (SingleVL6180XDevData.field)=(data)
 #endif
 
 
 /**
- * @struct VL6180x_RangeData_t
+ * @struct VL6180X_RangeData_t
  * @brief Range and any optional measurement data.
  */
 typedef struct {
     uint32_t range_mm;          /*!< range distance in mm. */
     int32_t signalRate_mcps;   /*!< signal rate (MCPS)\n these is a 9.7 fix point value, which is effectively a measure of target reflectance.*/
     uint32_t errorStatus;      /*!< Error status of the current measurement. \n
-                                  see @a ::RangeError_u @a VL6180x_GetRangeStatusErrString() */
+                                  see @a ::RangeError_u @a VL6180X_GetRangeStatusErrString() */
 
 
-#ifdef VL6180x_HAVE_RATE_DATA
+#ifdef VL6180X_HAVE_RATE_DATA
     uint32_t rtnAmbRate;    /*!< Return Ambient rate in KCount per sec related to \a RESULT_RANGE_RETURN_AMB_COUNT */
     uint32_t rtnRate;       /*!< Return rate in KCount per sec  related to \a RESULT_RANGE_RETURN_SIGNAL_COUNT  */
     uint32_t rtnConvTime;   /*!< Return Convergence time \a RESULT_RANGE_RETURN_CONV_TIME */
@@ -265,14 +265,14 @@
 #endif
 
 
-#if  VL6180x_HAVE_DMAX_RANGING
+#if  VL6180X_HAVE_DMAX_RANGING
     uint32_t DMax;              /*!< DMax  when applicable */
 #endif
 
-#ifdef  VL6180x_HAVE_WRAP_AROUND_DATA
+#ifdef  VL6180X_HAVE_WRAP_AROUND_DATA
     RangeFilterResult_t FilteredData; /*!< Filter result main range_mm is updated */
 #endif
-}VL6180x_RangeData_t;
+}VL6180X_RangeData_t;
 
 
 /** use where fix point 9.7 bit values are expected
@@ -286,17 +286,17 @@
 /**
  * @brief This data type defines als  measurement data.
  */
-typedef struct VL6180x_AlsData_st{
+typedef struct VL6180X_AlsData_st{
     lux_t lux;                 /**< Light measurement (Lux) */
     uint32_t errorStatus;      /**< Error status of the current measurement. \n
      * No Error := 0. \n
      * Refer to product sheets for other error codes. */
-}VL6180x_AlsData_t;
+}VL6180X_AlsData_t;
 
 /**
  * @brief Range status Error code
  *
- * @a VL6180x_GetRangeStatusErrString() if configured ( @a #VL6180x_RANGE_STATUS_ERRSTRING )
+ * @a VL6180X_GetRangeStatusErrString() if configured ( @a #VL6180X_RANGE_STATUS_ERRSTRING )
  * related to register @a #RESULT_RANGE_STATUS and additional post processing
  */
 typedef enum {
@@ -438,7 +438,7 @@
 /**
  * @def SYSTEM_GROUPED_PARAMETER_HOLD
  * @brief Writing 1/0 activate/deactivate safe host update of multiple register in critical group \n
- *        rather use \a VL6180x_SetGroupParamHold()
+ *        rather use \a VL6180X_SetGroupParamHold()
  *
  * The critical register group is made of: \n
  * #SYSTEM_INTERRUPT_CONFIG_GPIO \n
@@ -487,7 +487,7 @@
 
 /**
  * @def SYSRANGE_INTERMEASUREMENT_PERIOD
- * @brief Continuous mode intermeasurement delay \a VL6180x_RangeSetInterMeasPeriod()
+ * @brief Continuous mode intermeasurement delay \a VL6180X_RangeSetInterMeasPeriod()
  *
  * Time delay between measurements in Ranging continuous mode.\n
  * Range 0-254 (0 = 10ms).\n Step size = 10ms.
@@ -508,7 +508,7 @@
  */
 #define SYSRANGE_MAX_CONVERGENCE_TIME         0x01C
 /**@brief Cross talk compensation rate
- * @warning  never write register directly use @a VL6180x_SetXTalkCompensationRate()
+ * @warning  never write register directly use @a VL6180X_SetXTalkCompensationRate()
  * refer to manual for calibration procedure and computation
  * @ingroup device_regdef
  */
@@ -525,7 +525,7 @@
 #define SYSRANGE_MAX_AMBIENT_LEVEL_THRESH     0x02A
 #define SYSRANGE_MAX_AMBIENT_LEVEL_MULT       0x02C
 /** @brief  various Enable check enabel register
- *  @a VL6180x_RangeSetEceState()
+ *  @a VL6180X_RangeSetEceState()
  */
 #define SYSRANGE_RANGE_CHECK_ENABLES          0x02D
     #define RANGE_CHECK_ECE_ENABLE_MASK      0x01
@@ -582,14 +582,14 @@
  * @brief 16 Bit ALS count output value.
  *
  * Lux value depends on Gain and integration settings and calibrated lux/count setting
- * \a VL6180x_AlsGetLux() \a VL6180x_AlsGetMeasurement()
+ * \a VL6180X_AlsGetLux() \a VL6180X_AlsGetMeasurement()
  */
 #define RESULT_ALS_VAL                        0x50
 
 /**
  * @def FW_ALS_RESULT_SCALER
  * @brief Als scaler register  Bits [3:0] analogue gain 1 to 16x
- * these register content is cached by API in \a VL6180xDevData_t::AlsScaler
+ * these register content is cached by API in \a VL6180XDevData_t::AlsScaler
  * for lux computation acceleration
  */
 #define FW_ALS_RESULT_SCALER                  0x120
@@ -712,7 +712,7 @@
  * @def RANGE_SCALER
  * @brief RANGE scaling register
  *
- * Never should  user write directly onto that register directly \a VL6180x_UpscaleSetScaling()
+ * Never should  user write directly onto that register directly \a VL6180X_UpscaleSetScaling()
  */
 #define RANGE_SCALER                            0x096
 
@@ -736,8 +736,8 @@
  * User programmable I2C address (7-bit). Device address can be re-designated after power-up.
  * @warning What programmed in the register 7-0 are bit 8-1 of i2c address on bus (bit 0 is rd/wr)
  * so what prohamd is commonly whar ergfer as adrerss /2
- * @sa VL6180x_SetI2CAddress()
+ * @sa VL6180X_SetI2CAddress()
  */
 #define I2C_SLAVE_DEVICE_ADDRESS               0x212
 
-#endif /* _VL6180x_DEF */
+#endif /* _VL6180X_DEF */