ST Expansion SW Team / Vl6180

Dependencies:   VL6180_Board

Dependents:   X_NUCLEO_6180

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers 6180a1.h Source File

6180a1.h

00001 /*******************************************************************************
00002 Copyright © 2019, STMicroelectronics International N.V.
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007     * Redistributions of source code must retain the above copyright
00008       notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright
00010       notice, this list of conditions and the following disclaimer in the
00011       documentation and/or other materials provided with the distribution.
00012     * Neither the name of STMicroelectronics nor the
00013       names of its contributors may be used to endorse or promote products
00014       derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
00019 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
00020 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
00021 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 ********************************************************************************/
00028 
00029 #ifndef XNUCLEO6180XA1_H_
00030 #define XNUCLEO6180XA1_H_
00031 
00032 #include "vl6180_types.h"
00033 
00034 
00035 #define SWITCH_VAL_RANGING  0
00036 
00037 /* function below must be provided  */
00038 void XNUCLEO6180XA1_WaitMilliSec(int SegDelayMs);
00039 /* optional list */
00040 void XNUCLEO6180XA1_UserIntHandler(void);
00041 
00042 /* provided */
00043 void XNUCLEO6180XA1_GPIO_Init(void);
00044 //void XNUCLEO6180XA1_I2C1_Init(I2C_HandleTypeDef *hi2c1);
00045 
00046 
00047 
00048 
00049 #ifdef __cplusplus
00050  extern "C" {
00051 #endif
00052 /**
00053  * @brief  tio be called by HAL EXTI handler dispatecher
00054  * @warning to be called only aftrer @a XNUCLEO6180XA1_I2C1_Init() get called
00055  * @param pin
00056  * @return  non 0 if the GPIO_pin is the GPIO pin for active VL6180x GPIO int line
00057  */
00058 int XNUCLEO6180XA1_EXTI_CallBackHandle(uint16_t GPIO_Pin);
00059 
00060 void XNUCLEO6180XA1_EnableInterrupt(void);
00061 void XNUCLEO6180XA1_DisableInterrupt(void);
00062 void XNUCLEO6180XA1_ClearInterrupt(void);
00063 int XNUCLEO6180XA1_GetSwitch(void);
00064 void XNUCLEO6180XA1_DisplayString(const char *str, int SegDelayMs);
00065 
00066 #ifdef __cplusplus
00067 }
00068 #endif
00069 void XNUCLEO6180XA1_Reset(int state);
00070 
00071 /**
00072  * @brief  get version of Expansion board
00073  * @warning to be called only aftrer @a XNUCLEO6180XA1_I2C1_Init() get called
00074  * @return True if connected shield is v2
00075  */
00076 int XNUCLEO6180XA1_IsV2(void);
00077 
00078 
00079 
00080 
00081 /*all function below only valid for v2 */
00082 #define XNUCLEO6180XA1_ID_TOP   0
00083 #define XNUCLEO6180XA1_ID_BOT   1
00084 #define XNUCLEO6180XA1_ID_LEFT  2
00085 #define XNUCLEO6180XA1_ID_RIGHT 3
00086 int XNUCLEO6180XA1_ResetId(int state, int id);
00087 
00088 #endif /* XNUCLEO6180XA1_H_ */
00089