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

📄 guiihl.c

📁 The combined demo is dedicated for S1C33L05, so DMT33L05 should be used to load and run the demo. F
💻 C
字号:
/*$id: guiIhl.c V1.0 2001/11/18 */
/***************************************************************************
 *    This source code has been made available to you by EPSON on an AS-IS
 *    basis. Anyone receiving this source is licensed under EPSON
 *    copyrights to use it in any way he or she deems fit, including
 *    copying it, modifying it, compiling it, and redistributing it either
 *    with or without modifications.
 *
 *    Any person who transfers this source code or any derivative work
 *    must include the EPSON copyright notice, this paragraph, and the
 *    preceding two paragraphs in the transferred software.
 *
 *    COPYRIGHT   EPSON  CORPORATION 2001
 *    LICENSED MATERIAL  -  PROGRAM PROPERTY OF EPSON
 **************************************************************************/


/***************************************************************************
 * FILE: guiIhl.c
 * MODULE: input abstract layer
 *
 * PURPOSE: input hardware layer implementation
 *
 *
 * AUTHOR(S): YangCX
 * GROUP: GUI Group
 * DATE CREATED: 2001/11/18
 * REFERENCE DOCUMENT ID:
 * MODIFICATIONS:
 *    Date           userName          Description
 *    2001/11/18     Yangcx            Create this file
 **************************************************************************/

#include <stdio.h>
#include "sysGUI.h"
#include "drv_key.h"
#include "drv_tp.h"


T_EXTERN T_BOOL IsPenDown;

/************************  Hardware Input Operations **********************/

/******************************************************************
  * FUNCTION: fnIHL_InitMouse
  *
  * PURPOSE:
  *		initialize touchpad hardware
  *
  * PARAMETERS
  *    Input:
  *    Output:
  *    InOut:
  *
  * Return value:
  *
  * Reentrant : No
 *****************************************************************/
T_VOID fnIHL_InitMouse(T_VOID)
{
	fnTP_InitHL();		/* inital tp hardware setting	*/
	fnTP_InitAL();		/* inital tp logical setting	*/
	IsPenDown = FALSE;
}

/******************************************************************
  * FUNCTION: fnIHL_ReadMouse
  *
  * PURPOSE:
  *		read touchpad dot data
  *
  * PARAMETERS
  *    Input:
  *    Output:
  *		*buttons  no means
  *		*x    	  x value of the mouse move
  *		*y    	  y value of the mouse move
  *    InOut:
  *
  * Return value:
  *		IAL_NODATA(0)        no data
  *		IAL_DATAREAD(1)      success
  *
  * Reentrant : No
 *****************************************************************/
T_WORD fnIHL_ReadMouse( T_WORD *buttons, T_WORD *xPos, T_WORD *yPos)
{
	T_UHWORD 		xNow = 0,yNow = 0;
	T_MODULE T_WORD xBef = 0,yBef = 0;
	T_MODULE T_BOOL IsErrorDownData = FALSE;
	
	// get pen position
	fnTP_GetLogPos(&xNow, &yNow);
	
	if(fnTP_ChkRng(xNow,yNow,2,2,SCREEN_WIDTH,SCREEN_HEIGHT)){
	/* in screen range */	
		if(IsPenDown && (xBef == xNow) && (yBef == yNow))
			return IAL_NODATA;
		
		*buttons = IAL_MOUSE_LEFTBUTTON;
		*xPos = xNow;
		*yPos = yNow;
		xBef = xNow;
		yBef = yNow;
		
		IsPenDown = TRUE;
		IsErrorDownData = FALSE;
		return IAL_DATAREAD;
	}
	/* not in screen range */
	else{
		/*if pen down but get error x,y coor*/
		if(!IsPenDown)
		{
			IsPenDown = TRUE;
			IsErrorDownData = TRUE;
			return IAL_NODATA;
		}
		
		/*if get error x,y last time when pen down,so return IAL_NODATA*/
		if(IsErrorDownData)
		{
			IsPenDown = FALSE;
			TP_M_STOPTM;
 			fnTP_EnTP();
 			return IAL_NODATA;
		}
		
		/* inital */
		*buttons = IAL_MOUSE_NOBUTTONDOWN;
		*xPos = xBef;
		*yPos = yBef;
		xBef = 0;
		yBef = 0;
		IsPenDown = FALSE;
		TP_M_STOPTM;
 		fnTP_EnTP();
 		return IAL_DATAREAD;
	}
}

/******************************************************************
  * FUNCTION: fnIHL_InitKeyboard
  *
  * PURPOSE:
  *		initialize key hardware
  *
  * PARAMETERS
  *    Input:
  *    Output:
  *    InOut:
  *
  * Return value:
  *
  * Reentrant : No
 *****************************************************************/
T_VOID fnIHL_InitKeyboard(T_VOID)
{
	init_key( );
}

/******************************************************************
  * FUNCTION: fnIHL_ReadKeyboard
  *
  * PURPOSE:
  *		read scancode of the key
  *
  * PARAMETERS
  *    Input:
  *    Output:
  *		*scancode	data of the scancode
  *    InOut:
  *
  * Return value:
  *			IAL_NODATA(0)	   no
  *			IAL_DATAREAD(1)  success
  *
  * Reentrant : No
 *****************************************************************/
T_WORD fnIHL_ReadKeyboard(T_BYTE *ScanCode)
{
		
	Read_Key(ScanCode);
	
	return IAL_DATAREAD;
}

/******************************************************************
  * FUNCTION: Write_keyboard
  *
  * PURPOSE:
  *		write command word to key port
  *
  * PARAMETERS
  *    Input:
  *		cmd	        key command word
  *    Output:
  *    InOut:
  *
  * Return value:
  *
  * Reentrant : No
 *****************************************************************/
T_VOID  fnIHL_WriteKeyboard (T_UWORD cmd)
{

}


⌨️ 快捷键说明

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