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

📄 pcb_rightech_a.h

📁 很难得的最好的rtd3523系列原厂源码LCD驱动开发
💻 H
字号:
//----------------------------------------------------------------------------------------------------
// PCB NAME		: RIGHTECH_A.pcb
// DESIGNED BY	: HaoZhen
//----------------------------------------------------------------------------------------------------


//************************************************************ START PCB CONFIG
// MCU Type
#define _MYSON_MTV312			1
#define _MYSON_MTV512			2
#define _MCU_TYPE				_MYSON_MTV512

// Scaler Type
#define _RTD2323				0
#define _RTD2023L				1
#define _RTD2023S				2
#define _RTD2023L_SHRINK		3
#define _SCALER_TYPE			_RTD2323

// Definations of Host Interface (Parallel/Serial Port)
#define _SERIAL_PORT			0
#define _PARALLEL_PORT			1
#define _HOST_INTERFACE			_SERIAL_PORT

// Video Type
#define _VIDEO_5150				0
#define _VIDEO_5147				1
#define _VIDEO_TYPE				_VIDEO_5150

// Audio Type
#define _AUDIO_NONE				0
#define _AUDIO_7496				1
#define _AUDIO_DEVICE			_AUDIO_NONE

// Definations of RTD/MCU Crystal Frequency in KHz
#define _XTAL12000K                     12000
#define _XTAL24576K                     24576
#define _XTAL24000K                     24000
#define _RTD_XTAL                       _XTAL24000K
#define _MCU_XTAL                       _XTAL24000K

// RTD2323 Internal Regulator Active
//   __FALSE: use external 3.3v-->1.8v regulator
//   __TRUE : use internal 3.3v-->1.8v regulator
#define _INTERNAL_REGULATOR			_FALSE

// Definitions for Backlight PWM Setting
#define _PWM0						0
#define _PWM1						1
#define _PWM2						2
#define _MCUPWM						3				// Evan 050511
#define _BACKLIGHT_PWM				_MCUPWM
#define _BACKLIGHT_PWM_INVERSE		_DISABLE		// modify by cooriee 050521


//************************************************************** END PCB CONFIG


//********************************************************** START MACRO OPTION
// Definitions for GPIO Control
#define _PANEL_ON			0   // Power on  state for LCD panel 
#define _PANEL_OFF			1   // Power off state for LCD panel

#define _LIGHT_ON			0	// 1   // Power on  state for backlight inverter
#define _LIGHT_OFF			1	// 0   // Power off state for backlight inverter

#define _LIGHT_ENABLE		1	// enable control pin of invertor
#define _LIGHT_DISABLE		0


#define _VDC_ON				0   // Power on  state for video decoder
#define _VDC_OFF			1   // Power off state for video decoder

#define _LVDS_ON			0   // Power on  state for LVDS Tx
#define _LVDS_OFF			1   // Power off state for LVDS Tx

#define _LED_ON				0   // Power on  state for LED
#define _LED_OFF			1   // Power off state for LED

#if (_PCB_RIGHTECH_A_USE_PV013BA1 == _FALSE)
// video ch sel (using NJM2244)
#define _VIDEO_CH_AV1		0		// _TRUE: enable to show "HUE"
#define _VIDEO_CH_AV2		1		// _TRUE: enable to show "HUE"
#define VideoSelCHAV1()		{bVideoCh = _VIDEO_CH_AV1;}
#define VideoSelCHAV2()		{bVideoCh = _VIDEO_CH_AV2;}
#endif
// Infrared audio emitter setting
#define _INFRARED_ENABLE	_TRUE//_FALSE//
#if (_INFRARED_ENABLE == _TRUE)
#define _INFRARED_23_28		1
#define _INFRARED_33_38		0
#define InfraredEmitter_23_28()	{bInfraredEmitter = _INFRARED_23_28;}
#define InfraredEmitter_33_38()	{bInfraredEmitter = _INFRARED_33_38;}
#endif
//************************************************************ END MACRO OPTION
//version 200D
//--------------------------------------------------
// RTD2023L and RTD2023S Pin Share
//--------------------------------------------------
#define _PIN_21_TO_40               (0 & 0x03)  // 0 ~ 1
#define _PIN_16_17_OR_43_44         (0 & 0x03)  // 0 ~ 1


