guitm.c

来自「The combined demo is dedicated for S1C33」· C语言 代码 · 共 75 行

C
75
字号
/************************************************************************/
/*									                                	*/
/*  Copyright (C) SHANGHAI EPSON CORP. 2001  				        	*/
/*                                  									*/
/*  File name: GuiTM.c	                     							*/
/*    This is the driver code of ad convert for touch panel     		*/
/*                                  									*/
/*  Revision history                        							*/
/*      2004.05.24  David.ji	 Start           						*/
/*																		*/
/************************************************************************/

#include "GuiTM.h"
#include "ros33.h"
#include "sysGUI.h"	


/**************************************
 timer initialize
 call from system initialize handler
**************************************/
void fnGuiTM_Init(void)
{
	/* 16-bit  timer 2 clock clk/4096 on */
    *(volatile unsigned char*)REG_TM16_2_PSC = 0x0f;

	/* 16-bit timer2 fine mode=normal,buffer disable,
	output inversion normal, interal clk, output off, reset, stop*/;
	*(volatile unsigned char*)REG_TM16_2_CTL = 0x02;

	/* priority level */
	*(volatile unsigned char*)REG_TM16_2_ILEVL &= INTR_MASK;
	*(volatile unsigned char*)REG_TM16_2_ILEVL |= INTR_LEVEL;

	/*load regiter interrupt 256ms*(48*1000000*1/256)*/
	*(volatile unsigned short*)REG_TM16_2_CMPB = TM16_2_VALUE;

	/* reset 16-bit timer comparsion B intterupt factor */
	*(volatile unsigned char*)REG_TM16_2_IFLAG |= 0x04;

	/* 16-bit timer comparison B interrupt enable */
	*(volatile unsigned char*)REG_TM16_2_IMASK |= 0x04;
    
	/* 16-bit timer run */
	*(volatile unsigned char*)REG_TM16_2_CTL |= 0x01;

}

void fnGuiTM_Start(void)
{
	*(volatile unsigned char*)REG_TM16_2_CTL |= 0x01;	
}

void fnGuiTM_Stop(void)
{
	/* clear 16-bit timer factor flag */
	*(volatile unsigned char*)REG_TM16_2_IFLAG |= 0x04;
    
	*(volatile unsigned char*)REG_TM16_2_CTL &= 0xfe;	
}

void Int_GuiTM(void)
{
	ent_int();

	/* clear 16-bit timer factor flag */
	*(volatile unsigned char*)REG_TM16_2_IFLAG |= 0x04;
    
	iset_flg(GUI_EVENTID,0x100);

	ret_int();
}


⌨️ 快捷键说明

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