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

📄 lcd.lst

📁 智原mp3 SDK 开发包 与巨力 有mp3 wma ogg decoder
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   LCD                                                                   08/18/2008 13:49:10 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN ..\output\output_bin\output_ebook\lcd.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\code\ap_ebook\src\lcd.c LARGE OPTIMIZE(9,SIZE) BROWSE INCDIR(..\..\..
                    -\bsp\include;..\..\code\ap_ebook\src\include;..\..\code\global;..\..\code\include) DEFINE(CONFIG_ASIC,dynamic_load) DEBU
                    -G OBJECTEXTEND PRINT(..\output\output_bin\output_ebook\lcd.lst) OBJECT(..\output\output_bin\output_ebook\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          //extern unsigned char code font8x16[];
  26          
  27          void delay_1ms(void)
  28          {
  29   1              UINT16 n;
  30   1              
  31   1              for(n = 420; n > 0; n--) {}
  32   1      }
  33          
  34          void delay(UINT16 n)
  35          {
  36   1              while(n--)
  37   1                      delay_1ms();
  38   1      }
  39          
  40          void writec(UINT8 cmd)
  41          {
  42   1              lcd_setcmd(cmd);
  43   1      }
  44          void writed(UINT8 lcddata)
  45          {
  46   1              lcd_setdata(lcddata);
  47   1      }
  48          
  49          void write2c(UINT8 i, UINT8 j)
  50          {
  51   1              writec(i);
  52   1              writec(j);
  53   1      }
C51 COMPILER V7.50   LCD                                                                   08/18/2008 13:49:10 PAGE 2   

  54          
  55          BOOLEAN lcd_put_data(UINT16 buf, UINT16 size)
  56          {
  57   1              return api_bLcdDataMove(buf, size);
  58   1      }
  59          
  60          #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
  78          
  79          void lcd_set_rw_area(UINT8 x, UINT8 y, UINT8 w, UINT8 h)
  80          {
  81   1              api_vLcdPinSelect();
  82   1                      
  83   1              writec(0x43);
  84   1              writec(x);                      // start x
  85   1              writec(x + w - 1);              // end x
  86   1              
  87   1              writec(0x42);
  88   1              writec(y+2);                    // start y
  89   1              writec(y + h + 1 );             // end y
  90   1          api_vLcdPinRecover();
  91   1      } 
  92          
  93          void lcd_set_disply_mode(UINT8 disply_mode,UINT8 scan_direction )
  94          {
  95   1              api_vLcdPinSelect();
  96   1              writec(0x40);
  97   1              writec(disply_mode); //显示模式
  98   1              writec(0x10);
  99   1              writec(scan_direction); // 扫描方向 22 和 26相反
 100   1              api_vLcdPinRecover();   
 101   1      }
 102          /*
 103          void lcd_set_rw_area1(UINT8 x, UINT8 y, UINT8 w, UINT8 h)
 104          {
 105                  api_vLcdPinSelect();
 106                  
 107                  writec(X_ADDR_AREA_SET);
 108                  writec(x);                      // start x
 109                  writec(x + w - 1);              // end x
 110                  
 111                  writec(Y_ADDR_AREA_SET);
 112                  writec(y);                      // start y
 113                  writec(y + h - 1);              // end y
 114                  
 115                  api_vLcdPinRecover();
C51 COMPILER V7.50   LCD                                                                   08/18/2008 13:49:10 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                                                                   08/18/2008 13:49:10 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              lcd_set_disply_mode(0x00,0x22);
 223   1              
 224   1              return true;
 225   1      }
 226          
 227          void lcd_puts(UINT8 x, UINT8 y, UINT8 *str, UINT8 fontsize)
 228          {
 229   1              
 230   1              INT8S data r1;
 231   1              UINT8 data n;
 232   1      
 233   1              n = 0;
 234   1              r1 = 0;
 235   1              api_s8GetFont16x16BMP(0, TRUE);
 236   1      
 237   1              while(*str != '\0') {
 238   2                      if(n >= lcd_max_str)
 239   2                              return;
C51 COMPILER V7.50   LCD                                                                   08/18/2008 13:49:10 PAGE 5   

 240   2                                      
 241   2                      if(fontsize == FONTSIZE_8x8) {
 242   3                              if(lcd_putc_8x8(x, y, *str++)) {
 243   4                                      x += 6;
 244   4                                      n++;
 245   4                              }

⌨️ 快捷键说明

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