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

📄 keydeb.h

📁 * KeyDebounce Accept new key reading, handle timing for debounce & slew * KeyId Report which key i
💻 H
字号:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *  Copyright (c) 2007 by Qu chun lei watt@vip.163.com
 *
 *  File Name:          KEYDEB.H
 *  Module Number:      1201C
 *  Language:           ANSI C
 *  $Revision: 9 $
 *
 *  DEFINITION
 *  Key debounce and slewing
 *
 *  CONSTRAINTS
 *  Key ID for release must be 0
 *
 *  ACCESS FUNCTIONS
 *  KeyDebounce      Accept new key reading, handle timing for debounce & slew
 *  KeyId            Report which key is currently pressed
 *  KeySlewTimeSet   Accept slew time for key currently pressed
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef KEYDEB_H
#define KEYDEB_H

#include "dac.h"

/*--------------------------------*
 |  Conditional assembly options
 *--------------------------------*/

/*-------------*
 |  Constants
 *-------------*/

#define KEY_DEBOUNCE_TIME  3
#define KEY_ID_REPORTING   TRUE

typedef enum
{
   KEY_DEBOUNCE_EVENT_NONE,
   KEY_DEBOUNCE_EVENT_RELEASE,
   KEY_DEBOUNCE_EVENT_PRESS,
   KEY_DEBOUNCE_EVENT_SLEW

} TKeyDebounceEvent;

/*--------------------*
 |  Public functions
 *--------------------*/

/*---------------------------------------------------------------------------*
 |  KeyDebounce
 |
 |  Accept new key reading and handle timing for debounce and slewing
 |
 |  Entry:   Input key reading
 |
 |  Exit:    Return event
 *---------------------------------------------------------------------------*/

TKeyDebounceEvent KeyDebounce(UINT8 keyReading);

#if KEYID_REPORTING
/*---------------------------------------------------------------------------*
 |  KeyId
 |
 |  Report which key is currently pressed
 |
 |  Entry:   No inputs
 |
 |  Exit:    Return key ID
 *---------------------------------------------------------------------------*/

UINT8 KeyId(void);
#endif

/*---------------------------------------------------------------------------*
 |  KeySlewTimeSet
 |
 |  Accept slew time for currently pressed key
 |
 |  Entry:   Input slew time
 |
 |  Exit:    Returns nothing
 *---------------------------------------------------------------------------*/

void KeySlewTimeSet(UINT16 slewTime);

#endif

⌨️ 快捷键说明

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