Skip to content
This repository has been archived by the owner on Dec 29, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' into upstream-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
beejjacobs committed Sep 15, 2015
2 parents 9969574 + 39883e1 commit 59f2a01
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions debug.axi
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ char DEBUG_OFF = 0 // Available debug verbosity levels
char DEBUG_ERROR = 1
char DEBUG_WARN = 2
char DEBUG_INFO = 3
char DEBUG_DEBUG = 4

char DEBUG_LEVEL_STRINGS[4][16] = {
char DEBUG_MAX_LEVEL = 4

char DEBUG_LEVEL_STRINGS[5][16] = {
'Off',
'Error',
'Warn',
'Info'
'Info',
'Debug'
}


Expand Down Expand Up @@ -70,7 +74,7 @@ define_function char debug_get_level_from_string(char x[]) {
*/
define_function debug_set_level(char x)
{
if (x >= DEBUG_OFF && x <= DEBUG_INFO) {
if (x >= DEBUG_OFF && x <= DEBUG_MAX_LEVEL) {
println("'Debug level set to ', debug_get_level_string(x)")
debug_level = x
} else {
Expand All @@ -97,7 +101,7 @@ define_function debug_msg(char msg_level, char msg[])
stack_var char out[255];
stack_var char in[255];

if (msg_level < DEBUG_ERROR || msg_level > DEBUG_INFO) {
if (msg_level < DEBUG_ERROR || msg_level > DEBUG_MAX_LEVEL) {
debug_msg(DEBUG_ERROR, "'invalid debug level specified - ', msg")
return
}
Expand Down Expand Up @@ -135,7 +139,7 @@ define_function debug_hex(char msg_level, char msg[])
stack_var char out[255];
stack_var char in[255];

if (msg_level < DEBUG_ERROR || msg_level > DEBUG_INFO) {
if (msg_level < DEBUG_ERROR || msg_level > DEBUG_MAX_LEVEL) {
debug_msg(DEBUG_ERROR, "'invalid debug level specified - ', msg")
return
}
Expand Down Expand Up @@ -163,7 +167,7 @@ define_function debug_dec(char msg_level, char msg[])
stack_var char c;
stack_var char in[255];

if (msg_level < DEBUG_ERROR || msg_level > DEBUG_INFO) {
if (msg_level < DEBUG_ERROR || msg_level > DEBUG_MAX_LEVEL) {
debug_msg(DEBUG_ERROR, "'invalid debug level specified - ', msg")
return
}
Expand Down

0 comments on commit 59f2a01

Please sign in to comment.