Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of X_NUCLEO_6180XA1 by
vl6180x_platform.h
00001 /******************************************************************************* 00002 ################################################################################ 00003 # 00004 # This program is free software; you can redistribute it and/or modify it under 00005 # the terms of the GNU General Public License version 2 and only version 2 as 00006 # published by the Free Software Foundation. 00007 # 00008 # This program is distributed in the hope that it will be useful, but WITHOUT 00009 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00010 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00011 # details. 00012 # 00013 # You should have received a copy of the GNU General Public License along with 00014 # this program; if not, write to the Free Software Foundation, Inc., 00015 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00016 # 00017 #------------------------------------------------------------------------------ 00018 # Imaging Division 00019 ################################################################################ 00020 ********************************************************************************/ 00021 00022 00023 /* vl6180x_platform.h STM32 Nucleo F401 single device sample code project */ 00024 00025 #ifndef VL6180x_PLATFORM 00026 #define VL6180x_PLATFORM 00027 00028 00029 #include "vl6180x_def.h" 00030 00031 00032 #define VL6180x_SINGLE_DEVICE_DRIVER 0 00033 #define VL6180x_RANGE_STATUS_ERRSTRING 1 00034 #define VL6180X_SAFE_POLLING_ENTER 0 00035 #define VL6180X_LOG_ENABLE 0 00036 #define MY_LOG 1 00037 00038 #define VL6180x_DEV_DATA_ATTR 00039 #define ROMABLE_DATA 00040 00041 00042 #if VL6180X_LOG_ENABLE 00043 /* dot not include non ansi here trace was a case :( */ 00044 #ifdef TRACE 00045 #include "diag/trace.h" 00046 extern volatile uint32_t g_TickCnt; 00047 #define LOG_GET_TIME() g_TickCnt 00048 //#define LOG_GET_TIME() HAL_GetTick() 00049 #else 00050 /* these is nto stm32 vl6180x GNuArm eclpse build*/ 00051 #define trace_printf(...) (void)0 00052 #define LOG_GET_TIME() (int)0 /* add your code here expect to be an integer native (%d) type value */ 00053 #endif 00054 00055 00056 00057 #define LOG_FUNCTION_START(fmt, ... ) \ 00058 trace_printf("beg %s start @%d\t" fmt "\n", __func__, LOG_GET_TIME(), ##__VA_ARGS__) 00059 00060 #define LOG_FUNCTION_END(status)\ 00061 trace_printf("end %s @%d %d\n", __func__, LOG_GET_TIME(), (int)status) 00062 00063 #define LOG_FUNCTION_END_FMT(status, fmt, ... )\ 00064 trace_printf("End %s @%d %d\t"fmt"\n" , __func__, LOG_GET_TIME(), (int)status, ##__VA_ARGS__) 00065 00066 #define VL6180x_ErrLog(msg, ... )\ 00067 do{\ 00068 trace_printf("ERR in %s line %d\n" msg, __func__, __LINE__, ##__VA_ARGS__);\ 00069 }while(0) 00070 00071 #else /* VL6180X_LOG_ENABLE no logging */ 00072 //void OnErrLog(void); 00073 #define LOG_FUNCTION_START(...) (void)0 00074 #define LOG_FUNCTION_END(...) (void)0 00075 #define LOG_FUNCTION_END_FMT(...) (void)0 00076 #define VL6180x_ErrLog(... ) //OnErrLog() //(void)0 00077 #endif 00078 00079 00080 #ifdef MY_LOG /* define printf as pc.printf in order to change the baudrate */ 00081 extern Serial pc; 00082 #define printf(...) pc.printf(__VA_ARGS__) 00083 #endif 00084 00085 00086 #if VL6180x_SINGLE_DEVICE_DRIVER 00087 #error "VL6180x_SINGLE_DEVICE_DRIVER must be set" 00088 #endif 00089 00090 struct MyVL6180Dev_t { 00091 struct VL6180xDevData_t Data; 00092 uint8_t I2cAddr; 00093 //uint8_t DevID; 00094 00095 //misc flags for application 00096 unsigned Present:1; 00097 unsigned Ready:1; 00098 }; 00099 typedef struct MyVL6180Dev_t *VL6180xDev_t; 00100 00101 #define VL6180xDevDataGet(dev, field) (dev->Data.field) 00102 #define VL6180xDevDataSet(dev, field, data) (dev->Data.field)=(data) 00103 00104 00105 #endif /* VL6180x_PLATFORM */ 00106 00107 00108
Generated on Wed Jul 13 2022 03:00:33 by
 1.7.2
 1.7.2 
    