-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from cparata/master
First release for VL6180X library
- Loading branch information
Showing
12 changed files
with
6,449 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
# VL6180X | ||
Arduino library to support the VL6180X Time-of-Flight and gesture-detection sensor | ||
Arduino library to support the VL6180X proximity and ambient light sensing (ALS) sensor | ||
|
||
## API | ||
|
||
This sensor uses I2C to communicate. And I2C instance is required to access to the sensor. | ||
|
||
The API provides simple distance measure and simple luminosity measure. | ||
|
||
## Documentation | ||
|
||
You can find the source files at | ||
https://github.com/stm32duino/VL6180X | ||
|
||
The VL6180X datasheet is available at | ||
http://www.st.com/content/st_com/en/products/imaging-and-photonics-solutions/proximity-sensors/vl6180x.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
####################################### | ||
# Syntax Coloring Map For VL6180X | ||
####################################### | ||
|
||
####################################### | ||
# Datatypes (KEYWORD1) | ||
####################################### | ||
|
||
ComponentObject KEYWORD1 | ||
LightSensor KEYWORD1 | ||
RangeSensor KEYWORD1 | ||
VL6180X KEYWORD1 | ||
|
||
####################################### | ||
# Methods and Functions (KEYWORD2) | ||
####################################### | ||
|
||
Init KEYWORD2 | ||
ReadID KEYWORD2 | ||
GetLight KEYWORD2 | ||
GetDistance KEYWORD2 | ||
VL6180X KEYWORD2 | ||
VL6180x_On KEYWORD2 | ||
VL6180x_Off KEYWORD2 | ||
InitSensor KEYWORD2 | ||
StartMeasurement KEYWORD2 | ||
GetMeasurement KEYWORD2 | ||
StopMeasurement KEYWORD2 | ||
Present KEYWORD2 | ||
WaitDeviceBooted KEYWORD2 | ||
SetupGPIO1 KEYWORD2 | ||
Prepare KEYWORD2 | ||
RangeStartContinuousMode KEYWORD2 | ||
RangeStartSingleShot KEYWORD2 | ||
RangeSetMaxConvergenceTime KEYWORD2 | ||
RangePollMeasurement KEYWORD2 | ||
RangeGetMeasurementIfReady KEYWORD2 | ||
RangeGetMeasurement KEYWORD2 | ||
RangeConfigInterrupt KEYWORD2 | ||
RangeGetInterruptStatus KEYWORD2 | ||
AlsPollMeasurement KEYWORD2 | ||
AlsGetMeasurement KEYWORD2 | ||
AlsConfigInterrupt KEYWORD2 | ||
AlsSetIntegrationPeriod KEYWORD2 | ||
AlsSetInterMeasurementPeriod KEYWORD2 | ||
AlsSetAnalogueGain KEYWORD2 | ||
AlsSetThresholds KEYWORD2 | ||
AlsGetInterruptStatus KEYWORD2 | ||
StaticInit KEYWORD2 | ||
RangeWaitDeviceReady KEYWORD2 | ||
RangeSetInterMeasPeriod KEYWORD2 | ||
UpscaleSetScaling KEYWORD2 | ||
UpscaleGetScaling KEYWORD2 | ||
GetUpperLimit KEYWORD2 | ||
RangeSetThresholds KEYWORD2 | ||
RangeGetThresholds KEYWORD2 | ||
RangeSetRawThresholds KEYWORD2 | ||
RangeSetEceFactor KEYWORD2 | ||
RangeSetEceState KEYWORD2 | ||
FilterSetState KEYWORD2 | ||
FilterGetState KEYWORD2 | ||
DMaxSetState KEYWORD2 | ||
DMaxGetState KEYWORD2 | ||
RangeSetSystemMode KEYWORD2 | ||
GetOffsetCalibrationData KEYWORD2 | ||
SetOffsetCalibrationData KEYWORD2 | ||
SetXTalkCompensationRate KEYWORD2 | ||
AlsWaitDeviceReady KEYWORD2 | ||
AlsSetSystemMode KEYWORD2 | ||
SetGroupParamHold KEYWORD2 | ||
SetI2CAddress KEYWORD2 | ||
SetupGPIOx KEYWORD2 | ||
SetGPIOxPolarity KEYWORD2 | ||
SetGPIOxFunctionality KEYWORD2 | ||
DisableGPIOxOut KEYWORD2 | ||
GetInterruptStatus KEYWORD2 | ||
ClearInterrupt KEYWORD2 | ||
AlsStartContinuousMode KEYWORD2 | ||
AlsStartSingleShot KEYWORD2 | ||
StartInterleavedMode KEYWORD2 | ||
GetDistance KEYWORD2 | ||
SetDeviceAddress KEYWORD2 | ||
PerformRefCalibration KEYWORD2 | ||
PerformRefSpadManagement KEYWORD2 | ||
SetDeviceMode KEYWORD2 | ||
SetMeasurementTimingBudgetMicroSeconds KEYWORD2 | ||
GetMeasurementDataReady KEYWORD2 | ||
GetRangingMeasurementData KEYWORD2 | ||
ClearInterruptMask KEYWORD2 | ||
|
||
####################################### | ||
# Constants (LITERAL1) | ||
####################################### | ||
|
||
VL6180x_DEFAULT_DEVICE_ADDRESS LITERAL1 | ||
VL6180x_API_REV_MAJOR LITERAL1 | ||
VL6180x_API_REV_MINOR LITERAL1 | ||
VL6180x_API_REV_SUB LITERAL1 | ||
VL6180x_UPSCALE_SUPPORT LITERAL1 | ||
VL6180x_ALS_SUPPORT LITERAL1 | ||
VL6180x_HAVE_DMAX_RANGING LITERAL1 | ||
VL6180x_EXTENDED_RANGE LITERAL1 | ||
VL6180x_WRAP_AROUND_FILTER_SUPPORT LITERAL1 | ||
VL6180x_HAVE_MULTI_READ LITERAL1 | ||
VL6180x_CACHED_REG LITERAL1 | ||
VL6180x_FIRST_CACHED_INDEX LITERAL1 | ||
VL6180x_LAST_CACHED_INDEX LITERAL1 | ||
VL6180x_CACHED_REG_CNT LITERAL1 | ||
VL6180x_MAX_I2C_XFER_SIZE LITERAL1 | ||
VL6180x_UPSCALE_SUPPORT LITERAL1 | ||
VL6180x_HAVE_UPSCALE_DATA LITERAL1 | ||
VL6180x_WRAP_AROUND_FILTER_SUPPORT LITERAL1 | ||
VL6180x_HAVE_WRAP_AROUND_DATA LITERAL1 | ||
VL6180x_ALS_SUPPORT LITERAL1 | ||
VL6180x_HAVE_ALS_DATA LITERAL1 | ||
VL6180x_HAVE_RATE_DATA LITERAL1 | ||
FILTER_NBOF_SAMPLES LITERAL1 | ||
IDENTIFICATION_MODEL_ID LITERAL1 | ||
IDENTIFICATION_MODULE_REV_MAJOR LITERAL1 | ||
IDENTIFICATION_MODULE_REV_MINOR LITERAL1 | ||
SYSTEM_MODE_GPIO0 LITERAL1 | ||
SYSTEM_MODE_GPIO1 LITERAL1 | ||
GPIOx_POLARITY_SELECT_MASK LITERAL1 | ||
GPIOx_FUNCTIONALITY_SELECT_SHIFT LITERAL1 | ||
GPIOx_FUNCTIONALITY_SELECT_MASK LITERAL1 | ||
GPIOx_SELECT_OFF LITERAL1 | ||
GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT LITERAL1 | ||
GPIOx_MODE_SELECT_RANGING LITERAL1 | ||
GPIOx_MODE_SELECT_ALS LITERAL1 | ||
SYSTEM_INTERRUPT_CONFIG_GPIO LITERAL1 | ||
CONFIG_GPIO_RANGE_SHIFT LITERAL1 | ||
CONFIG_GPIO_RANGE_MASK LITERAL1 | ||
CONFIG_GPIO_ALS_SHIFT LITERAL1 | ||
CONFIG_GPIO_ALS_MASK LITERAL1 | ||
CONFIG_GPIO_INTERRUPT_DISABLED LITERAL1 | ||
CONFIG_GPIO_INTERRUPT_LEVEL_LOW LITERAL1 | ||
CONFIG_GPIO_INTERRUPT_LEVEL_HIGH LITERAL1 | ||
CONFIG_GPIO_INTERRUPT_OUT_OF_WINDOW LITERAL1 | ||
CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY LITERAL1 | ||
SYSTEM_INTERRUPT_CLEAR LITERAL1 | ||
INTERRUPT_CLEAR_RANGING LITERAL1 | ||
INTERRUPT_CLEAR_ALS LITERAL1 | ||
INTERRUPT_CLEAR_ERROR LITERAL1 | ||
SYSTEM_FRESH_OUT_OF_RESET LITERAL1 | ||
SYSTEM_GROUPED_PARAMETER_HOLD LITERAL1 | ||
SYSRANGE_START LITERAL1 | ||
SYSRANGE_START_MODE_MASK LITERAL1 | ||
MODE_START_STOP LITERAL1 | ||
MODE_CONTINUOUS LITERAL1 | ||
MODE_SINGLESHOT LITERAL1 | ||
SYSRANGE_THRESH_HIGH LITERAL1 | ||
SYSRANGE_THRESH_LOW LITERAL1 | ||
SYSRANGE_INTERMEASUREMENT_PERIOD LITERAL1 | ||
SYSRANGE_MAX_CONVERGENCE_TIME LITERAL1 | ||
SYSRANGE_CROSSTALK_COMPENSATION_RATE LITERAL1 | ||
SYSRANGE_CROSSTALK_VALID_HEIGHT LITERAL1 | ||
SYSRANGE_EARLY_CONVERGENCE_ESTIMATE LITERAL1 | ||
SYSRANGE_PART_TO_PART_RANGE_OFFSET LITERAL1 | ||
SYSRANGE_RANGE_IGNORE_VALID_HEIGHT LITERAL1 | ||
SYSRANGE_RANGE_IGNORE_THRESHOLD LITERAL1 | ||
SYSRANGE_EMITTER_BLOCK_THRESHOLD LITERAL1 | ||
SYSRANGE_MAX_AMBIENT_LEVEL_THRESH LITERAL1 | ||
SYSRANGE_MAX_AMBIENT_LEVEL_MULT LITERAL1 | ||
SYSRANGE_RANGE_CHECK_ENABLES LITERAL1 | ||
RANGE_CHECK_ECE_ENABLE_MASK LITERAL1 | ||
RANGE_CHECK_RANGE_ENABLE_MASK LITERAL1 | ||
RANGE_CHECK_SNR_ENABLE LITERAL1 | ||
SYSRANGE_VHV_RECALIBRATE LITERAL1 | ||
SYSRANGE_VHV_REPEAT_RATE LITERAL1 | ||
SYSALS_START LITERAL1 | ||
SYSALS_THRESH_HIGH LITERAL1 | ||
SYSALS_THRESH_LOW LITERAL1 | ||
SYSALS_INTERMEASUREMENT_PERIOD LITERAL1 | ||
SYSALS_ANALOGUE_GAIN LITERAL1 | ||
SYSALS_INTEGRATION_PERIOD LITERAL1 | ||
RESULT_RANGE_STATUS LITERAL1 | ||
RANGE_DEVICE_READY_MASK LITERAL1 | ||
RANGE_ERROR_CODE_MASK LITERAL1 | ||
RANGE_ERROR_CODE_SHIFT LITERAL1 | ||
RESULT_ALS_STATUS LITERAL1 | ||
ALS_DEVICE_READY_MASK LITERAL1 | ||
RESULT_ALS_VAL LITERAL1 | ||
FW_ALS_RESULT_SCALER LITERAL1 | ||
RESULT_INTERRUPT_STATUS_GPIO LITERAL1 | ||
RES_INT_RANGE_SHIFT LITERAL1 | ||
RES_INT_ALS_SHIFT LITERAL1 | ||
RES_INT_ERROR_SHIFT LITERAL1 | ||
RES_INT_RANGE_MASK LITERAL1 | ||
RES_INT_ALS_MASK LITERAL1 | ||
RES_INT_STAT_GPIO_LOW_LEVEL_THRESHOLD LITERAL1 | ||
RES_INT_STAT_GPIO_HIGH_LEVEL_THRESHOLD LITERAL1 | ||
RES_INT_STAT_GPIO_OUT_OF_WINDOW LITERAL1 | ||
RES_INT_STAT_GPIO_NEW_SAMPLE_READY LITERAL1 | ||
RES_INT_ERROR_MASK LITERAL1 | ||
RES_INT_ERROR_LASER_SAFETY LITERAL1 | ||
RES_INT_ERROR_PLL LITERAL1 | ||
RESULT_RANGE_VAL LITERAL1 | ||
RESULT_RANGE_RAW LITERAL1 | ||
RESULT_RANGE_SIGNAL_RATE LITERAL1 | ||
RESULT_RANGE_RETURN_SIGNAL_COUNT LITERAL1 | ||
RESULT_RANGE_REFERENCE_SIGNAL_COUNT LITERAL1 | ||
RESULT_RANGE_RETURN_AMB_COUNT LITERAL1 | ||
RESULT_RANGE_REFERENCE_AMB_COUNT LITERAL1 | ||
RESULT_RANGE_RETURN_CONV_TIME LITERAL1 | ||
RESULT_RANGE_REFERENCE_CONV_TIME LITERAL1 | ||
RANGE_SCALER LITERAL1 | ||
READOUT_AVERAGING_SAMPLE_PERIOD LITERAL1 | ||
I2C_SLAVE_DEVICE_ADDRESS LITERAL1 | ||
VL6180x_SINGLE_DEVICE_DRIVER LITERAL1 | ||
VL6180x_RANGE_STATUS_ERRSTRING LITERAL1 | ||
VL6180X_SAFE_POLLING_ENTER LITERAL1 | ||
VL6180X_LOG_ENABLE LITERAL1 | ||
MY_LOG LITERAL1 | ||
VL6180x_DEV_DATA_ATTR LITERAL1 | ||
ROMABLE_DATA LITERAL1 | ||
TEMP_BUF_SIZE LITERAL1 | ||
DEF_ECE_FACTOR_M LITERAL1 | ||
DEF_ECE_FACTOR_D LITERAL1 | ||
DEF_INT_PEFRIOD LITERAL1 | ||
DEF_ALS_GAIN LITERAL1 | ||
DEF_ALS_SCALER LITERAL1 | ||
DEF_DMAX_ENABLE LITERAL1 | ||
DEF_AMBIENT_TUNING LITERAL1 | ||
DEF_CROSS_TALK_VALID_HEIGHT_VALUE LITERAL1 | ||
LUXRES_FIX_PREC LITERAL1 | ||
GAIN_FIX_PREC LITERAL1 | ||
AN_GAIN_MULT LITERAL1 | ||
DEF_UPSCALE LITERAL1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name=STM32duino VL6180X | ||
version=1.0.0 | ||
author=AST | ||
maintainer=stm32duino | ||
sentence=Allows controlling the VL6180X (proximity and ambient light sensing (ALS) sensor) | ||
paragraph=This library provides simple measure distance in mm and simple luminosity measure in lux. | ||
category=Device Control | ||
url=https://github.com/stm32duino/VL6180X | ||
architectures=stm32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
****************************************************************************** | ||
* @file ComponentObject.h | ||
* @author AST | ||
* @version V1.0.0 | ||
* @date April 13th, 2015 | ||
* @brief This file contains the abstract class describing the interface of a | ||
* generic component. | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* 3. Neither the name of STMicroelectronics nor the names of its contributors | ||
* may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
|
||
/* Define to prevent recursive inclusion -------------------------------------*/ | ||
|
||
#ifndef __COMPONENT_OBJECT_CLASS_H | ||
#define __COMPONENT_OBJECT_CLASS_H | ||
|
||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
|
||
#include <stdint.h> | ||
|
||
|
||
/* Classes ------------------------------------------------------------------*/ | ||
|
||
/** An abstract class for Generic components. | ||
*/ | ||
class ComponentObject | ||
{ | ||
public: | ||
/** | ||
* @brief Initializing the component. | ||
* @param[in] init pointer to device specific initalization structure. | ||
* @retval "0" in case of success, an error code otherwise. | ||
*/ | ||
virtual int Init() = 0; | ||
|
||
/** | ||
* @brief Getting the ID of the component. | ||
* @param[out] id pointer to an allocated variable to store the ID into. | ||
* @retval "0" in case of success, an error code otherwise. | ||
*/ | ||
virtual int ReadID() = 0; | ||
}; | ||
|
||
#endif /* __COMPONENT_OBJECT_CLASS_H */ | ||
|
||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
****************************************************************************** | ||
* @file LightSensor.h | ||
* @author AST / EST | ||
* @version V0.0.1 | ||
* @date 13-April-2015 | ||
* @brief This file contains the abstract class describing in general | ||
* the interfaces of an ambient light sensor (ALS) | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* 3. Neither the name of STMicroelectronics nor the names of its contributors | ||
* may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
/* Define to prevent from recursive inclusion --------------------------------*/ | ||
#ifndef __LIGHT_SENSOR_CLASS_H | ||
#define __LIGHT_SENSOR_CLASS_H | ||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
#include <ComponentObject.h> | ||
|
||
/* Classes ------------------------------------------------------------------*/ | ||
/** An abstract class for ambient light sensors | ||
*/ | ||
class LightSensor : public ComponentObject | ||
{ | ||
public: | ||
/** | ||
* @brief Get current light [lux] | ||
* @param[out] piData Pointer to where to store light to | ||
* @return 0 in case of success, an error code otherwise | ||
*/ | ||
virtual int GetLight(uint32_t *piData) = 0; | ||
}; | ||
|
||
#endif /* __LIGHT_SENSOR_CLASS_H */ |
Oops, something went wrong.