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

📄 disp_task.lst

📁 一个可作为mp3播放器固件的代码集,包括解码,播放,控制,任务管理等.
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   DISP_TASK                                                             09/20/2005 21:47:45 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE DISP_TASK
OBJECT MODULE PLACED IN disp_task.obj
COMPILER INVOKED BY: e:\Keil\C51\BIN\C51.EXE modules\display\disp_task.c OPTIMIZE(7,SPEED) BROWSE INCDIR(.\modules\syste
                    -m;.\;.\;.\lib_refd) DEFINE(KEIL) DEBUG OBJECTEXTEND PRINT(.\disp_task.lst) OBJECT(disp_task.obj)

line level    source

   1          /*C**************************************************************************
   2          * NAME:         disp_task.c
   3          *----------------------------------------------------------------------------
   4          * Copyright (c) 2003 Atmel.
   5          *----------------------------------------------------------------------------
   6          * RELEASE:      snd1c-refd-nf-4_0_3      
   7          * REVISION:     1.13     
   8          *----------------------------------------------------------------------------
   9          * PURPOSE:
  10          * This file contains the display task and attached routines
  11          *
  12          * NOTES:
  13          * Global Variables:
  14          *   - gl_cpt_tick:    global tick counter in data space
  15          *   - gl_sbc_wr_busy: SCSI write busy flag set to OFF in this task
  16          *   - gl_sbc_rd_busy: SCSI read busy flag set to OFF in thsi task
  17          *****************************************************************************/
  18          
  19          /*_____ I N C L U D E S ____________________________________________________*/
  20          
  21          #include "config.h"                         /* system configuration */
  22          #include "board.h"                          /* board definition */
  23          #include "modules\file\file.h"              /* file definition */
  24          #include "modules\display\disp.h"           /* display definition */
  25          #include "disp_task.h"                      /* display task definition */
  26          #ifndef CONF_DISPLAY
                #define LCD 0
                #define LED 1
                #define CONF_DISPLAY   LCD
              #endif
  31          #if CONF_DISPLAY == LED
  32          #include "modules\display\led.h"            /* led definition */
  33          #endif
  34          
  35          /*_____ M A C R O S ________________________________________________________*/
  36          #if CONF_DISPLAY == LED
  37          #define REF_STATE_SONG      0
  38          #define REF_STATE_VOICE     1
  39          #define REF_STATE_USB       2
  40          #define REF_STATE_FORMAT    3
  41          #endif
  42          
  43          /*_____ D E F I N I T I O N ________________________________________________*/
  44          
  45          extern  data    Byte    gl_cpt_tick;        /* general tick counter */
  46          extern  bdata   bit     fs_memory;          /* selected file system */
  47          extern          bit     gl_sbc_wr_busy;     /* SBC write busy flag */
  48          extern          bit     gl_sbc_rd_busy;     /* SBC read busy flag */
  49          static  bdata   bit     disp_scroll_on;     /* set to TRUE to scroll name */
  50          static  bdata   bit     disp_clock_on;      /* set to TRUE to start clock */
  51          static  data    Byte    disp_sec_cpt;       /* second counter */
  52          static  data    Byte    disp_min_cpt;       /* minute counter */
  53          static  data    char pdata *  disp_buffer;
  54          
