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

📄 osd_vx1828.lst

📁 Vx1828点3.5"TFT屏的的源程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
 240                  pos              => 8 bits , The block initial address in OSD
 241          Output Factor:
 242                  None
 243          Motion:
 244                  1.Set the position of OSD Block
 245          *********************************************************************/
 246          void osd_madr(char block,char pos)
 247          {
 248   1        switch(block)
 249   1        {
 250   2         case 2:      // Setup position of Content Block
 251   2              shi_sub_write(VX1828,osd15,0x00,&pos);
 252   2              break;
 253   2         case 3:      // Setup position of Bottom Block
 254   2              shi_sub_write(VX1828,osd29,0x00,&pos);
 255   2              break;
 256   2         default:
 257   2              break;
 258   2        }
 259   1      }
 260          
 261          /*********************************************************************
 262             Adding font to OSD memory Function (For VX1828)
 263          
 264          Input Factor:
 265                  stpos1   => 8 bits , Lower 2 bits is available.
 266                                       The two bits is the 8-9bits address of
 267                                       the starting point of the fontcodes.
 268                  stpos2   => 8 bits , The 0-7bits address of the starting point
 269                                       of the fontcodes.
 270                  font     => 8 bits , A pointer of the fonts array to show
 271          Output Factor:
 272                  None
 273          Motion:
 274                  1.Show the fonts to the arbitrary position on screen
 275          *********************************************************************/
 276          /*
 277          void osd_addfont(char stpos1,char stpos2,char *font)
 278          {
 279            char idata temp7[0x02];
 280          
 281            stpos1 = stpos1 & 0x07;               // Get the lower 2 bits of stpos1
 282            stpos1 = stpos1 + 0x20;
 283            temp7[0] = stpos1;
 284            temp7[1] = stpos2;
 285            shi_sub_write(VX1828,cw1,0x01,&temp7[0]);
 286          
 287            shi_sub_write(VX1828,cw3,0x28,font);
 288          } 
 289          */
 290          /*********************************************************************
 291             Set color of OSD's block Function (For VX1828)
 292          
 293          Input Factor:
 294                  block    => 8 bits , Choose which block to set
 295                                       0x01 => Title Block
 296                                       0x02 => Content Block
 297                                       0x03 => Bottom Block
 298                  fb       => 1 bit  , 1 => Foreground color
 299                                       0 => Background color
 300                  h        => 1 bit  , 1 => Highlight section color
 301                                       0 => Normal color
C51 COMPILER V7.50   OSD_VX1828                                                            01/14/2006 15:30:03 PAGE 6   

 302                  color    => 8 bits , The lower 4 bits are available.
 303          Output Factor:
 304                  None
 305          Motion:
 306                  1.Set the color of OSD Block
 307          *********************************************************************/
 308          void osd_color(char block,bit fb,bit h,char color)
 309          {
 310   1        char idata addr;
 311   1        char idata temp8;
 312   1      
 313   1        switch(block)
 314   1        {
 315   2         case 1:      // Setup position of Title Block
 316   2          if (h)      // Highlight
 317   2          {
 318   3               addr = osd12;
 319   3              }
 320   2              else    // Normal
 321   2              {
 322   3               addr = osd11;
 323   3              }
 324   2              break;
 325   2         case 2:      // Setup position of Content Block
 326   2          if (h)      // Highlight
 327   2          {
 328   3               addr = osd27;
 329   3              }
 330   2              else    // Normal
 331   2              {
 332   3               addr = osd26;
 333   3              }
 334   2              break;
 335   2         case 3:      // Setup position of Bottom Block
 336   2          if (h)      // Highlight
 337   2          {
 338   3               addr = osd37;
 339   3              }
 340   2              else    // Normal
 341   2              {
 342   3               addr = osd36;
 343   3              }
 344   2              break;
 345   2         default:
 346   2              break;
 347   2        }
 348   1        shi_sub_read(VX1828,addr,0x00,&temp8);                // Read back the register
 349   1        if (fb)       // Foreground
 350   1        {
 351   2          temp8 = temp8 & 0xf0;               // Remove lower 4 bits of temp8
 352   2          color = color & 0x0f;       // Remove higher 4 bits of color
 353   2          temp8 = temp8 | color;      // set lower 4 bits of color to lower 4 bits of temp8
 354   2        }
 355   1        else          // Background
 356   1        {
 357   2          temp8 = temp8 & 0x0f;               // Remove higher 4 bits of temp8
 358   2          color = color & 0x0f;       // Remove higher 4 bits of color
 359   2          color <<= 4;                // Shift color left 4 bits
 360   2          temp8 = temp8 | color;      // set higher 4 bits of color to higher 4 bits of temp8
 361   2        }
 362   1        shi_sub_write(VX1828,addr,0x00,&temp8);
 363   1      }
