AVRly - AVR Development Resources
main.c File Reference

Main routine for log_system example application. More...

#include <util/delay.h>
#include "log_system.h"

Go to the source code of this file.

Macros

#define DELAY_TIME   1000
 
#define INCREMENT_VAL   1
 

Functions

int main ()
 Main routine for example application. More...
 

Variables

log_system_config_t main_log
 Instantiation of log_system config object. More...
 
uint8_t example_variable = 59
 Example variable to be output to log_system. More...
 

Detailed Description

Main routine for log_system example application.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author
Jason Duffy
Date
1st March 2022

Definition in file main.c.

Macro Definition Documentation

◆ DELAY_TIME

#define DELAY_TIME   1000

Definition at line 35 of file main.c.

◆ INCREMENT_VAL

#define INCREMENT_VAL   1

Definition at line 36 of file main.c.

Function Documentation

◆ main()

int main ( )

Main routine for example application.

Definition at line 57 of file main.c.

58{
59 // Setup
61 log_message(&main_log, INFO, "Hello, World!");
62 _delay_ms(DELAY_TIME);
63
64 // Loop forever
65 while(1)
66 {
67 /*
68 * This message is NOT printed, as the level is above that specified in
69 * main_log.file_log_level
70 */
71 log_message(&main_log, VERBOSE_DEBUG, "Verbose Debug Message.");
72 _delay_ms(DELAY_TIME);
73
74 // This message IS printed.
75 log_message_with_bin_val(&main_log, DEBUG,
76 "The binary format value of example_variable is: ",
78
79 // As is this one.
80 log_message_with_dec_val(&main_log, DEBUG,
81 "The decimal format value of example_variable is: ",
83
84 // And this one.
85 log_message_with_hex_val(&main_log, DEBUG,
86 "The hexadecimal format value of example_variable is: ",
88
89 // Edit variable value.
90 example_variable += INCREMENT_VAL;
91 _delay_ms(DELAY_TIME);
92 }
93
94 return 0;
95}
void init_log_system(void)
Initialisation routine - call this function once at startup before using other functions.
Definition: log_system.c:46
uint8_t example_variable
Example variable to be output to log_system.
Definition: main.c:51
log_system_config_t main_log
Instantiation of log_system config object.
Definition: main.c:42

Variable Documentation

◆ main_log

Initial value:
=
{
.p_system_tag = "Main",
.file_log_level = DEBUG,
}

Instantiation of log_system config object.

Definition at line 42 of file main.c.

◆ example_variable

uint8_t example_variable = 59

Example variable to be output to log_system.

Definition at line 51 of file main.c.