⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 FreeScale DragonBall SZ LCD driver samples code
💻 C
字号:
/**********************************************
*
*	Dragonball Super VZ Sharp 240x320 Init Code
*
**********************************************/

#include <stdio.h>

int main()
{
	// Using default MetroTRK clock & chip select settings
	//	If using other, PCD value (PCR0 [6:0]) & SSA may need to be reconfigured
	
	/*GPIO*/
	// Assign muxed GPIO pins to LCD
	
	// Port C
	(*(volatile unsigned char *)(0xFFFFF412)) = 0x00;
	(*(volatile unsigned char *)(0xFFFFF413)) = 0x00;
	// Port D
	(*(volatile unsigned char *)(0xFFFFF41B)) = 0xF0;
	(*(volatile unsigned char *)(0xFFFFF41A)) = 0xF0;
	// Port K
	(*(volatile unsigned char *)(0xFFFFF442)) &= 0x0F;
	(*(volatile unsigned char *)(0xFFFFF443)) &= 0x0F;
	//Port P
	(*(volatile unsigned char *)(0xFFFFF45A)) = 0x00;
	(*(volatile unsigned char *)(0xFFFFF45B)) = 0x00;
	//Port F
	(*(volatile unsigned char *)(0xFFFFF42B)) = 0x82;
	(*(volatile unsigned char *)(0xFFFFF42A)) = 0xFE;
	
	/*LCDC*/
	// Configure LCDC for Sharp 240x320 TFT
	
	// SSA ### screen starting address set to beginning of CSF
	// sz_ram.lcf loads image to this address
	(*(volatile unsigned int *)(0xFFFE0800)) = 0x01000000;

	// VPW ### set for 240 pixel wide image
	(*(volatile unsigned short int *)(0xFFFE0806)) = 0x00F0;

	// Size ### [15:9] = Width/8, [8:0] = Height
	(*(volatile unsigned short int *)(0xFFFE0804)) = 0x3D40;

	// PCR0 ### ACD doesn't affect TFT, PCD = 7 + 1
	(*(volatile unsigned short int *)(0xFFFE0812)) = 0x8B07;
	// PCR1 ### TFT, Color, 16bpp, Sharp panel
	(*(volatile unsigned short int *)(0xFFFE0814)) = 0xF801;

	// PWMR ### Pulse Width = 138
	(*(volatile unsigned short int *)(0xFFFE0822)) = 0x008A;

	// HSYNC ### Hwait1 = 16, Hwait2 = 7, Hsync Width = 4 pixel clocks
	(*(volatile unsigned short int *)(0xFFFE0816)) = 0x0F06;
	(*(volatile unsigned short int *)(0xFFFE0818)) = 0x0400;
													
	// VSYNC ### Vwait1 = 9, Vwait2 = 7, Vsync Width = 4 lines
	(*(volatile unsigned short int *)(0xFFFE081A)) = 0x0907;
	(*(volatile unsigned short int *)(0xFFFE081C)) = 0x0400;

	// Enable ### LCDC On
	(*(volatile unsigned short int *)(0xFFFE0826)) = 0x0002;
	

	return 0;
}

⌨️ 快捷键说明

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