C51 COMPILER V7.50   DISP_TASK                                                             09/20/2005 21:47:45 PAGE 2   

  55          
  56          static  xdata   Byte    gl_cpt_tick_save;   /* tick counter saved value */
  57          static  xdata   Byte    disp_sec_cpt_save;  /* second counter saved value */
  58          static  xdata   Byte    disp_min_cpt_save;  /* minute counter saved value */
  59          
  60          static  data    Byte    disp_state;         /* task state */
  61          
  62          #if CONF_DISPLAY == LED
  63          extern xdata Byte  func_state;
  64          extern xdata Byte  func_timeout;  // Time out special function
  65          extern xdata Byte  ref_state;
  66          extern bit         playing;
  67          extern bit         pause;
  68          extern bit         recording;
  69          extern bit         connected;
  70          extern xdata Byte  LED_ON;
  71          extern xdata Byte  LED_FAST;
  72          #endif
  73          
  74          /*_____ D E C L A R A T I O N ______________________________________________*/
  75          
  76          
  77          /*F**************************************************************************
  78          * NAME: disp_task_init
  79          *----------------------------------------------------------------------------
  80          * PARAMS:
  81          *
  82          * return:
  83          *----------------------------------------------------------------------------
  84          * PURPOSE: 
  85          *   Display task initialization
  86          *----------------------------------------------------------------------------
  87          * EXAMPLE:
  88          *----------------------------------------------------------------------------
  89          * NOTE:
  90          *----------------------------------------------------------------------------
  91          * REQUIREMENTS:
  92          *****************************************************************************/
  93          void disp_task_init (void)
  94          {
  95   1        disp_scroll_on = FALSE;
  96   1        disp_clock_on = FALSE;
  97   1        disp_state = DISP_IDLE;
  98   1        print_init();
  99   1      }
 100          
 101          
 102          /*F**************************************************************************
 103          * NAME: disp_task
 104          *----------------------------------------------------------------------------
 105          * PARAMS:
 106          *
 107          * return:
 108          *----------------------------------------------------------------------------
 109          * PURPOSE: 
 110          *   Display task handling display of clock and scrolling of file name
 111          *----------------------------------------------------------------------------
 112          * EXAMPLE:
 113          *----------------------------------------------------------------------------
 114          * NOTE:
 115          *----------------------------------------------------------------------------
 116          * REQUIREMENTS:
C51 COMPILER V7.50   DISP_TASK                                                             09/20/2005 21:47:45 PAGE 3   

 117          *****************************************************************************/
 118          void disp_task (void)
 119          {
 120   1        #if CONF_DISPLAY == LED
 121   1        led_task();
 122   1        #endif
 123   1        switch (disp_state)
 124   1        {
 125   2          case DISP_IDLE:
 126   2          {
 127   3            #if CONF_DISPLAY != LED
                    if (gl_sbc_wr_busy || gl_sbc_rd_busy) /* still busy */
                    {
                      Lcd_cur_on();                       /* blinking cursor for .5 sec */
                      gl_sbc_wr_busy = FALSE;
                      gl_sbc_rd_busy = FALSE;
                      gl_cpt_tick = 0;
                      disp_state = DISP_MS_BUSY;
                    }
                    #endif
 137   3            break;
 138   3          }
 139   2      
 140   2          case DISP_INIT:
 141   2          {
 142   3            disp_state = DISP_TICK0;
 143   3            gl_cpt_tick = 0;
 144   3            disp_buffer = File_get_name();
 145   3            if (print_name(disp_buffer) != TRUE)  /* test if not short name */
 146   3            {
 147   4              disp_scroll_on = TRUE;              /* activate name scrolling */
 148   4            }
 149   3            else
 150   3            {
 151   4              disp_scroll_on = FALSE;             /* no scrolling */
 152   4            }
 153   3            break;
 154   3          }
 155   2      
 156   2          case DISP_TICK0:
 157   2          {
 158   3            if (gl_cpt_tick > DISP_TICK_500)      /* 1/2 sec expiration */
 159   3            {
 160   4              if (disp_scroll_on)
 161   4              {
 162   5                if (print_name(disp_buffer))
 163   5                {
 164   6                  disp_buffer = File_get_name();
 165   6                }
 166   5                else
 167   5                {
 168   6                  disp_buffer++;
 169   6                }
 170   5              }
 171   4              disp_state = DISP_TICK1;
 172   4            }
 173   3            break;
 174   3          }
 175   2      
 176   2          case DISP_TICK1:
 177   2          {
 178   3            if (gl_cpt_tick > DISP_TICK_SEC)      /* 1/2 sec expiration */
C51 COMPILER V7.50   DISP_TASK                                                             09/20/2005 21:47:45 PAGE 4   

 179   3            {
 180   4              gl_cpt_tick -= DISP_TICK_SEC;
 181   4              if (disp_scroll_on)
 182   4              {
 183   5                if (print_name(disp_buffer))
 184   5                {
 185   6                  disp_buffer = File_get_name();
 186   6                }
 187   5                else
 188   5                {
 189   6                  disp_buffer++;
 190   6                }
 191   5              }
 192   4              if (disp_clock_on)
 193   4              {
 194   5                disp_state = DISP_SEC;
 195   5              }
 196   4              else
 197   4              {
 198   5                disp_state = DISP_TICK0;
 199   5              }
 200   4            }
 201   3            break;
 202   3          }
 203   2      
 204   2          case DISP_SEC:
 205   2          {
 206   3            if (disp_sec_cpt == DISP_SEC_MIN)     /* 1 min expiration */
 207   3            {
 208   4              disp_sec_cpt = 0;
 209   4              print_sec(disp_sec_cpt);
 210   4              disp_state = DISP_MIN;
 211   4            }
 212   3            else
 213   3            {
 214   4              disp_sec_cpt++;
 215   4              print_sec(disp_sec_cpt);
 216   4              disp_state = DISP_TICK0;
 217   4            }
 218   3            break;
 219   3          }
 220   2      
 221   2          case DISP_MIN:
 222   2          {
 223   3            disp_min_cpt++;
 224   3            print_min(disp_min_cpt);
 225   3            disp_state = DISP_TICK0;
 226   3            break;
 227   3          }
 228   2      
 229   2          case DISP_MS_BUSY:
 230   2          {
 231   3            #if CONF_DISPLAY != LED
                    if (gl_sbc_wr_busy || gl_sbc_rd_busy) /* still busy */
                    {
                      gl_sbc_wr_busy = FALSE;
                      gl_sbc_rd_busy = FALSE;
                      gl_cpt_tick = 0;
                    }
                    else
                    {
                      if (gl_cpt_tick > DISP_TICK_500)    /* 1/2 sec expiration */
C51 COMPILER V7.50   DISP_TASK                                                             09/20/2005 21:47:45 PAGE 5   

                      {
                        Lcd_cur_off();
                        disp_state = DISP_IDLE;
                      }
                    }
                    #endif
 247   3          }
 248   2        }
 249   1      }
 250          
 251          
 252          /*F**************************************************************************
 253          * NAME: disp_name_start 
 254          *----------------------------------------------------------------------------
 255          * PARAMS:
 256          *
 257          * return:
 258          *----------------------------------------------------------------------------
 259          * PURPOSE: 
 260          *   Start name display
 261          *----------------------------------------------------------------------------
 262          * EXAMPLE:
 263          *----------------------------------------------------------------------------
 264          * NOTE:
 265          *----------------------------------------------------------------------------
 266          * REQUIREMENTS:
 267          *****************************************************************************/
 268          void disp_name_start (void)
 269          {
 270   1        disp_state = DISP_INIT;
 271   1      }
 272          
 273          
 274          #if CONF_DISPLAY == LED
 275          /*F**************************************************************************
 276          * NAME: disp_end_of_play 
 277          *----------------------------------------------------------------------------
 278          * PARAMS:
 279          *
 280          * return:
 281          *----------------------------------------------------------------------------
 282          * PURPOSE:
 283          *   Suspend name display
 284          *----------------------------------------------------------------------------
 285          * EXAMPLE:
 286          *----------------------------------------------------------------------------
 287          * NOTE:
 288          *----------------------------------------------------------------------------
 289          * REQUIREMENTS:
 290          *****************************************************************************/
 291          void disp_end_of_play (void)
 292          {
 293   1      LED_ON = (8>>ref_state);
 294   1      LED_FAST = 3;
 295   1      if (recording)
 296   1        {
 297   2        SHUT_MIC = 1;
 298   2        pause=FALSE;
 299   2        recording=FALSE;
 300   2        }
 301   1      else if (playing && ref_state==REF_STATE_VOICE)
 302   1        {
C51 COMPILER V7.50   DISP_TASK                                                             09/20/2005 21:47:45 PAGE 6   

 303   2        func_state=0;
 304   2        recording=TRUE;
 305   2        LED_FAST=2;
 306   2        }
 307   1      else func_state=0;
 308   1      playing=FALSE;
 309   1      
 310   1        disp_state = DISP_IDLE;
 311   1      }
 312          #endif

⌨️ 快捷键说明

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