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

📄 key.lst

📁 Bitek 公司 bit1611b模拟屏驱动芯片外接MCU驱动DEMO源码
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   KEY                                                                   02/05/2007 16:33:25 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE KEY
OBJECT MODULE PLACED IN .\OBJ\KEY.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE KEY.C ROM(COMPACT) OPTIMIZE(9,SPEED) NOAREGS DEFINE(PROJECT=DMO04015800,MCU
                    -_CFG=BIT5101,VP_IF_CFG=VP_IF_BITEK) PRINT(.\LST\KEY.lst) OBJECT(.\OBJ\KEY.obj)

line level    source

   1          /* **********************************************************************
   2          
   3                   Copyright (c) 2002-2006 Beyond Innovation Technology Co., Ltd
   4          
   5                  All rights are reserved. Reproduction in whole or in parts is
   6              prohibited without the prior written consent of the copyright owner.
   7             ----------------------------------------------------------------------
   8          
   9              Module: KEY.C - Keypad.
  10          
  11              Purpose: Implementation of KEY module.
  12          
  13              Version: 0.01                                   11:35AM  2005/11/17
  14          
  15              Compiler: Keil 8051 C Compiler v8.01
  16          
  17              Reference:
  18          
  19             ----------------------------------------------------------------------
  20              Modification:
  21          
  22              R0.01 11:35AM  2005/11/17 Jeffrey Chang
  23              Reason:
  24                  1. Original.
  25              Solution:
  26          
  27             ********************************************************************** */
  28          
  29          #define _KEY_C_
  30          
  31          /* ------------------------------------
  32              Header Files
  33             ------------------------------------ */
  34          #include "key.h"
  35          
  36          
  37          /* ::::::::::::::::::::::::::::::::::::
  38              Key scanning states
  39             :::::::::::::::::::::::::::::::::::: */
  40          #define KEY_STATE_UP                    1
  41          #define KEY_STATE_DEBOUNCE              2
  42          #define KEY_STATE_REPEAT_START_DELAY    3
  43          #define KEY_STATE_REPEAT_DELAY          4
  44          
  45          #define NO_RELEASE_AFTER_STILL          ON
  46          
  47          
  48          
  49          /* ------------------------------------
  50              Macro Definitions
  51             ------------------------------------ */
  52          
  53          
  54          
