Mercurial > templog
comparison network/Lib/Debug.c @ 110:4eb5a746d7af avr-http
Import avrusbmodem code minus the USB bits. Not built yet.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 15 Sep 2012 21:49:05 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
109:315850d48eec | 110:4eb5a746d7af |
---|---|
1 /* | |
2 LUFA Powered Wireless 3G Modem Host | |
3 | |
4 Copyright (C) Mike Alexander, 2010. | |
5 Copyright (C) Dean Camera, 2010. | |
6 */ | |
7 | |
8 /* | |
9 Copyright 2010 Mike Alexander (mike [at] mikealex [dot] com) | |
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) | |
11 | |
12 Permission to use, copy, modify, distribute, and sell this | |
13 software and its documentation for any purpose is hereby granted | |
14 without fee, provided that the above copyright notice appear in | |
15 all copies and that both that the copyright notice and this | |
16 permission notice and warranty disclaimer appear in supporting | |
17 documentation, and that the name of the author not be used in | |
18 advertising or publicity pertaining to distribution of the | |
19 software without specific, written prior permission. | |
20 | |
21 The author disclaim all warranties with regard to this | |
22 software, including all implied warranties of merchantability | |
23 and fitness. In no event shall the author be liable for any | |
24 special, indirect or consequential damages or any damages | |
25 whatsoever resulting from loss of use, data or profits, whether | |
26 in an action of contract, negligence or other tortious action, | |
27 arising out of or in connection with the use or performance of | |
28 this software. | |
29 */ | |
30 | |
31 #include "Debug.h" | |
32 | |
33 bool DebugModeEnabled = false; | |
34 | |
35 void Debug_PrintChar(const char DebugChar) | |
36 { | |
37 if (DebugModeEnabled) | |
38 putchar(DebugChar); | |
39 } | |
40 | |
41 void Debug_Print(const char* DebugText) | |
42 { | |
43 if (DebugModeEnabled) | |
44 { | |
45 while (*DebugText) | |
46 putchar(*(DebugText++)); | |
47 } | |
48 } | |
49 | |
50 void Debug_PrintHex(const uint8_t DebugChar) | |
51 { | |
52 if ((DebugChar >> 4) > 9) | |
53 Debug_PrintChar((DebugChar >> 4) + 'a' - 10); | |
54 else | |
55 Debug_PrintChar((DebugChar >> 4) + '0'); | |
56 | |
57 if ((DebugChar & 0x0f) > 9) | |
58 Debug_PrintChar((DebugChar & 0x0f) + 'a' - 10); | |
59 else | |
60 Debug_PrintChar((DebugChar & 0x0f) + '0'); | |
61 } |