commentata la ridefinizione di tipo bool_t in i2c

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Dependents:   BSP_B-L475E-IOT01

Fork of VL53L0X by ST

Committer:
fabio_gatti
Date:
Tue Aug 07 10:42:54 2018 +0000
Revision:
5:b9e37102d4b8
Parent:
2:d07edeaff6f1
commento alla redefinizione di tipo bool_t

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nikapov 0:a1a69d32f310 1 /*******************************************************************************
nikapov 0:a1a69d32f310 2 Copyright © 2015, STMicroelectronics International N.V.
nikapov 0:a1a69d32f310 3 All rights reserved.
nikapov 0:a1a69d32f310 4
nikapov 0:a1a69d32f310 5 Redistribution and use in source and binary forms, with or without
nikapov 0:a1a69d32f310 6 modification, are permitted provided that the following conditions are met:
nikapov 0:a1a69d32f310 7 * Redistributions of source code must retain the above copyright
nikapov 0:a1a69d32f310 8 notice, this list of conditions and the following disclaimer.
nikapov 0:a1a69d32f310 9 * Redistributions in binary form must reproduce the above copyright
nikapov 0:a1a69d32f310 10 notice, this list of conditions and the following disclaimer in the
nikapov 0:a1a69d32f310 11 documentation and/or other materials provided with the distribution.
nikapov 0:a1a69d32f310 12 * Neither the name of STMicroelectronics nor the
nikapov 0:a1a69d32f310 13 names of its contributors may be used to endorse or promote products
nikapov 0:a1a69d32f310 14 derived from this software without specific prior written permission.
nikapov 0:a1a69d32f310 15
nikapov 0:a1a69d32f310 16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
nikapov 0:a1a69d32f310 17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
nikapov 0:a1a69d32f310 18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
nikapov 0:a1a69d32f310 19 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
nikapov 0:a1a69d32f310 20 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
nikapov 0:a1a69d32f310 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
nikapov 0:a1a69d32f310 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
nikapov 0:a1a69d32f310 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
nikapov 0:a1a69d32f310 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
nikapov 0:a1a69d32f310 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
nikapov 0:a1a69d32f310 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nikapov 0:a1a69d32f310 27 ********************************************************************************/
nikapov 0:a1a69d32f310 28
nikapov 0:a1a69d32f310 29
nikapov 0:a1a69d32f310 30 #ifndef _VL53L0X_PLATFORM_LOG_H_
nikapov 0:a1a69d32f310 31 #define _VL53L0X_PLATFORM_LOG_H_
nikapov 0:a1a69d32f310 32
nikapov 0:a1a69d32f310 33 #include <stdio.h>
nikapov 0:a1a69d32f310 34 #include <string.h>
nikapov 0:a1a69d32f310 35 /* LOG Functions */
nikapov 0:a1a69d32f310 36
nikapov 0:a1a69d32f310 37 #ifdef __cplusplus
nikapov 0:a1a69d32f310 38 extern "C" {
nikapov 0:a1a69d32f310 39 #endif
nikapov 0:a1a69d32f310 40
nikapov 0:a1a69d32f310 41 /**
nikapov 0:a1a69d32f310 42 * @file vl53l0_platform_log.h
nikapov 0:a1a69d32f310 43 *
nikapov 0:a1a69d32f310 44 * @brief platform log function definition
nikapov 0:a1a69d32f310 45 */
nikapov 0:a1a69d32f310 46
nikapov 0:a1a69d32f310 47 //#define VL53L0X_LOG_ENABLE 0
nikapov 0:a1a69d32f310 48
nikapov 0:a1a69d32f310 49 enum {
nikapov 0:a1a69d32f310 50 TRACE_LEVEL_NONE,
nikapov 0:a1a69d32f310 51 TRACE_LEVEL_ERRORS,
nikapov 0:a1a69d32f310 52 TRACE_LEVEL_WARNING,
nikapov 0:a1a69d32f310 53 TRACE_LEVEL_INFO,
nikapov 0:a1a69d32f310 54 TRACE_LEVEL_DEBUG,
nikapov 0:a1a69d32f310 55 TRACE_LEVEL_ALL,
nikapov 0:a1a69d32f310 56 TRACE_LEVEL_IGNORE
nikapov 0:a1a69d32f310 57 };
nikapov 0:a1a69d32f310 58
nikapov 0:a1a69d32f310 59 enum {
nikapov 0:a1a69d32f310 60 TRACE_FUNCTION_NONE = 0,
nikapov 0:a1a69d32f310 61 TRACE_FUNCTION_I2C = 1,
nikapov 0:a1a69d32f310 62 TRACE_FUNCTION_ALL = 0x7fffffff //all bits except sign
nikapov 0:a1a69d32f310 63 };
nikapov 0:a1a69d32f310 64
nikapov 0:a1a69d32f310 65 enum {
nikapov 0:a1a69d32f310 66 TRACE_MODULE_NONE = 0x0,
nikapov 0:a1a69d32f310 67 TRACE_MODULE_API = 0x1,
nikapov 0:a1a69d32f310 68 TRACE_MODULE_PLATFORM = 0x2,
nikapov 0:a1a69d32f310 69 TRACE_MODULE_ALL = 0x7fffffff //all bits except sign
nikapov 0:a1a69d32f310 70 };
nikapov 0:a1a69d32f310 71
nikapov 0:a1a69d32f310 72
nikapov 0:a1a69d32f310 73 #ifdef VL53L0X_LOG_ENABLE
nikapov 0:a1a69d32f310 74
nikapov 0:a1a69d32f310 75 #include <sys/time.h>
nikapov 0:a1a69d32f310 76
nikapov 0:a1a69d32f310 77 extern uint32_t _trace_level;
nikapov 0:a1a69d32f310 78
nikapov 0:a1a69d32f310 79
nikapov 0:a1a69d32f310 80
nikapov 0:a1a69d32f310 81 int32_t VL53L0X_trace_config(char *filename, uint32_t modules, uint32_t level, uint32_t functions);
nikapov 0:a1a69d32f310 82
nikapov 0:a1a69d32f310 83 void trace_print_module_function(uint32_t module, uint32_t level, uint32_t function, const char *format, ...);
nikapov 0:a1a69d32f310 84
nikapov 0:a1a69d32f310 85
nikapov 0:a1a69d32f310 86 //extern FILE * log_file;
nikapov 0:a1a69d32f310 87
nikapov 0:a1a69d32f310 88 #define LOG_GET_TIME() (int)clock()
nikapov 0:a1a69d32f310 89
nikapov 0:a1a69d32f310 90 #define _LOG_FUNCTION_START(module, fmt, ... ) \
nikapov 0:a1a69d32f310 91 trace_print_module_function(module, _trace_level, TRACE_FUNCTION_ALL, "%ld <START> %s "fmt"\n", LOG_GET_TIME(), __FUNCTION__, ##__VA_ARGS__);
nikapov 0:a1a69d32f310 92
nikapov 0:a1a69d32f310 93 #define _LOG_FUNCTION_END(module, status, ... )\
nikapov 0:a1a69d32f310 94 trace_print_module_function(module, _trace_level, TRACE_FUNCTION_ALL, "%ld <END> %s %d\n", LOG_GET_TIME(), __FUNCTION__, (int)status, ##__VA_ARGS__)
nikapov 0:a1a69d32f310 95
nikapov 0:a1a69d32f310 96 #define _LOG_FUNCTION_END_FMT(module, status, fmt, ... )\
nikapov 0:a1a69d32f310 97 trace_print_module_function(module, _trace_level, TRACE_FUNCTION_ALL, "%ld <END> %s %d "fmt"\n", LOG_GET_TIME(), __FUNCTION__, (int)status,##__VA_ARGS__)
nikapov 0:a1a69d32f310 98
nikapov 0:a1a69d32f310 99 // __func__ is gcc only
nikapov 0:a1a69d32f310 100 #define VL53L0X_ErrLog( fmt, ...) fprintf(stderr, "VL53L0X_ErrLog %s" fmt "\n", __func__, ##__VA_ARGS__)
nikapov 0:a1a69d32f310 101
nikapov 0:a1a69d32f310 102 #else /* VL53L0X_LOG_ENABLE no logging */
Davidroid 2:d07edeaff6f1 103 #define VL53L0X_ErrLog(...) (void)0
Davidroid 2:d07edeaff6f1 104 #define _LOG_FUNCTION_START(module, fmt, ... ) (void)0
Davidroid 2:d07edeaff6f1 105 #define _LOG_FUNCTION_END(module, status, ... ) (void)0
Davidroid 2:d07edeaff6f1 106 #define _LOG_FUNCTION_END_FMT(module, status, fmt, ... ) (void)0
nikapov 0:a1a69d32f310 107 #endif /* else */
nikapov 0:a1a69d32f310 108
nikapov 0:a1a69d32f310 109 #define VL53L0X_COPYSTRING(str, ...) strcpy(str, ##__VA_ARGS__)
nikapov 0:a1a69d32f310 110
nikapov 0:a1a69d32f310 111 #ifdef __cplusplus
nikapov 0:a1a69d32f310 112 }
nikapov 0:a1a69d32f310 113 #endif
nikapov 0:a1a69d32f310 114
nikapov 0:a1a69d32f310 115 #endif /* _VL53L0X_PLATFORM_LOG_H_ */
nikapov 0:a1a69d32f310 116
nikapov 0:a1a69d32f310 117
nikapov 0:a1a69d32f310 118
nikapov 0:a1a69d32f310 119