C51 COMPILER V7.50   KEY                                                                   02/05/2007 16:33:25 PAGE 2   

  55          /* ------------------------------------
  56              Type Definitions
  57             ------------------------------------ */
  58          
  59          
  60          /* ------------------------------------
  61              Variables Definitions
  62             ------------------------------------ */
  63          static UB8 abKeyBfr[ KEY_BFR_SIZE ];       /* Keypad buffer */
  64          
  65          /* Buffer index where next scan code will be inserted */
  66          static UB8 bKeyBfrInIdx;
  67          
  68          /* Buffer index where next scan code will be removed */
  69          static UB8 bKeyBfrOutIdx;
  70          
  71          
  72          #if (NO_RELEASE_AFTER_STILL)
  73          // To filter out the RELEASE key after STILL one.
  74          static BOOL fKeyNO_STILL;
  75          #endif
  76          
  77          
  78          /* ------------------------------------
  79              Function Prototypes
  80             ------------------------------------ */
  81          
  82          /* -------------------------------------------------------------------
  83              Name: KEY_BufferFlush -
  84              Purpose: To flush the key buffer data structure.
  85              Passed: None.
  86              Returns: None.
  87              Notes:
  88             ------------------------------------------------------------------- */
  89          void KEY_BufferFlush (void)
  90          {
  91   1          bKeyCnt         = 0;
  92   1          bKeyBfrInIdx    = 0;
  93   1          bKeyBfrOutIdx   = 0;
  94   1      } /* KEY_BufferFlush */
  95          
  96          
  97          /* -------------------------------------------------------------------
  98              Name: KEY_BufferIn -
  99              Purpose: To insert a scan code into the key buffer data structure.
 100              Passed:
 101                  UB8 bCode = a scan code.
 102              Returns: None.
 103              Notes:
 104                  1) THIS ONE MIGHT BE CALLED FROM different ISRs / Code.
 105                     Therefore no local variables are allowed otherwise it causes
 106                     a overlay error in Keil-C.
 107             ------------------------------------------------------------------- */
 108          void KEY_BufferIn (UB8 bCode)
 109          {
 110   1          if (bCode)
 111   1          {
 112   2              if (bKeyCnt < KEY_BFR_SIZE)
 113   2              {
 114   3                  bKeyCnt++;
 115   3      
 116   3                  abKeyBfr[ bKeyBfrInIdx++ ] = bCode;
C51 COMPILER V7.50   KEY                                                                   02/05/2007 16:33:25 PAGE 3   

 117   3      
 118   3                  if (bKeyBfrInIdx >= KEY_BFR_SIZE)
 119   3                      bKeyBfrInIdx = 0;
 120   3              } /* if */
 121   2          }
 122   1      } /* KEY_BufferIn */
 123          
 124          
 125          /* -------------------------------------------------------------------
 126              Name: KEY_BufferOut -
 127              Purpose: To retrieve a scan code from the key buffer data structure.
 128              Passed: None.
 129              Returns:
 130                  KEY_NULL if there is no key in the key buffer.
 131              Notes:
 132             ------------------------------------------------------------------- */
 133          UB8 KEY_BufferOut (void)
 134          {
 135   1          UB8 bCode;
 136   1      
 137   1      
 138   1          if (bKeyCnt)
 139   1          {
 140   2              bKeyCnt--;
 141   2      
 142   2              bCode = abKeyBfr[ bKeyBfrOutIdx ];
 143   2      
 144   2              bKeyBfrOutIdx++;
 145   2              if (bKeyBfrOutIdx >= KEY_BFR_SIZE)
 146   2                  bKeyBfrOutIdx = 0;
 147   2      
 148   2              return( bCode );
 149   2          }
 150   1          else
 151   1          {
 152   2              return( KEY_NULL );
 153   2          } /* if */
 154   1      } /* KEY_BufferOut */
 155          
 156          
 157          /* -------------------------------------------------------------------
 158              Name: KEY_Decode -
 159              Purpose: To decode keypad pins to scan code.
 160              Passed: None.
 161              Returns:
 162                  KEY_NULL if there is no key in the key buffer.
 163          
 164              Notes: Keypad is active low.
 165             ------------------------------------------------------------------- */
 166          UB8 KEY_Decode (void)
 167          {
 168   1          return( (~KEY_IOPORT) & KEY_MASK );
 169   1      } /* KEY_Decode */
 170          
 171          
 172          /* -------------------------------------------------------------------
 173              Name: KEY_Hit -
 174              Purpose: To check whether the key buffer is not empty.
 175              Passed: None.
 176              Returns:
 177                  TRUE if the key buffer is not empty.
 178              Notes:
C51 COMPILER V7.50   KEY                                                                   02/05/2007 16:33:25 PAGE 4   

 179             ------------------------------------------------------------------- */
 180          BOOL KEY_Hit (void)
 181          {
 182   1          return( bKeyCnt > 0 );
 183   1      } /* KEY_Hit */
 184          
 185          
 186          /* -------------------------------------------------------------------
 187              Name: KEY_Init -
 188              Purpose: To initialize the KEY module.
 189              Passed: None.
 190              Returns: None.
 191              Notes:
 192                  KEY_Init() must be called before calling any other of
 193              the user accessible functions.
 194          
 195             ------------------------------------------------------------------- */
 196          void KEY_Init (void)
 197          {
 198   1          // Setup KEYPAD input !
 199   1      
 200   1          #if (PLATFORM_CFG == PLATFORM_01_DMO1611A0)
                  // (01)VID540-100-027/BIT1611B0  (v1.00 2005/10/14 BIT1611B0 Demo Board)
              
                  KEY_iPOWER      = 1;
              
                  KEY_iMENU       = 1;
                  KEY_iSELECT     = 1;
                  KEY_iUP         = 1;
                  KEY_iDOWN       = 1;
              
                  #elif (PLATFORM_CFG == PLATFORM_04_DMO1611S0)
 211   1          // (04)PLATFORM_04_DMO1611S0 (VID502-002-031,BIT1611BS0)
 212   1      
 213   1          KEY_iPOWER      = 1;
 214   1      
 215   1          KEY_iMENU       = 1;
 216   1          KEY_iSELECT     = 1;
 217   1          KEY_iUP         = 1;
 218   1          KEY_iDOWN       = 1;
 219   1      
 220   1          #elif (PLATFORM_CFG == PLATFORM_06_VTX0501)
                  // (06)PLATFORM_06_VTX0501 (BMW HS 2.1)
              
                  KEY_iPOWER      = 1;
              

⌨️ 快捷键说明

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