OneWay  3.0-3-ge9d4fa4
Data Structures | Macros | Functions
debug.h File Reference

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

#include <avr/pgmspace.h>
#include "uart.h"
#include "htv.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   80
 
#define PRINT_VALUE_X_LINE   16
 
#define SEC_FOR_Y   5
 

Functions

void debug_print_P (PGM_P string, struct debug_t *debug)
 
void debug_print (struct debug_t *debug)
 
uint8_t debug_wait_for_y (struct debug_t *debug)
 press 'y' or 'n' More...
 
struct debug_tdebug_init (void)
 initialize debug struct and uart console
 
void debug_free (struct debug_t *debug)
 free the memory
 
void debug_print_htv (struct htv_t *htv, struct debug_t *debug)
 print the struct htv contents. More...
 
void debug_setup_address (struct htv_t *htv, struct debug_t *debug)
 input and store the address of the unit in EEPROM. More...
 
void debug_print_address (struct htv_t *htv, struct debug_t *debug)
 print the RX address in use.
 

Detailed Description

Functions to activare and display (rs232) debug.

Macro Definition Documentation

◆ MAX_LINE_LENGHT

#define MAX_LINE_LENGHT   80

Maximum number of char a line can be

◆ MAX_STRING_LENGHT

#define MAX_STRING_LENGHT   80

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)

unused

◆ QUOTEME_

#define QUOTEME_ (   x)    #x

unused

◆ SEC_FOR_Y

#define SEC_FOR_Y   5

seconds to wait for press 'y' when not locked

Function Documentation

◆ debug_print()

void debug_print ( struct debug_t debug)

print the debug->line if debug is active.

◆ debug_print_htv()

void debug_print_htv ( struct htv_t htv,
struct debug_t debug 
)

print the struct htv contents.

Note
if the strings are not correctly initialized and terminated, this function will memory leak and crash.

◆ debug_print_P()

void debug_print_P ( PGM_P  string,
struct debug_t debug 
)

Print a string taken directly from the EEPROM avoiding memory allocation.

Parameters
stringthe PSTR() string to be printed.
debugthe struct debug.

◆ debug_setup_address()

void debug_setup_address ( struct htv_t htv,
struct debug_t debug 
)

input and store the address of the unit in EEPROM.

Note
the function will cycle until a correct address is entered.

◆ debug_wait_for_y()

uint8_t debug_wait_for_y ( struct debug_t debug)

press 'y' or 'n'

"Y" is 89 and "y" is 121

Exit the cicle in a bad way