//************************************************************* START PIN SHARE
// RTD2323 Pin Share
// 6bit TCON
#if (_PANEL_STYLE == _PANEL_TCON)	//for TCON Pin Define
#define _PIN_3                      (0 & 0x03)  // 0 ~ 3	// to power 3.3v
#define _PIN_4                      (0 & 0x03)  // 0 ~ 3	// to power 3.3v
#define _PIN_48                     (0 & 0x03)  // 0 ~ 3	//tcon 0
#define _PIN_49                     (3 & 0x03)  // 0 ~ 3	//tcon 1

#define _PIN_50_51                  (1 & 0x01)  // 0 ~ 1	//tcon 4,tcon 9
#define _PIN_52_53                  (0 & 0x01)  // 0 ~ 1	//tcon 13,tcon 7
#define _PIN_54                     (0 & 0x03)  // 0 ~ 3	//tcon 11
#define _PIN_55_56_57               (0 & 0x01)  // 0 ~ 1	//tcon 0,tcon 12,tcon 3
#define _PIN_122_FUNC               (0 & 0x01)  // 0 ~ 1	// NC pin
#define _PIN_110                    (0 & 0x01)  // 0 ~ 1	//NC pin

#define _PIN_111                    (3 & 0x03)  // 0 ~ 3	//tcon 2
#define _PIN_112_113_114            (0 & 0x03)  // 0 ~ 3	//tcon 10,tcon 8,tcon 5
#define _PIN_115_118_119            (0 & 0x01)  // 0 ~ 1	//SDIO3,SCSB,SCLK
#define _PIN_120_121                (1 & 0x03)  // 0 ~ 3	//NC pin
#define _PIN_122                    (0 & 0x01)  // 0 ~ 1	//NC pin
#endif

//8Bit TTL
#if (_PANEL_STYLE == _PANEL_TTL)	//for TTL Pin Define
#define _PIN_3                      (0 & 0x03)  // PWM0
#define _PIN_4                      (0 & 0x03)  // PWM1
#define _PIN_48                     (2 & 0x03)  // DHS
#define _PIN_49                     (2 & 0x03)  // DVS

#define _PIN_50_51                  (0 & 0x01)  // 
#define _PIN_52_53                  (1 & 0x01)  // DEN
#define _PIN_54                     (2 & 0x03)  // 
#define _PIN_55_56_57               (1 & 0x01)  // Serial interface
#define _PIN_122_FUNC               (0 & 0x01)  // 
#define _PIN_110                    (0 & 0x01)  // 

#define _PIN_111                    (0 & 0x01)	// V0 of V8 port2
#define _PIN_112_113_114            (0 & 0x01)	// V1-V3 of V8 port2
#define _PIN_115_118_119            (0 & 0x01)  // V4-V6 of V8 port2
#define _PIN_120_121                (0 & 0x03)  // V7/VCLK of V8 port2
#define _PIN_122                    (0 & 0x01)  // 
#endif

//LVDS
#if (_PANEL_STYLE == _PANEL_LVDS)	//for RSDS and LVDS Pin Define
#define _PIN_3                      (0 & 0x03)
#define _PIN_4                      (0 & 0x03)
#define _PIN_48                     (3 & 0x03)
#define _PIN_49                     (3 & 0x03)

#define _PIN_50_51                  (1 & 0x01)
#define _PIN_52_53                  (0 & 0x01)
#define _PIN_54                     (0 & 0x03)
#define _PIN_55_56_57               (0 & 0x01)
#define _PIN_122_FUNC               (0 & 0x01)
#define _PIN_110                    (1 & 0x01)
	#if 1	// use video8 2nd port
