px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
px_log_cfg_template.h
1#ifndef __PX_LOG_CFG_H__
2#define __PX_LOG_CFG_H__
3/* =============================================================================
4 ____ ___ ____ ___ _ _ ___ __ __ ___ __ __ TM
5 | _ \ |_ _| / ___| / _ \ | \ | | / _ \ | \/ | |_ _| \ \/ /
6 | |_) | | | | | | | | | | \| | | | | | | |\/| | | | \ /
7 | __/ | | | |___ | |_| | | |\ | | |_| | | | | | | | / \
8 |_| |___| \____| \___/ |_| \_| \___/ |_| |_| |___| /_/\_\
9
10 Copyright (c) 2014 Pieter Conradie <https://piconomix.com>
11
12 License: MIT
13 https://github.com/piconomix/px-fwlib/blob/master/LICENSE.md
14
15 Title: px_log_cfg.h : Debug module configuration
16 Author(s): Pieter Conradie
17 Creation Date: 2014-01-17
18
19============================================================================= */
20
21/**
22 * @addtogroup PX_LOG
23 *
24 * @{
25 */
26
27/* _____STANDARD INCLUDES____________________________________________________ */
28
29/* _____PROJECT INCLUDES_____________________________________________________ */
30#include "px_defs.h"
31
32/* _____DEFINITIONS__________________________________________________________ */
33// PX_LOG symbol not defined in Makefile?
34#ifndef PX_LOG
35/// Disable (0) or Enable (1) debug log output
36#define PX_LOG 0
37#endif
38
39// PX_LOG_CFG_LEVEL symbol not defined in Makefile?
40#ifndef PX_LOG_CFG_LEVEL
41/**
42 * Set *COMPILE TIME* log output level.
43 *
44 * The levels are sorted in increasing levels of verbosity. For example if
45 * PX_LOG_CFG_LEVEL is set to PX_LOG_LEVEL_INFO then all ERROR, WARNING and
46 * INFO messages will be included in the code but DEBUG and VERBOSE messages
47 * will not.
48 */
49#define PX_LOG_CFG_LEVEL PX_LOG_LEVEL_INFO
50#endif
51
52/// Disable (0) or Enable (1) run time log filter
53#define PX_LOG_CFG_FILTER 0
54
55/// Disable (0) or Enable (1) VT100 terminal color output
56#define PX_LOG_CFG_COLOR 1
57
58/// Debug output string buffer size
59#define PX_LOG_CFG_BUF_SIZE 64
60
61/// Provide function to output log timestamp
62#if 0
63// Example 1: Create timestamp using sysclk tick
64#include "px_sysclk.h"
65#define PX_LOG_CFG_TIMESTAMP(str) sprintf(str, "%08lu", (uint32_t)px_sysclk_get_tick_count())
66#endif
67#if 0
68// Example 2: Call a function in 'main.h'
69#include "main.h"
70#define PX_LOG_CFG_TIMESTAMP(str) main_log_timestamp(str)
71#endif
72
73/// Provide function to output log character
74#if 0
75// Example 1: Direct debug output to stderr
76#include <stdio.h>
77#define PX_LOG_CFG_PUTCHAR(data) putc(data, stderr)
78#endif
79#if 0
80// Example 2: Use UART and handle created in main
81#include "px_uart.h"
82#include "main.h"
83#define PX_LOG_CFG_PUTCHAR(data) px_uart_putchar(&main_uart_handle, data)
84#endif
85#if 0
86// Example 3: Call function in main
87#include "main.h"
88#define PX_LOG_CFG_PUTCHAR(data) main_log_putchar(data)
89#endif
90
91/// @}
92#endif