keydeb.h

来自「* KeyDebounce Accept new key reading, ha」· C头文件 代码 · 共 91 行

H
91
字号
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *  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 + =
减小字号Ctrl + -
显示快捷键?