📄 oddebug.h
字号:
/* Name: oddebug.h * Project: AVR library * Author: Christian Starkjohann * Creation Date: 2005-01-16 * Tabsize: 4 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH * License: Proprietary, free under certain conditions. See Documentation. * This Revision: $Id: oddebug.h 215 2006-07-10 21:54:51Z cs $ */#ifndef __oddebug_h_included__#define __oddebug_h_included__/*说明:本模块实现调试信息的串行输出. Debugging 可通过宏'DEBUG_LEVEL'来配置. 若此宏未定义 或是定义为0, 所有debugging信息都不会输出. 若是 1, DBG1 logs 将输出, 但不输出 DBG2. 若为2, DBG1 和 DBG2 logs 将都会输出.A debug log 加了个标号('prefix') 来指示是何种 debug log 输出了and a memory block to dump in hex ('data' and 'len').*/#ifndef F_CPU# define F_CPU 12000000 /* 12 MHz */#endif/* make sure we have the UART defines: */#include "iarcompat.h"#ifndef __IAR_SYSTEMS_ICC__# include <avr/io.h>#endif#ifndef uchar# define uchar unsigned char#endif#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */# warning "Debugging disabled because device has no UART"# undef DEBUG_LEVEL#endif#ifndef DEBUG_LEVEL# define DEBUG_LEVEL 0#endif/* ------------------------------------------------------------------------- */#if DEBUG_LEVEL > 0# define DBG1(prefix, data, len) odDebug(prefix, data, len)#else# define DBG1(prefix, data, len)#endif#if DEBUG_LEVEL > 1# define DBG2(prefix, data, len) odDebug(prefix, data, len)#else# define DBG2(prefix, data, len)#endif/* ------------------------------------------------------------------------- */#if DEBUG_LEVEL > 0extern void odDebug(uchar prefix, uchar *data, uchar len);/* Try to find our control registers; ATMEL likes to rename these */#if defined UBRR# define ODDBG_UBRR UBRR#elif defined UBRRL# define ODDBG_UBRR UBRRL#elif defined UBRR0# define ODDBG_UBRR UBRR0#elif defined UBRR0L# define ODDBG_UBRR UBRR0L#endif#if defined UCR# define ODDBG_UCR UCR#elif defined UCSRB# define ODDBG_UCR UCSRB#elif defined UCSR0B# define ODDBG_UCR UCSR0B#endif#if defined TXEN# define ODDBG_TXEN TXEN#else# define ODDBG_TXEN TXEN0#endif#if defined USR# define ODDBG_USR USR#elif defined UCSRA# define ODDBG_USR UCSRA#elif defined UCSR0A# define ODDBG_USR UCSR0A#endif#if defined UDRE# define ODDBG_UDRE UDRE#else# define ODDBG_UDRE UDRE0#endif#if defined UDR# define ODDBG_UDR UDR#elif defined UDR0# define ODDBG_UDR UDR0#endifstatic inline void odDebugInit(void){ ODDBG_UCR |= (1<<ODDBG_TXEN); ODDBG_UBRR = F_CPU / (19200 * 16L) - 1;}#else# define odDebugInit()#endif/* ------------------------------------------------------------------------- */#endif /* __oddebug_h_included__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -