?? lib.h
字號:
/**************** (c) 2004 STMicroelectronics *********************************
PROJECT :
COMPILER :
MODULE : lib.h
VERSION : 1.0.0
CREATION DATE :
AUTHOR :
DESCRIPTION :
******************************************************************************/
#ifndef LIB_H
#define LIB_H
/*--------------------------STANDARD TYPE DEFINITION-------------------------*/
typedef unsigned char u8; /* unsigned 8 bit */
typedef signed char s8; /* signed 8 bit */
typedef unsigned int u16; /* unsigned 16 bit */
typedef signed int s16; /* signed 16 bit */
typedef unsigned long u32; /* unsigned 32 bit */
typedef signed long s32; /* signed 32 bit */
typedef u8 BOOLEAN; /* Boolean */
#define U8_MAX ((u8)255)
#define S8_MAX ((s8)127)
#define S8_MIN ((s8)-128)
#define U16_MAX ((u16)65535)
#define S16_MAX ((s16)32767)
#define S16_MIN ((s16)-32768)
#define U32_MAX ((u32)4294967295)
#define S32_MAX ((s32)2147483647)
#define S32_MIN ((s32)-2147483648)
#define FALSE ((BOOLEAN)0x00)
#define TRUE (!(FALSE))
typedef union { /* unsigned 16 bit type for 8 & 16 */
u16 w_form; /* bit accesses: 16> var.w_form */
struct { /* 8> var.b_form.high/low */
u8 high, low;
} b_form;
} TwoBytes;
/*--------------------------STANDARD MACRO DEFINITION-------------------------*/
#define Dim(x) (sizeof(x) / sizeof(x[0])) /*Nbr of elements in array x[] */
#define ABS(x) ((x) >= 0) ? (x) : -(x) /* Absolute value of expression */
/*--------------------------------BIT ACCESSES--------------------------------*/
#define SetBit(VAR,Pb) ( (VAR) |= (1<<(Pb)) )
#define ClrBit(VAR,Pb) ( (VAR) &= ((1<<(Pb))^255) )
#define NotBit(VAR,Pb) ( (VAR) ^= (1<<Pb) )
#define ValBit(VAR,Pb) ( (VAR) & (1<<Pb) )
#define AffBit(VAR,Pb,Val) ((Val)? (VAR |= (1<<(Pb))) : (VAR &= ((1<<(Pb))^255)))
#define MskBit(Dest,Msk,Src) ( Dest = (Msk & Src) | ((~Msk) & Dest) )
#ifndef WDR
#define WDR() asm("wdr")
#define SEI() asm("sei")
#define CLI() asm("cli")
#define NOP() asm("nop")
#define _WDR() asm("wdr")
#define _SEI() asm("sei")
#define _CLI() asm("cli")
#define _NOP() asm("nop")
#endif
#ifndef BIT
#define BIT(x) (1 << (x))
#endif
#endif
/*** (c) 2001 STMicroelectronics ****************** END OF FILE ***************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -