oddebug.h

来自「软USB核的电力开关PowerSwitch」· C头文件 代码 · 共 72 行

H
72
字号
/* 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 20 2005-02-20 16:39:43Z cs $ */#ifndef __oddebug_h_included__#define __oddebug_h_included__/*General Description:This module implements a function for debug logs on the serial line of theAVR microcontroller. Debugging can be configured with the define'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debuggingcalls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is2, DBG1 and DBG2 logs will be printed.A debug log consists of a label ('prefix') to indicate which debug log createdthe output and a memory block to dump in hex ('data' and 'len').*/#ifndef F_CPU#	define	F_CPU	12000000	/* 12 MHz */#endif#ifndef uchar#	define	uchar	unsigned char#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);#include <avr/io.h>static inline void	odDebugInit(void){	UCR |= (1<<TXEN);	UBRR = F_CPU / (9600 * 16L) - 1;}#else#	define odDebugInit()#endif/* ------------------------------------------------------------------------- */#endif /* __oddebug_h_included__ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?