#define _PIN_111                    (0 & 0x03)
#define _PIN_112_113_114            (0 & 0x03)
#define _PIN_115_118_119            (0 & 0x01)
#define _PIN_120_121                (0 & 0x03)
#define _PIN_122                    (0 & 0x01)
	#else
#define _PIN_111                    (1 & 0x03)
#define _PIN_112_113_114            (1 & 0x03)
#define _PIN_115_118_119            (0 & 0x01)
#define _PIN_120_121                (2 & 0x03)
#define _PIN_122                    (0 & 0x01)
	#endif
#endif
//*************************************************************** END PIN SHARE


//************************************************************** START PCB MISC
// Define panel 12v  EVAN 050512
#define _POWER12VUSE			_OFF
//**************************************************************** END PCB MISC


//**************************************************** START MCU PIN ASSIGNMENT
sbit bDIRLR					= P1^0;
sbit bDIRUD					= P1^1;
sbit bI2CSDA				= P1^2;
sbit bI2CSCL				= P1^3;
sbit bSCALERSDIO3			= P1^4;
sbit bSCALERSCSB			= P1^5; 
sbit bSCALERSCLK			= P1^6;

#define bLIGHT_ENABLE		MCU_PORT5_F30[1]	// enable control pin
#define bLIGHTPOWER			MCU_PORT5_F30[3]	// NC in this version PCB
#define bPANELPOWER			MCU_PORT5_F30[4]	//error since connecting to NC(P1), use P5.4
sbit bIR_GPIO				= P3^2;				// IR remoter input
#define bVIDEORESET			MCU_PORT6_F38[7]	//Video reset pin, low active.
#define bVIDEOPOWER			MCU_PORT6_F38[5]

sbit bLEDGREEN				= P3^3;
#define bLEDRED				MCU_PORT5_F30[6]	//test only

sbit bDVICONNECT			= P3^2; //only for test
sbit bVGACONNECT			= P3^2;	

#define BL_BRIGHT_PORT		MCU_DAC_F20[2]
#define VOLUME_PORT			MCU_DAC_F20[0]

sbit b4052A					= P3^4;
sbit b4052B					= P3^5; 

// I/O key definition
	#if (_CUSTOM_TYPE == _CUSTOM_HAOZHEN && _KEYPAD_TYPE == _KEYPAD_TYPE_RT88A)
#define bPOWER_KEY			(MCU_PORT5_F30[5]&0x01)
#define bLEFT_KEY			(MCU_PORT6_F38[2]&0x01)		// Down
#define bRIGHT_KEY			(MCU_PORT6_F38[3]&0x01)		// Up
sbit 	bVIDEO2				= P1^7;						// v1/v2 key
sbit	bSource				= P1^7;						// for 1 key source change
#define bMENU_KEY			(MCU_PORT6_F38[0]&0x01)		// Menu
#define bVIDEO1				(MCU_PORT6_F38[1]&0x01)		// TV key
	#else
	// this may be used while firmware debug
#define bPOWER_KEY			(MCU_PORT5_F30[5]&0x01)
#define bLEFT_KEY			(MCU_PORT6_F38[2]&0x01)		// Down
#define bRIGHT_KEY			(MCU_PORT6_F38[3]&0x01)		// Up
sbit 	bVIDEO2				= P1^7;						// v1/v2 key
sbit	bSource				= P1^7;						// for 1 key source change
#define bMENU_KEY			(MCU_PORT6_F38[0]&0x01)		// Menu
#define bVIDEO1				(MCU_PORT6_F38[1]&0x01)		// TV key
	#endif
	#if (_PCB_RIGHTECH_A_USE_PV013BA1 == _FALSE)
#define bVideoCh			(MCU_PORT7_F76[0])		// video select control, L:v1 | H:v2
	#endif
#define bInfraredEmitter	(MCU_PORT7_F76[1])		// infrared audio emitter control, L:3.3/3.8 | H:2.3/2.8
//****************************************************** END MCU PIN ASSIGNMENT


⌨️ 快捷键说明

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