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

📄 key_drv.lst

📁 基于uCOS/II制作的MP3
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   KEY_DRV                                                               06/03/2006 10:32:53 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE KEY_DRV
OBJECT MODULE PLACED IN key_drv.obj
COMPILER INVOKED BY: C:\Program Files\keil\C51\BIN\C51.EXE lib_mcu\kbd\key_drv.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.
                    -\key_drv.lst) OBJECT(key_drv.obj)

line level    source

   1          /*C**************************************************************************
   2          * NAME:         kbd_drv.c
   3          *----------------------------------------------------------------------------
   4          * Copyright (c) 2003 Atmel.
   5          *----------------------------------------------------------------------------
   6          * RELEASE:      snd1c-refd-nf-4_0_3      
   7          * REVISION:     1.10     
   8          *----------------------------------------------------------------------------
   9          * PURPOSE:
  10          * This file contains the keypad driver routines
  11          *
  12          * NOTES:
  13          * Driver Configuration:
  14          *   - KBD_EXIT_PD in config.h define as:
  15          *      TRUE:  to allow exit of power down by keyboard
  16          *      FALSE: to disallow exit of power down by keyboard
  17          *   - LOCK_ROW in config.h
  18          *   - KEY_LOCK in config.h
  19          * Global Variables:
  20          *   - gl_kbd_lock in bdata space
  21          *****************************************************************************/
  22          
  23          /*_____ I N C L U D E S ____________________________________________________*/
  24          
  25          #include "config.h"                         /* lib configuration header */
  26          #include "key_drv.h"                        /* Keyboard driver definition */
  27          #include "modules\song\song_drv.h" 
  28          #include "lib_mcu\lcd\lcd_drv.h" 
  29          #include "lib_mcu\ide\ideio.h"
  30          #include "modules\mass\usb_task.h" 
  31          #include "modules\file\fat.h" 
  32          /*_____ M A C R O S ________________________________________________________*/
  33          
  34          
  35          /*_____ D E F I N I T I O N ________________________________________________*/
  36          
  37          
  38          /*_____ D E C L A R A T I O N ______________________________________________*/
  39          extern  bdata   bit     gl_key_press;       /* TRUE when a key is decoded */
  40          extern  idata   Byte    gl_key;             /* value of the key pressed */
  41          extern  idata   Byte    system_mode;
  42          
  43          idata keytemp;
  44          extern  idata   Byte    play_pause;
  45          extern  idata   Byte    bass_nobass;
  46          extern  Byte    song_sound; 
  47          idata Byte key_mode;
  48          
  49          static  void    kbd_set_prio (Byte);
  50          static  void    kbd_install (void);
  51          
  52          
  53          /*F**************************************************************************
  54          * NAME: kbd_init
C51 COMPILER V7.50   KEY_DRV                                                               06/03/2006 10:32:53 PAGE 2   

  55          *----------------------------------------------------------------------------
  56          * PARAMS:
  57          *
  58          * return:
  59          *----------------------------------------------------------------------------
  60          * PURPOSE: 
  61          *   Keyboard initialisation function
  62          *----------------------------------------------------------------------------
  63          * EXAMPLE:
  64          *----------------------------------------------------------------------------
  65          * NOTE:
  66          *----------------------------------------------------------------------------
  67          * REQUIREMENTS:
  68          * ram/xram:
  69          * cycle:
  70          * stack: 
  71          * code:
  72          *****************************************************************************/
  73          void kbd_init (void)
  74          {
  75   1        #if KBD_EXIT_PD
  76   1        Kbd_enable_pd_exit();         /* enable keyboard Power-Down exit */
  77   1        kbd_set_prio(KBD_PRIO);
  78   1        #endif
  79   1        kbd_install();
  80   1      }
  81          
  82          
  83          /*F**************************************************************************
  84          * NAME: kbd_install
  85          *----------------------------------------------------------------------------
  86          * PARAMS:
  87          *
  88          * return:
  89          *----------------------------------------------------------------------------
  90          * PURPOSE: 
  91          *   Keyboard IT and columns mask init
  92          *----------------------------------------------------------------------------
  93          * EXAMPLE:
  94          *----------------------------------------------------------------------------
  95          * NOTE:
  96          *----------------------------------------------------------------------------
  97          * REQUIREMENTS:
  98          * ram/xram:
  99          * cycle:
 100          * stack: 
 101          * code:
 102          *****************************************************************************/
 103          void kbd_install (void)
 104          {
 105   1        
 106   1        KBSTA = KBSTA;                /* dummy read for clearing pending interrupt */
 107   1      
 108   1        #if KBD_EXIT_PD
 109   1        Kbd_enable_int();             /* enable or re-enable the kbd interrupt */
 110   1        Kbd_unmask_int();
 111   1        Kbd_low_int(); 
 112   1        #endif
 113   1      }
 114          
 115          
 116          /*F**************************************************************************
C51 COMPILER V7.50   KEY_DRV                                                               06/03/2006 10:32:53 PAGE 3   

 117          * NAME: kbd_set_prio
 118          *----------------------------------------------------------------------------
 119          * PARAMS:
 120          *
 121          * return:
 122          *----------------------------------------------------------------------------
 123          * PURPOSE: 
 124          *   Set the keyboard interface priority interrupt
 125          *----------------------------------------------------------------------------
 126          * EXAMPLE:
 127          *----------------------------------------------------------------------------
 128          * NOTE:
 129          *----------------------------------------------------------------------------
 130          * REQUIREMENTS:
 131          * ram/xram:
 132          * cycle:
 133          * stack: 
 134          * code:
 135          *****************************************************************************/
 136          #if KBD_EXIT_PD
 137          void kbd_set_prio (Byte priority)
 138          {
 139   1        if ((priority == 1) || (priority == 3))     /* set LSB priority bit */
 140   1        {
 141   2          IPL1 |=  MSK_EKB;
 142   2        }
 143   1        if ((priority == 2) || (priority == 3))     /* set MSB priority bit */
 144   1        {
 145   2          IPH1 |= MSK_EKB;
 146   2        }
 147   1      }
 148          #endif
 149          
 150          
 151          /*F**************************************************************************
 152          * NAME: kbd_decode
 153          *----------------------------------------------------------------------------
 154          * PARAMS:
 155          *
 156          * return:
 157          *   Decoded key pressed
 158          *----------------------------------------------------------------------------
 159          * PURPOSE: 
 160          *   Decode the key that generated an IT
 161          *----------------------------------------------------------------------------
 162          * EXAMPLE:
 163          *----------------------------------------------------------------------------
 164          * NOTE:
 165          *----------------------------------------------------------------------------
 166          * REQUIREMENTS:
 167          * ram/xram:
 168          * cycle:
 169          * stack: 
 170          * code:
 171          *****************************************************************************/
 172          Byte kbd_decode (void)
 173          {
 174   1       Byte key;
 175   1      
 176   1          switch (keytemp & 0x0f)
 177   1           {
 178   2                case KEY_0:
C51 COMPILER V7.50   KEY_DRV                                                               06/03/2006 10:32:53 PAGE 4   

 179   2                       gl_key_press = TRUE;
 180   2                       key = KEY_0;
 181   2                       kbd_install();
 182   2                               return (key);
 183   2                case KEY_1:
 184   2                       gl_key_press = TRUE;
 185   2                       key = KEY_1;
 186   2                               kbd_install();

⌨️ 快捷键说明

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