📄 util.h
字号:
/* Util.h
*
* Useful utilities.
*
* Also includes app-specific config info (since all library
* files include this file).
*
* #define one of the following values to select the
* appropriate code based on your microcontroller (uC)
* clock speed. Most of the library classes require this.
*
* define uC clk
* ---------- ------
* CLOCK_8M 8 MHz
* CLOCK_16M 16 MHz
*
* Revisions:
* 07-13-06 included in LCDSample project
* 07-05-06 version 1 in master library
*
* Written by Cathy Saxton
* robotics@idleloop.com
*/
#pragma once
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned short ushort;
enum
{
fFalse = 0,
fTrue = 1
};
#define Abs(x) (((x) < 0) ? (-(x)) : (x))
#define DIM(a) (sizeof(a) / sizeof(a[0]))
/* macros to set and clear bits in registers */
#define SetBit(sfr, bit) ((sfr) |= (1 << (bit)))
#define ClearBit(sfr, bit) ((sfr) &= ~(1 << (bit)))
/* include the app-specific configuration information */
#include "Config.h"
/* check for microcontroller clock speed definition */
#if !defined(CLOCK_8M) && !defined(CLOCK_16M)
#error "no CLOCK_* definition (see Util.h)"
#endif
/* check for microcontroller definition (this define is set by -mmcu=
argument to compiler) */
#if !defined(__AVR_ATmega8__) && !defined(__AVR_ATmega16__) \
&& !defined(__AVR_ATmega32__)&& !defined(__AVR_ATmega644__) \
&& !defined(__AVR_ATmega128__)
#error "unrecognized microcontroller (see Util.h)"
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -