Now you can use NC as InterruptIn
Fork of X_NUCLEO_6180XA1 by
Diff: Components/VL6180X/vl6180x_platform.h
- Revision:
- 10:4954b09b72d8
- Parent:
- 8:f943a1fca15f
- Child:
- 16:0d4776564733
diff -r 9cbc1736f148 -r 4954b09b72d8 Components/VL6180X/vl6180x_platform.h --- a/Components/VL6180X/vl6180x_platform.h Tue Sep 29 15:40:08 2015 +0200 +++ b/Components/VL6180X/vl6180x_platform.h Tue Oct 06 09:03:10 2015 +0200 @@ -1,48 +1,42 @@ /******************************************************************************* -Copyright © 2014, STMicroelectronics International N.V. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * 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. - * 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, FITNESS FOR A PARTICULAR PURPOSE, AND -NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED. -IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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. +################################################################################ +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License version 2 and only version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +#------------------------------------------------------------------------------ +# Imaging Division +################################################################################ ********************************************************************************/ - -/* vl6180x_platform.h STM32 Nucelo F401 single device using generic cci-i2c - * trace via swo port some GnuArm eclipse toolset */ +/* vl6180x_platform.h STM32 Nucleo F401 single device sample code project */ #ifndef VL6180x_PLATFORM #define VL6180x_PLATFORM + #include "vl6180x_def.h" +#define VL6180x_SINGLE_DEVICE_DRIVER 0 +#define VL6180x_RANGE_STATUS_ERRSTRING 1 +#define VL6180X_SAFE_POLLING_ENTER 0 +#define VL6180X_LOG_ENABLE 0 + #define VL6180x_DEV_DATA_ATTR - #define ROMABLE_DATA -/* #define ROMABLE_DATA __attribute__ ((section ("user_rom"))) */ - #if VL6180X_LOG_ENABLE @@ -51,6 +45,7 @@ #include "diag/trace.h" extern volatile uint32_t g_TickCnt; #define LOG_GET_TIME() g_TickCnt +//#define LOG_GET_TIME() HAL_GetTick() #else /* these is nto stm32 vl6180x GNuArm eclpse build*/ #define trace_printf(...) (void)0 @@ -74,29 +69,32 @@ }while(0) #else /* VL6180X_LOG_ENABLE no logging */ - void OnErrLog(void); - #define LOG_FUNCTION_START(...) (void)0 - #define LOG_FUNCTION_END(...) (void)0 - #define LOG_FUNCTION_END_FMT(...) (void)0 - #define VL6180x_ErrLog(... ) OnErrLog() +void OnErrLog(void); + #define LOG_FUNCTION_START(...) (void)0 + #define LOG_FUNCTION_END(...) (void)0 + #define LOG_FUNCTION_END_FMT(...) (void)0 + #define VL6180x_ErrLog(... ) OnErrLog() //(void)0 #endif - typedef struct MyVL6180Dev_t { - struct VL6180xDevData_t Data; - uint8_t I2cAddr; - uint8_t DevID; +#if VL6180x_SINGLE_DEVICE_DRIVER + #error "VL6180x_SINGLE_DEVICE_DRIVER must be set" +#endif + +struct MyVL6180Dev_t { + struct VL6180xDevData_t Data; + uint8_t I2cAddr; + //uint8_t DevID; - // misc flags for application - unsigned Present:1; - unsigned Ready:1; - }VL6180xDev_t; + //misc flags for application + unsigned Present:1; + unsigned Ready:1; +}; +typedef struct MyVL6180Dev_t *VL6180xDev_t; +#define VL6180xDevDataGet(dev, field) (dev->Data.field) +#define VL6180xDevDataSet(dev, field, data) (dev->Data.field)=(data) -#define VL6180xDevDataGet(dev, field) (dev.Data.field) -#define VL6180xDevDataSet(dev, field, data) (dev.Data.field)=(data) - -//#endif /* #else VL6180x_SINGLE_DEVICE_DRIVER */ void VL6180x_PollDelay(VL6180xDev_t dev);