]> git.cryptolib.org Git - avr-crypto-lib.git/blob - debug.c
1507e94f1a5ec6cc10f04f2e91320c8dab772636
[avr-crypto-lib.git] / debug.c
1 /***************************
2 *
3 *
4 *
5 ****************************/
6 #include "config.h"
7
8 #if DEBUG == uart
9  #include "uart.h"
10 #else
11   #error "Your DEBUG methode is not suported!"
12 #endif
13
14 #ifdef DEBUG
15  void debug_init(void){
16  #if DBUG==uart
17   uart_init();
18  #else
19   #error "Your DEBUG methode is not suported!"
20  #endif
21  }
22  
23  void debug_char(char c){
24         static char initialised = 0;
25         if (!initialised){
26                 uart_init();
27                 initialised=1;
28         }       
29         uart_putc(c);
30  }
31  
32  void debug_str(char* s){
33         while (*s)
34                 debug_char(*s++);
35  }
36  
37
38
39  void debug_byte(char b){
40         char table[] = "0123456789ABCDEF";
41         debug_char(table[(b>>4) & 0xf]);
42         debug_char(table[b&0xf]);
43  }
44
45 #endif //DEBUG
46