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

📄 lcd.lst

📁 智原mp3 SDK 开发包 与巨力 有mp3 wma ogg decoder
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   LCD                                                                   09/05/2008 09:54:55 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN ..\output\output_bin\output_setting\lcd.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\code\common\lcd.c LARGE OPTIMIZE(9,SIZE) BROWSE INCDIR(..\..\..\bsp\i
                    -nclude;..\..\code\ap_setting\src\include;..\..\code\global;..\..\code\include) DEFINE(CONFIG_ASIC,dynamic_load) DEBUG OB
                    -JECTEXTEND PRINT(..\output\output_bin\output_setting\lcd.lst) OBJECT(..\output\output_bin\output_setting\lcd.obj)

line level    source

   1          #include <string.h>
   2          #include "api.h"
   3          //#include "mp3app.h"
   4          #include "get_latin2.h"
   5          #include "lcd.h"
   6          #include "get_latin2.h"
   7          #include"common.h"
   8          
   9          
  10          #define MIN(a,b)        ((a) < (b) ? (a) : (b))
  11          #define MAX(a,b)        ((a) > (b) ? (a) : (b))
  12          
  13          UINT8 lcd_max_str;
  14          
  15          #ifdef loop_show_file_name
              INT8 sonename_loop_step;//john 070606
              INT8 songname_Chinese_max;//john 070606
              INT8 songname_English_max;//john 070606
              #endif
  20          
  21          UINT16 fg_color, bg_color;
  22          UINT16 bg_pixel[SCREEN_WIDTH];
  23          UINT16 pixel_buf[256];
  24          
  25          
  26          void delay_1ms(void)
  27          {
  28   1              UINT16 n;
  29   1              
  30   1              for(n = 420; n > 0; n--) {}
  31   1      }
  32          
  33          void delay(UINT16 n)
  34          {
  35   1              while(n--)
  36   1                      delay_1ms();
  37   1      }
  38          
  39          void writec(UINT8 cmd)
  40          {
  41   1              lcd_setcmd(cmd);
  42   1      }
  43          void writed(UINT8 lcddata)
  44          {
  45   1              lcd_setdata(lcddata);
  46   1      }
  47          
  48          void write2c(UINT8 i, UINT8 j)
  49          {
  50   1              writec(i);
  51   1              writec(j);
  52   1      }
  53          
