Open Garden  0.10.1-21
Data Structures | Macros | Functions
debug.h File Reference

Functions to activare and display (rs232) debug. More...

#include <avr/pgmspace.h>
#include "uart.h"
Include dependency graph for debug.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  debug_t
 

Macros

#define QUOTEME_(x)   #x
 
#define QUOTEME(x)   QUOTEME_(x)
 
#define MAX_LINE_LENGHT   80
 
#define MAX_STRING_LENGHT   20
 
#define PRINT_VALUE_X_LINE   16
 
#define SEC_FOR_Y   5
 
#define GITREL   "unknown"
 

Functions

void debug_get_str (char *str)
 
void debug_print_P (PGM_P string, struct debug_t *debug)
 
void debug_print (struct debug_t *debug)
 
void debug_version (struct debug_t *debug)
 
uint8_t debug_wait_for_y (struct debug_t *debug)
 
void debug_start (struct debug_t *debug)
 
void debug_stop (struct debug_t *debug)
 
struct debug_tdebug_init (struct debug_t *debug)
 
void debug_free (struct debug_t *debug)
 

Detailed Description

Functions to activare and display (rs232) debug.

Macro Definition Documentation

◆ GITREL

#define GITREL   "unknown"

GITREL Environment check

◆ MAX_LINE_LENGHT

#define MAX_LINE_LENGHT   80

Maximum number of char a line can be

◆ MAX_STRING_LENGHT

#define MAX_STRING_LENGHT   20

Number of char a substring can be made of. Substrings are used to compose the line when, for example, conversions have to be made from int to string etc.

◆ PRINT_VALUE_X_LINE

#define PRINT_VALUE_X_LINE   16

Unused.

◆ QUOTEME

#define QUOTEME (   x)    QUOTEME_(x)

Macro example 2nd pass.

◆ QUOTEME_

#define QUOTEME_ (   x)    #x

Macro example for create a function macro in 2 pass.

The scope should be #x -> f(x)

◆ SEC_FOR_Y

#define SEC_FOR_Y   5

Seconds to wait for an answer (y/n)

Function Documentation

◆ debug_free()

void debug_free ( struct debug_t debug)

Free the allocated structure.

◆ debug_get_str()

void debug_get_str ( char *  str)

Read a string from the user with echo.

◆ debug_init()

struct debug_t* debug_init ( struct debug_t debug)

Initialize the debug_t structure and ask if debug is active.

◆ debug_print()

void debug_print ( struct debug_t debug)

Print the debug->line string.

◆ debug_print_P()

void debug_print_P ( PGM_P  string,
struct debug_t debug 
)

Print a flash-stored string to the terminal.

Parameters
stringMUST be a PSTR() string.
debugptr to print space.

◆ debug_start()

void debug_start ( struct debug_t debug)

Enable debugging.

◆ debug_stop()

void debug_stop ( struct debug_t debug)

Disable debugging.

◆ debug_version()

void debug_version ( struct debug_t debug)

Print the release version.

◆ debug_wait_for_y()

uint8_t debug_wait_for_y ( struct debug_t debug)

Prompt the user for and y/n answer

"Y" is 89 and "y" is 121

Exit the cicle in a bad way