C51 COMPILER V7.50   OSD_VX1828                                                            01/14/2006 15:30:03 PAGE 7   

 364          
 365          /*********************************************************************
 366             Set Start and End point of Highlight/Blink Section of OSD Function (For VX1828)
 367          
 368          Input Factor:
 369                  block    => 8 bits , Choose which block to set
 370                                       0x01 => Title Block
 371                                       0x02 => Content Block
 372                                       0x03 => Bottom Block
 373                  hb       => 1 bit  , Switch Highlight/Blink
 374                                       0 => Highlight
 375                                       1 => Blink
 376                  xstart   => 8 bits , The highlight starting of X direction
 377                                       p.s. Lower 6 bits are available
 378                  xend     => 8 bits , The highlight ending of X direction
 379                                       p.s. Lower 6 bits are available
 380                  ystart   => 8 bits , The highlight starting of Y direction
 381                                       p.s. Lower 5 bits are available
 382                  yend     => 8 bits , The highlight ending of Y direction
 383                                       p.s. Lower 5 bits are available
 384          Output Factor:
 385                  None
 386          *********************************************************************/
 387          void osd_hbsection(char block,bit hb,char xstart,char xend,char ystart,char yend)
 388          {
 389   1        xstart = xstart & 0x3f;
 390   1        xend = xend & 0x3f;
 391   1        ystart = ystart & 0x1f;
 392   1        yend = yend & 0x1f;
 393   1        switch(block)
 394   1        {
 395   2         case 1:      // Setup x size of Title Block
 396   2              if (hb) // Blink section
 397   2              {
 398   3               shi_sub_write(VX1828,osd7,0x00,&xstart);       // Start
 399   3               shi_sub_write(VX1828,osd8,0x00,&xend);         // End
 400   3              }
 401   2              else    // Highlight section
 402   2              {
 403   3               shi_sub_write(VX1828,osd5,0x00,&xstart);       // Start
 404   3               shi_sub_write(VX1828,osd6,0x00,&xend);         // End
 405   3              }
 406   2              break;
 407   2         case 2:      // Setup x and y size of Content Block
 408   2              if (hb) // Blink section
 409   2              {
 410   3               shi_sub_write(VX1828,osd24,0x00,&xstart);      // xStart
 411   3               shi_sub_write(VX1828,osd25,0x00,&xend);        // xEnd
 412   3               shi_sub_write(VX1828,osd22,0x00,&ystart);      // yStart
 413   3               shi_sub_write(VX1828,osd23,0x00,&yend);        // yEnd
 414   3              }
 415   2              else    // Highlight section
 416   2              {
 417   3               shi_sub_write(VX1828,osd20,0x00,&xstart);      // xStart
 418   3               shi_sub_write(VX1828,osd21,0x00,&xend);        // xEnd
 419   3               shi_sub_write(VX1828,osd18,0x00,&ystart);      // yStart
 420   3               shi_sub_write(VX1828,osd19,0x00,&yend);        // yEnd
 421   3              }
 422   2              break;
 423   2         case 3:      // Setup x size of Bottom Block
 424   2              if (hb) // Blink section
 425   2              {
C51 COMPILER V7.50   OSD_VX1828                                                            01/14/2006 15:30:03 PAGE 8   

 426   3               shi_sub_write(VX1828,osd34,0x00,&xstart);      // Start
 427   3               shi_sub_write(VX1828,osd35,0x00,&xend);        // End
 428   3              }
 429   2              else    // Highlight section
 430   2              {
 431   3               shi_sub_write(VX1828,osd32,0x00,&xstart);      // Start
 432   3               shi_sub_write(VX1828,osd33,0x00,&xend);        // End
 433   3              }
 434   2              break;
 435   2         default:
 436   2              break;
 437   2        }
 438   1      }
 439          
 440          /*********************************************************************
 441             Set OSD blinking rate Function (For VX1828)
 442          
 443          Input Factor:
 444                  blink    => 8 bits , OSD blinking rate
 445                                       P.S. Lower 6 bits are available
 446          
 447          Output Factor:
 448                  None
 449          *********************************************************************/
 450          void osd_blink(char blink)
 451          {
 452   1        blink = blink & 0x3f;         // Remove redundant bits
 453   1        shi_sub_write(VX1828,osd3,0x00,&blink);
 454   1      }
 455          
 456          /*********************************************************************
 457             Set OSD alpha-blending Function (For VX1828)
 458          
 459          Input Factor:
 460                  alpha    => 8 bits , OSD alpha-blending
 461                                       P.S. Lower 4 bits are available
 462          Output Factor:
 463                  None
 464          *********************************************************************/
 465          void osd_alpha(char alpha)
 466          {
 467   1        char temp9;
 468   1        alpha <<= 4;
 469   1        alpha = alpha & 0xf0;         // Remove redundant bits
 470   1        shi_sub_read(VX1828,osd2,0x00,&temp9);
 471   1        temp9 = temp9 & 0x0f;
 472   1        temp9 = temp9 | alpha;
 473   1        shi_sub_write(VX1828,osd2,0x00,&temp9);
 474   1      }
 475          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1123    ----
   CONSTANT SIZE    =     20    ----
   XDATA SIZE       =   ----      18
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----      28
   BIT SIZE         =   ----       3
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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