AVRly - AVR Development Resources
log_system.h
Go to the documentation of this file.
1/******************************************************************************
2 @copyright Copyright © 2022 by Jason Duffy.
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21******************************************************************************/
22
23/**
24 * @file log_system.h
25 * @ingroup mcp48x2
26 * @author Jason Duffy
27 * @date 1st March 2022
28 * @brief Driver file providing logging functionality over USART, to print
29 * debug messages and values to a teminal program on your PC.
30 * @bug No known bugs.
31 */
32
33#ifndef LOG_SYSTEM_DOT_H
34#define LOG_SYSTEM_DOT_H
35
36enum eLogLevel {NONE, INFO, DEBUG, VERBOSE_DEBUG, WARNING, ERROR};
37
38// Initialisation routine
39void init_log_system(void);
40
41// Sends only a string message
42void log_message(const char *p_tag, enum eLogLevel level, const char *msg);
43
44// Sends a string, followed by a value in decimal format
45void log_message_with_dec_val(const char *p_tag,
46 enum eLogLevel level,
47 const char *msg,
48 uint8_t val);
49
50// Sends a string, followed by an integer (5 ASCII digits)
51void log_message_with_16bit_dec_val(const char *p_tag,
52 enum eLogLevel level,
53 const char *msg,
54 uint16_t val);
55
56// Sends a string, followed by a value in binary format
57void log_message_with_bin_val(const char *p_tag,
58 enum eLogLevel level,
59 const char *msg,
60 uint8_t val);
61
62// Sends a string, followed by a value in binary format
63void log_message_with_16bit_bin_val(const char *p_tag,
64 enum eLogLevel level,
65 const char *msg,
66 uint16_t val);
67
68// Sends a string, followed by a value in hexadecimal format
69void log_message_with_hex_val(const char *p_tag,
70 enum eLogLevel level,
71 const char *msg,
72 uint8_t val);
73
74// Sets level of logging required
75void log_set_output_level(const char *p_tag, enum eLogLevel level);
76
77// Turns logging system on globally
78void log_global_on(void);
79
80// Turns logging system off globally
81void log_global_off(void);
82
83#endif // LOG_SYSTEM_DOT_H
84
85/*** end of file ***/
void log_message_with_dec_val(log_system_config_t *p_config, log_type_t level, const char *msg, uint8_t val)
Sends a string, followed by an 8 bit value in decimal format.
Definition: log_system.c:116
void log_global_on(void)
Turns logging system on globally.
Definition: log_system.c:133
void init_log_system(void)
Initialisation routine - call this function once at startup before using other functions.
Definition: log_system.c:46
void log_message_with_hex_val(log_system_config_t *p_config, log_type_t level, const char *msg, uint8_t val)
Sends a string, followed by an 8 bit value in hexadecimal format.
Definition: log_system.c:193
void log_global_off(void)
Turns logging system off globally.
Definition: log_system.c:139
void log_message(log_system_config_t *p_config, log_type_t level, const char *msg)
Sends only the system tag, log level and message string.
Definition: log_system.c:93
void log_message_with_bin_val(log_system_config_t *p_config, log_type_t level, const char *msg, uint8_t val)
Sends a string, followed by an 8 bit value in binary format.
Definition: log_system.c:167