📄 1574osd.lst
字号:
425 1 Write_OSDReg(buf, SEL_OSDCTRLREG, 1, OSDCTRLREG);
426 1 }
C51 COMPILER V7.01 1574OSD 07/14/2005 15:18:38 PAGE 8
427
428
429 /**--------------------------------------------------------------------------
430 * Name OSD_Attribute(BYTE item, BYTE length, BYTE attr_color)
431 *
432 * Description Write OSD Attribute Reg.
433 *
434 * Flow Chart
435 *
436 * Return
437 *
438 * DATE Author Description
439 * ===========================================================================
440 * 2004-07-12 K.M. Ho This is first time implement
441 **/
442 void OSD_Attribute(BYTE addr, BYTE length, BYTE attr_color)
443 {
444 1 BYTE buf[13], i;
445 1
446 1 for (i=0; i<length; i++) //make Attribute buffer
447 1 buf[i] = attr_color;
448 1
449 1 //Write OSD attribute buffer
450 1 Write_OSDReg(buf, SEL_OSDDISPATTR, length, addr);
451 1 }
452
453 /**--------------------------------------------------------------------------
454 * Name Read_OSDReg(BYTE *buf, BYTE rd_type
455 * BYTE ch_count, BYTE begin_addr)
456 *
457 * Description Read data from 15xx OSD
458 *
459 * Flow Chart
460 *
461 * Return *str reading data buffer
462 *
463 * DATE Author Description
464 * ===========================================================================
465 * 2004-07-12 K.M. Ho This is first time implement
466 * 2004-10-12 KMHo Del the OSD enable
467 **/
468 void Read_OSDReg(BYTE *buf, BYTE rd_type, BYTE ch_count, BYTE addr)
469 {
470 1 BYTE i;
471 1
472 1 // I2C_WriteByte(L44_WRID, OSD_EN, 0xAC); //Del by KMHo 2004-10-12
473 1 I2C_WriteByte(L44_WRID, ORWCTRL, rd_type|0xA0);
474 1 I2C_WriteByte(L44_WRID, OSDADDR_L, addr);
475 1 I2C_WriteByte(L44_WRID, OSDADDR_H, 0x00);
476 1
477 1 for(i=0; i<ch_count; i++)
478 1 *(buf+i) = I2C_ReadByte(L44_WRID, OSDDATA_L);
479 1
480 1 I2C_WriteByte(L44_WRID, ORWCTRL, 0x04); //Disable OSD Reg. Read/Write
481 1 }
482
483 /**--------------------------------------------------------------------------
484 * Name Write_OSDReg(BYTE *buf, BYTE wr_type
485 * , BYTE ch_count, BYTE begin_addr)
486 *
487 * Description Write data buffer to 15xx OSD Reg
488 *
C51 COMPILER V7.01 1574OSD 07/14/2005 15:18:38 PAGE 9
489 * Flow Chart
490 *
491 * Return None
492 *
493 * DATE Author Description
494 * ===========================================================================
495 * 2004-07-12 K.M. Ho This is first time implement
496 * 2004-10-12 KMHo Del the OSD enable
497 **/
498 void Write_OSDReg(BYTE buf[], BYTE wr_type, BYTE count, BYTE addr)
499 {
500 1 BYTE i,j;
501 1 BYTE wr_byte;
502 1 int offset;
503 1
504 1 // I2C_WriteByte(L44_WRID, OSD_EN, 0xAC); //Del by KMHo 2004-10-12
505 1 I2C_WriteByte(L44_WRID, ORWCTRL, wr_type|0x80);
506 1 I2C_WriteByte(L44_WRID, OSDADDR_L, addr);
507 1 I2C_WriteByte(L44_WRID, OSDADDR_H, 0x00);
508 1
509 1 switch(wr_type)
510 1 {
511 2 case 0x01: //0x01 OSD Font table RAM
512 2 for (i=0; i<count; i++) //character count
513 2 {
514 3 offset = (int)(i*36);
515 3 for (j=0; j<18; j++) //Write a character to 15xx Font Table RAM
516 3 {
517 4 I2C_WriteByte(L44_WRID, OSDDATA_L, buf[offset]);
518 4 I2C_WriteByte(L44_WRID, OSDDATA_H, buf[offset+1]);
519 4 offset += 2;
520 4 }
521 3 }
522 2 break;
523 2 case 0x02: //0x02 OSD Display code buffer
524 2 if (count == 1)
525 2 I2C_WriteByte(L44_WRID, OSDDATA_L, buf[0]);
526 2 else
527 2 for (i=0; i<count; i++) //Write number of byte to select
528 2 { //Convert ASCII code to 15xx ROM Font code
529 3 wr_byte = ASCII_OSDFont(buf[i]);
530 3 I2C_WriteByte(L44_WRID, OSDDATA_L, wr_byte);
531 3 }
532 2 break;
533 2 case 0x00: //0x00 OSD Control Reg.
534 2 case 0x03: //0x03 OSD Display attribute buffer
535 2 for (i=0; i<count; i++) //Write data to OSD Control Reg or Attribute
536 2 I2C_WriteByte(L44_WRID, OSDDATA_L, buf[i]);
537 2 break;
538 2 }
539 1 I2C_WriteByte(L44_WRID, ORWCTRL, 0x04); //Disable OSD Reg. Read/Write
540 1 }
541
542 /**--------------------------------------------------------------------------
543 * Name BYTE ASCII_OSDFont(BYTE ascii_code)
544 *
545 * Description convert the ASCII code to the 15xx ROM font code
546 * There are 64 char. font in 15xx ROM font
547 * 0 1 2 3 4 5 6 7 8 9 A B C D E F
548 * G H I J K L M N O P Q R S T U V
549 * W X Y Z a b c d e f g h i j k l
550 * m n o p q r s t u v w x y z /
C51 COMPILER V7.01 1574OSD 07/14/2005 15:18:38 PAGE 10
551 * Flow Chart
552 *
553 * Return osd font code
554 *
555 * DATE Author Description
556 * ===========================================================================
557 * 2004-07-10 K.M. Ho This is first time implement
558 */
559 BYTE ASCII_OSDFont(BYTE ascii_code)
560 {
561 1 BYTE osd_font_code;
562 1
563 1 osd_font_code = 0x3E; //default convert to space Font index
564 1
565 1 if (ascii_code>=0x20 && ascii_code<=0x2F) osd_font_code = (ascii_code-0x20)|0x40;
566 1
567 1 if (ascii_code>=0x30 && ascii_code<=0x39) osd_font_code = ascii_code-0x30;
568 1 if (ascii_code>=0x41 && ascii_code<=0x5A) osd_font_code = ascii_code-0x41+10;
569 1 if (ascii_code>=0x61 && ascii_code<=0x7A) osd_font_code = ascii_code-0x61+36;
570 1
571 1 return (osd_font_code);
572 1 }
573
574 /**--------------------------------------------------------------------------
575 * Name void Value_ASCII(BYTE value, BYTE *val_str, BYTE signed_bit)
576 *
577 * Description convert the pass-in value to ASCII code
578 *
579 * Flow Chart
580 *
581 * Return value string buffer
582 *
583 * DATE Author Description
584 * ===========================================================================
585 * 2004-07-21 K.M. Ho This is first time implement
586 */
587 void Value_ASCII(BYTE value, BYTE *val_str, BYTE item)
588 {
589 1 BYTE i, tmp_div, tmp_val;
590 1
591 1 *val_str = 0x20;
592 1 if (item==0x04 || item==0x05)
593 1 {
594 2 if (value & 0x20) value = value - 0x20; //value is plus
595 2 else { value = 0x20 - value; //value is minus
596 3 *val_str = 0x2D;
597 3 }
598 2 }
599 1
600 1 tmp_div = 10;
601 1
602 1 for (i=0; i<2; i++)
603 1 {
604 2 tmp_val = value / tmp_div;
605 2 value = value % tmp_div; //get the new value
606 2
607 2 *(val_str+i+1) = tmp_val|0x30; //save the ASCII code to string buffer
608 2
609 2 tmp_div = tmp_div / 10; //get the divide 10 or 1
610 2 }
611 1 }
612
C51 COMPILER V7.01 1574OSD 07/14/2005 15:18:38 PAGE 11
613 /**--------------------------------------------------------------------------
614 * Name void Adj_LRUD(BYTE value)
615 *
616 * Description
617 *
618 * Flow Chart
619 *
620 * Return
621 *
622 * DATE Author Description
623 * ===========================================================================
624 * 2004-11-23 K.M. Ho This is first time implement
625 */
626 void Adj_LRUD(BYTE set_val)
627 {
628 1 BYTE rd_val;
629 1
630 1 rd_val = I2C_ReadByte(L44_WRID, 0x30);
631 1 set_val = (set_val<<6) | (rd_val&0x3F);
632 1
633 1 I2C_WriteByte(L44_WRID, 0x30, set_val);
634 1 }
635
636 /**--------------------------------------------------------------------------
637 * Name void Adj_Brightness(BYTE value)
638 *
639 * Description
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -