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

📄 keyboard.h

📁 freescale的基于802.15.4的无线通讯例程
💻 H
字号:
/************************************************************************************
* This header file is for Keyboard Driver Interface.
*
* (c) Copyright 2006, Freescale, Inc.  All rights reserved.
*
* Freescale Confidential Proprietary
* Digianswer Confidential
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale.
*
*****************************************************************************/
#ifndef _KEYBOARD_H_
#define _KEYBOARD_H_

#include "IrqControlLib.h"
#include "PortConfig.h"
#define gKeyBoardSupported_d 1

#if (gKeyBoardSupported_d == 1)
/*****************************************************************************
******************************************************************************
* Public macros
******************************************************************************
*****************************************************************************/
#define mEnable_c 1
#define mDisable_c 0
#define mSingleLongEvent_c 0
#define mRepeatLongEvent_c 1

/* Enable switches automatically enable ShortKey press event */
#define mSW1_c 1          /* SW1 enable */
#define mSW2_c 1          /* SW2 enable */
#define mSW3_c 1          /* SW3 enable */
#define mSW4_c 1          /* SW4 enable */

/* Choose action for Long key event. Repeating or single event. */
#define mSW1Event_c 0
#define mSW2Event_c 0
#define mSW3Event_c 0
#define mSW4Event_c 0
#define mSendEvent_c 10   /* 4 event pr. sec. */

/* Resolution for mLongKeySCAN_c is 20mS.
   mLongKeyScan_c is the constant that indicate when a event is sent for a SingleLongKey */
#define mLongKeySCAN_c 50  /* Default is 1 sec. for a LongKey ( 20ms * 50 = 1 s ) */

/* typedef for keyboard event ID */
typedef uint8_t key_event_t;

/* After initialized the keyboard, the callback function receive the events listed below:
  Events for the callback function */
enum {
  gKBD_EventSW1_c,
  gKBD_EventLongSW1_c,
  gKBD_EventSW2_c,
  gKBD_EventLongSW2_c,
  gKBD_EventSW3_c,
  gKBD_EventLongSW3_c,
  gKBD_EventSW4_c,
  gKBD_EventLongSW4_c
};

/* Callback function prototype */
typedef void (*KBDFunction_t) ( uint8_t events );

#define gKeyEnable_c    ( ((mSW4_c)?mSWITCH4_MASK:0)|\
                          ((mSW3_c)?mSWITCH3_MASK:0)|\
                          ((mSW2_c)?mSWITCH2_MASK:0)|\
                          ((mSW1_c)?mSWITCH1_MASK:0))                          
                           

#define mLongKeyEvent_c ( ((mSW4Event_c)?mSWITCH4_MASK:0)|\
                          ((mSW3Event_c)?mSWITCH3_MASK:0)|\
                          ((mSW2Event_c)?mSWITCH2_MASK:0)|\
                          ((mSW1Event_c)?mSWITCH1_MASK:0))    

#define	mLongEventEnable  mLongKeyEvent_c

/*****************************************************************************
******************************************************************************
* Public type definitions
******************************************************************************
*****************************************************************************/
/*None*/

/*****************************************************************************
******************************************************************************
* Public prototypes
******************************************************************************
*****************************************************************************/
/******************************************************************************
* This function generates a callback function
*
* Interface assumptions:
*
*
* Return value:
* None
*
*
* Revison history:
*   date      Author    Comments
*   ------    ------    --------
*   22.02.06   MMA       Created
******************************************************************************/
extern void KBD_Init
  (
  KBDFunction_t pfCallBackAdr /* IN: Pointer to callback function */
  );
  

/******************************************************************************
* This interrupt function is the ISR keyboard function
*
* Interface assumptions:
*
*
* Return value:
* None
*
*
* Revison history:
*   date      Author    Comments
*   ------    ------    --------
*   14.02.06   MMA       Created
******************************************************************************/
__interrupt void Switch_Press_ISR
  (
  );

#else
  #define KBD_Init(pfCallBackAdr)
  #define Switch_Press_ISR Default_Dummy_ISR
#endif /* gKeyBoardSupported_d */

 
#endif /* _KEYBOARD_H_ */

⌨️ 快捷键说明

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