-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdebug.h
More file actions
124 lines (88 loc) · 3.26 KB
/
Copy pathdebug.h
File metadata and controls
124 lines (88 loc) · 3.26 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//! @file debug.h
/*
* debug.h
*
* Created on: Dec 10, 2024
* Author: micahbly
*/
// This is the debug stuff extracted from general.c. Differs from f256e version by not relying on fatFS
#ifndef DEBUG_H_
#define DEBUG_H_
/* about this class
*
*
*
*** things this class needs to be able to do
* print debug statements to file or screen or RS232
* (all functions in this class are excluded from compiling unless one or more debug LOG_LEVEL_1, etc macros are defined)
*
*** things objects of this class have
*
*
*/
/*****************************************************************************/
/* Includes */
/*****************************************************************************/
// project includes
//#include "text.h"
// C includes
#include <stdbool.h>
// F256 includes
/*****************************************************************************/
/* Macro Definitions */
/*****************************************************************************/
#ifdef LOG_LEVEL_1
#define LOG_ERR(x) General_LogError x
#else
#define LOG_ERR(x)
#endif
#ifdef LOG_LEVEL_2
#define LOG_WARN(x) General_LogWarning x
#else
#define LOG_WARN(x)
#endif
#ifdef LOG_LEVEL_3
#define LOG_INFO(x) General_LogInfo x
#else
#define LOG_INFO(x)
#endif
#ifdef LOG_LEVEL_4
#define DEBUG_OUT(x) General_DebugOut x
#else
#define DEBUG_OUT(x)
#endif
#ifdef LOG_LEVEL_5
#define LOG_ALLOC(x) General_LogAlloc x
#else
#define LOG_ALLOC(x)
#endif
/*****************************************************************************/
/* Enumerations */
/*****************************************************************************/
#define LogError 0
#define LogWarning 1
#define LogInfo 2
#define LogDebug 3
#define LogAlloc 4
/*****************************************************************************/
/* Structs */
/*****************************************************************************/
/*****************************************************************************/
/* Global Variables */
/*****************************************************************************/
/*****************************************************************************/
/* Public Function Prototypes */
/*****************************************************************************/
// **** LOGGING AND DEBUG UTILITIES *****
// // Print out a section of memory in a hex viewer style
// // display length is hard-coded to one screen at 80x59 (MEM_DUMP_BYTES_PER_ROW * MAX_TEXT_VIEW_ROWS_PER_PAGE)
// void General_ViewHexDump(uint8_t* the_buffer);
// ********* logging functionality. requires global_log_file to have been opened.
void General_LogError(const char* format, ...);
void General_LogWarning(const char* format, ...);
void General_LogInfo(const char* format, ...);
void General_DebugOut(const char* format, ...);
void General_LogAlloc(const char* format, ...);
bool General_LogInitialize(void);
void General_LogCleanUp(void);
#endif /* DEBUG_H_ */