HapticLib  0.7
Haptic Feedback Library for embedded systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
hl_debug.c File Reference

Debugging Features definitions. More...

#include "hl_debug.h"

Go to the source code of this file.

Macros

#define HL_DEBUG
 Define this symbol to enable the Debugging Features.

Functions

uint32_t send_int (uint32_t val)
 DEBUG function to print over the USART any uint32_t.
void send_string (char *string)
 DEBUG function to print over the USART any string.

Detailed Description

Debugging Features definitions.

This file is part of the HapticLib Debugging Features module.

Other HapticLib internal modules use the tools implemented including the file hl_debug.h.

Note:
To enable the compilation of this code, the symbol HL_DEBUG must be defined, usually passed to the compiler command line as: -DHL_DEBUG

The features implemented are:

Note:
User applications can use these functions in their code without directly include hl_debug.h.
Author:
Leonardo Guardati
Version:
0.7
Date:
2012

Definition in file hl_debug.c.


Macro Definition Documentation

#define HL_DEBUG

Define this symbol to enable the Debugging Features.

The Debugging features offered by the library are:

The HapticLib Debugging Features are enabled based on the presence of the symbol HL_DEBUG .

To define the symbol do either:

  • explicitly #define HL_DEBUG inside a module.
  • add -DHL_DEBUG to the compiler command line during compilation.
Warning:
Always make calls to debugging code inside conditionally included blocks.
                        ...
                        #ifdef HL_DEBUG
                                ...
                                send_int( 1234567 );
                                ...
                                send_string("Correct usage.\n\r\0");
                                ...
                        #endif
                        ...

Definition at line 80 of file hl_debug.c.


Function Documentation

uint32_t send_int ( uint32_t  val)

DEBUG function to print over the USART any uint32_t.

Warning:
Only if the HL_DEBUG symbol has been defined, the user can call this function.

send_int() will send the hexadecimal representation of any uint32_t.

Warning:
Always make calls to send_int() inside conditionally included blocks.
            #ifdef HL_DEBUG
                send_int( 1234567 );
            #endif

If the value passed is less then 100000, send_int() will also send the decimal representation inside brackets.

                ...
                #ifdef HL_DEBUG
                    ...
                    send_int( 12345 );  // outputs –>   0x3039 (12345)
                    ...
                #endif
                ...
Note:
Implementing this function, dependency on other libraries is avoided.
Parameters:
[in]valuint32_t variable containing the value to print.
Returns:
The sent value is returned.

Definition at line 126 of file hl_debug.c.

void send_string ( char *  string)

DEBUG function to print over the USART any string.

send_string() will send over the serial link any NULL terminated string (char *) smaller than 255 characters.

Warning:
Only if the HL_DEBUG symbol has been defined, the user can call this function.
Always make calls to send_string() inside conditionally included blocks.
Also REMEMBER TO APPEND THE NULL TERMINATING CHARACTER TO THE STRINGS PASSED!!!
            #ifdef HL_DEBUG
                 send_string("Correct usage.\n\r\0");
            #endif
Note:
The 255 character limit is arbitrary and only for safety in case you forget to append the '\0' character. If you need to send more, call again send_string().
Parameters:
[out]stringchar* holding the reference to the string to be printed.

Definition at line 226 of file hl_debug.c.