-
Notifications
You must be signed in to change notification settings - Fork 0
/
vl53l0x_platform_log.c
59 lines (48 loc) · 1.58 KB
/
vl53l0x_platform_log.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* COPYRIGHT (C) STMicroelectronics 2015. All rights reserved.
*
* This software is the confidential and proprietary information of
* STMicroelectronics ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with STMicroelectronics
*
* Programming Golden Rule: Keep it Simple!
*
*/
/*!
* \file VL53L0X_platform_log.c
* \brief Code function defintions for Ewok Platform Layer
*
*/
#include <stdio.h> // sprintf(), vsnprintf(), printf()
#include <stdarg.h> // sprintf(), vsnprintf(), printf()
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
#include "vl53l0x_def.h"
#include "vl53l0x_platform_log.h"
uint32_t _trace_level = TRACE_LEVEL_WARNING;
uint32_t _trace_modules = TRACE_MODULE_NONE;
uint32_t _trace_functions = TRACE_FUNCTION_NONE;
#if defined(VL53L0X_LOG_ENABLE) && (TRACE_UART==1)
int32_t VL53L0X_trace_config(char *filename, uint32_t modules, uint32_t level, uint32_t functions)
{
int STATUS = 0;
_trace_functions = functions;
_trace_level = level;
_trace_modules = modules;
return STATUS;
}
void trace_print_module_function(uint32_t module, uint32_t level, uint32_t function, const char *format, ...)
{
if ( ((level <=_trace_level) && ((module & _trace_modules) > 0))
|| ((function & _trace_functions) > 0) )
{
va_list arg_list;
va_start(arg_list, format);
trace_vprintf( format, arg_list);
va_end(arg_list);
}
}
#endif