C51 COMPILER V7.50   LCD                                                                   09/05/2008 09:54:55 PAGE 2   

  54          BOOLEAN lcd_put_data(UINT16 buf, UINT16 size)
  55          {
  56   1              return api_bLcdDataMove(buf,size);
  57   1      }
  58          
  59          #if 0
              BOOLEAN lcd_get_data(UINT16 buf, UINT16 size)
              {
                      UINT16 i;
                      UINT8 xdata *ptr = (UINT8 xdata *)buf;
               
                      api_vLcdPinSelect();
               
                      for(i = 0; i < size; i++) {
                              LCDC_DMYRDRS = 1;
                              while(!LCDC_READY);
                              ptr[i] = LCDC_DATARS1;
                      } 
                      api_vLcdPinRecover();
                      return true;
              }
              #endif
  76          
  77          void lcd_set_rw_area(UINT8 x, UINT8 y, UINT8 w, UINT8 h)
  78          {
  79   1              api_vLcdPinSelect();
  80   1                      
  81   1              writec(0x43);
  82   1              writec(x);                      // start x
  83   1              writec(x + w - 1);              // end x
  84   1              
  85   1              writec(0x42);
  86   1              writec(y+2);                    // start y
  87   1              writec(y + h + 1 );             // end y
  88   1              api_vLcdPinRecover();
  89   1      } 
  90          
  91          void lcd_set_disply_mode(UINT8 disply_mode,UINT8 scan_direction )
  92          {
  93   1              api_vLcdPinSelect();
  94   1              writec(0x40);
  95   1              writec(disply_mode); //显示模式
  96   1              writec(0x10);
  97   1              writec(scan_direction); // 扫描方向 22 和 26相反
  98   1              api_vLcdPinRecover();   
  99   1      }
 100          
 101          /*
 102          void lcd_set_rw_area1(UINT8 x, UINT8 y, UINT8 w, UINT8 h)
 103          {
 104                  api_vLcdPinSelect();
 105                  
 106                  writec(X_ADDR_AREA_SET);
 107                  writec(x);                      // start x
 108                  writec(x + w - 1);              // end x
 109                  
 110                  writec(Y_ADDR_AREA_SET);
 111                  writec(y);                      // start y
 112                  writec(y + h - 1);              // end y
 113                  
 114                  api_vLcdPinRecover();
 115          }
C51 COMPILER V7.50   LCD                                                                   09/05/2008 09:54:55 PAGE 3   

 116          */
 117          
 118          BOOLEAN lcd_putc_8x8(UINT8 x, UINT8 y, UINT8 c)
 119          {
 120   1              UINT8 i, j, w, h;
 121   1              UINT16 xdata *pixel = pixel_buf;
 122   1      
 123   1              if(x >= XRES || y >= YRES)
 124   1                      return false;
 125   1      
 126   1              w = MIN(8, XRES - x);
 127   1              h = MIN(8, YRES - y);
 128   1              
 129   1              lcd_set_rw_area(x, y, w, h);
 130   1              
 131   1              api_bGetLatinFont8x8BMP(c);
 132   1              
 133   1              for(j = 0; j < h; j++) {
 134   2                      for(i = 0; i < w; i++) {
 135   3                              if((BitMapData[i] >> j) & 0x1)
 136   3                                      *pixel++ = fg_color;
 137   3                              else
 138   3                              {                       
 139   4                                      *pixel++ = bg_color;
 140   4                              }               
 141   3                      }
 142   2              }       
 143   1              
 144   1              lcd_put_data((UINT16)pixel_buf, w*h*2); 
 145   1              return true;
 146   1      }
 147          
 148          BOOLEAN lcd_putc_8x16(UINT8 x, UINT8 y, UINT8 c)
 149          {       
 150   1              UINT8 i, j, w, h;
 151   1              
 152   1              UINT16 xdata *pixel = pixel_buf;
 153   1              
 154   1              api_bGetLatinFont8x16BMP(c);
 155   1              
 156   1              if(x >= XRES || y >= YRES)
 157   1                      return false;
 158   1      
 159   1              w = MIN(8, XRES - x);
 160   1              h = MIN(16, YRES - y);
 161   1              
 162   1              lcd_set_rw_area(x, y, w, h);
 163   1      
 164   1              for(j = 0; j < 8; j++) {
 165   2                      for(i = 8; i < 16; i++) {
 166   3                              if((BitMapData[i] >> j) & 0x1)
 167   3                                      *pixel++ = fg_color;
 168   3                              else
 169   3                              {                       
 170   4                                      *pixel++ = bg_color;
 171   4                      }
 172   3              }
 173   2              }
 174   1                      
 175   1              for(j = 0; j < 8; j++) {
 176   2                      for(i = 0; i < w; i++) {
 177   3                              if((BitMapData[i] >> j) & 0x1)
C51 COMPILER V7.50   LCD                                                                   09/05/2008 09:54:55 PAGE 4   

 178   3                                      *pixel++ = fg_color;
 179   3                              else
 180   3                                      *pixel++ = bg_color;
 181   3                      }
 182   2              }
 183   1              
 184   1              lcd_put_data((UINT16)pixel_buf, (UINT16)w*h*2); 
 185   1              return true;
 186   1      }
 187          
 188          BOOLEAN lcd_putc_16x16(UINT8 x, UINT8 y, UINT16 gcode)
 189          {
 190   1              UINT8 i, j, w, h;
 191   1              UINT16 xdata *pixel = (UINT16 xdata *)&pixel_buf[0];
 192   1              
 193   1              if(x >= XRES || y >= YRES)
 194   1                      return false;
 195   1                      
 196   1              if(gcode) {
 197   2                      if(!api_bGetUniFont16x16BMP(gcode))
 198   2                              return false;           
 199   2              }
 200   1              
 201   1              w = MIN(16, XRES - x);
 202   1              h = MIN(16, YRES - y);
 203   1              
 204   1              lcd_set_disply_mode(0x08,0x22);
 205   1              
 206   1              lcd_set_rw_area(x,142 - y, w, h); //or 108
 207   1                                      
 208   1              for(j = 0; j < h; j++) {
 209   2                      for(i = 0; i < w; i++) {
 210   3                              if((BitMapData[(i << 1) + (j >> 3)] >> (j & 0x7)) & 0x1)
 211   3                                      *pixel++ = fg_color;
 212   3                              else
 213   3                              {                       
 214   4                                      //if(!textoutmode)
 215   4                                              *pixel++ = bg_color;
 216   4                              }
 217   3                      }               
 218   2              }
 219   1      
 220   1              lcd_put_data((UINT16)pixel_buf, (UINT16)w*h*2);
 221   1              
 222   1              //CDIR = 0;
 223   1              lcd_set_disply_mode(0x00,0x22);
 224   1              
 225   1              return true;
 226   1      }
 227          
 228          void lcd_puts(UINT8 x, UINT8 y, UINT8 *str, UINT8 fontsize)
 229          {
 230   1              
 231   1              INT8S data r1;
 232   1              UINT8 data n;
 233   1      
 234   1              n = 0;
 235   1              r1 = 0;
 236   1              api_s8GetFont16x16BMP(0, TRUE);
 237   1      
 238   1              while(*str != '\0') {
 239   2                      if(n >= lcd_max_str)
C51 COMPILER V7.50   LCD                                                                   09/05/2008 09:54:55 PAGE 5   

 240   2                              return;
 241   2                                      

⌨️ 快捷键说明

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