source: avrstuff/V-USB_Dev/firmwares/herePic/usbdrv/oddebug.c@ 3587f7f

main
Last change on this file since 3587f7f was 3587f7f, checked in by Adrien Destugues <pulkomandy@…>, 12 years ago

Add first version of herePic, an AVR based PIc programmer using ICSP protocol.
Untested, no host software written yet.

git-svn-id: svn://pulkomandy.tk/avrstuff@64 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/* Name: oddebug.c
2 * Project: AVR library
3 * Author: Christian Starkjohann
4 * Creation Date: 2005-01-16
5 * Tabsize: 4
6 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: oddebug.c 692 2008-11-07 15:07:40Z cs $
9 */
10
11#include "oddebug.h"
12
13#if DEBUG_LEVEL > 0
14
15#warning "Never compile production devices with debugging enabled"
16
17static void uartPutc(char c)
18{
19 while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */
20 ODDBG_UDR = c;
21}
22
23static uchar hexAscii(uchar h)
24{
25 h &= 0xf;
26 if(h >= 10)
27 h += 'a' - (uchar)10 - '0';
28 h += '0';
29 return h;
30}
31
32static void printHex(uchar c)
33{
34 uartPutc(hexAscii(c >> 4));
35 uartPutc(hexAscii(c));
36}
37
38void odDebug(uchar prefix, uchar *data, uchar len)
39{
40 printHex(prefix);
41 uartPutc(':');
42 while(len--){
43 uartPutc(' ');
44 printHex(*data++);
45 }
46 uartPutc('\r');
47 uartPutc('\n');
48}
49
50#endif
Note: See TracBrowser for help on using the repository browser.