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