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

📄 pvx521.c

📁 video to VGA 源码
💻 C
字号:
/*===================================
PVX521.c
===================================*/
#include"g2300.h"
#include"twi.h"
#include"pvx521.h"

#define PVX521  0x2e
extern unsigned char fvideo;
extern unsigned char standard;
extern unsigned char resolution;

/*=============================
=============================*/
unsigned char PVX521write(unsigned char chSub,unsigned char chData)
{
  iic_start();
  iic_wait();
  if(iic_state()!=0x08)  {    iic_ee();    return 0;  }
  iic_send(PVX521);
  iic_wait();
  if(iic_state()!=0x18)  {    iic_ee();    return 0;  }
  iic_send(chSub);
  iic_wait();
  if(iic_state()!=0x28)  {    iic_ee();    return 0;  }
  iic_send(chData);
  iic_wait();
  if(iic_state()!=0x28)  {    iic_ee();    return 0;  }
  iic_stop();
  return 1;
}
/*=============================
=============================*/
unsigned char PVX521read(unsigned char chSub)
{
  unsigned char tmp;
  iic_start();
  iic_wait();
  if(iic_state()!=0x08)  {    iic_ee();    return 0;  }
  iic_send(PVX521);
  iic_wait();
  if(iic_state()!=0x18)  {    iic_ee();    return 0;  }
  iic_send(chSub);
  iic_wait();
  if(iic_state()!=0x28)  {    iic_ee();    return 0;  }
  iic_start();   //restart
  iic_wait();
  if(iic_state()!=0x10)  {    iic_ee();    return 0;  }
  iic_send(PVX521|0x01);
  iic_wait();
  if(iic_state()!=0x40)  {    iic_ee();    return 0;  }
  iic_noack();
  iic_wait();
  tmp=iic_receive();
  iic_stop();
  return tmp;
}
/*=============================
=============================*/
void SetPvx521(void)
{
  unsigned char j;
  unsigned char blue_overlay[6][2]=
  {0xdc,0x01,0xdd,0xfc,0xdf,0x02,0xe0,0xbc,0xe1,0x9d,0xe2,0x03};

  if(fvideo)
  {
    for(j=0;j<227;j++)
      PVX521write(pvx521[standard][j][0],pvx521[standard][j][1]);
  }
  else
  {
    for(j=0;j<6;j++)
      PVX521write(blue_overlay[j][0],blue_overlay[j][1]);
  }
  WDR();
}


/*===================================
END
===================================*/

⌨️ 快捷键说明

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