为了配3寸的TFT屏,用了OPPO Luna的LPC 2103+ SSD1928,里面用FGPIO跟1928通讯,但它的程序不用那些FIOMASK。 其实那些东西有什麽用途呢?
#ifdef LPC210X_FAST_GPIO /* Fast General Purpose Input/Output (GPIO) */ #define FIODIR (*((volatile unsigned long *) 0x3FFFC000)) #define FIOMASK (*((volatile unsigned long *) 0x3FFFC010)) #define FIOPIN (*((volatile unsigned long *) 0x3FFFC014)) #define FIOSET (*((volatile unsigned long *) 0x3FFFC018)) #define FIOCLR (*((volatile unsigned long *) 0x3FFFC01C)) #define SCS (*((volatile unsigned long *) 0xE01FC1A0)) #define FIO0PIN (*((volatile unsigned char *) 0x3FFFC014)) #define FIO1PIN (*((volatile unsigned char *) 0x3FFFC015)) #define FIO0SET (*((volatile unsigned long *) 0x3FFFC018)) #define FIO1SET (*((volatile unsigned long *) 0x3FFFC019)) #endif void PortInit() { SCS = 1;//设置快速FGPIO模式 (0:GPIO; 1:fast GPIO) FIOPIN = 0x00000000; FIODIR|= 0xFFFFFFFF; PINSEL0 = 0x00000000; } #define indirect_cs_up() (FIOSET)=(1<<PORTD_CS); #define indirect_cs_down() (FIOCLR)=(1<<PORTD_CS); void indirect_IO_WriteData(UINT16 data)//write to GPIO { FIODIR=0xFFFFFFFF;//Bit15-0 for write (FIOCLR)=(0x0000FFFF); (FIOSET)=(data<<PORTD_DATA); } UINT16 indirect_IO_ReadData()//read from GPIO { FIODIR=0xFFFF0000;//Bit15-0 for read return (FIOPIN)&0xFFFF; } |