typedef.h

来自「DataFlash芯片AT45DB081读写程序」· C头文件 代码 · 共 84 行

H
84
字号
#ifndef _TypeDef_H

#define _TypeDef_H

//#include"stdinc.h"
#include"intrins.h"

#define False 0
#define True 	1

#define uint 	unsigned int
#define uchar unsigned char
#define ulong unsigned long

//#define const _rom
#define const code
#define _rom code

#define DisableInterrupt()	{EA=0;}
#define EnableInterrupt()	{EA=1;}

#define _nop()	{_nop_();}

struct bytes			// Create struct datatype.
{
unsigned char lo;
unsigned char hi;
};

union WordByte  			// Create Union of struct and long.
{
	unsigned int Word;

	struct			// Create struct datatype.
	{
		unsigned char hi;
		unsigned char lo;
	}Byte;
};

union LongInt
{
	struct
	{
		uint hi;
		uint lo;
	}Int;
	long Long;
};

/*
union __FLASHPtr
 {
  unsigned long int FLASHAddr;    
  struct 
   {
      uchar NOUSEBYTE;	
      uchar Page;
      uchar * PageOffset;
   } FLASHPtr;                 
 };


typedef struct	// general structure of 8 bit register allowing bit access 
	{
	unsigned int bit0 : 1;
	unsigned int bit1 : 1;
	unsigned int bit2 : 1;
	unsigned int bit3 : 1;
	unsigned int bit4 : 1;
 	unsigned int bit5 : 1;
	unsigned int bit6 : 1;
	unsigned int bit7 : 1;
	} Register;    

typedef union	// allow bit or byte access to registers 
	{
	char byte;
	Register bits;
	} Mix_Reg;

*/
#endif

⌨️ 快捷键说明

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