📄 inital.c
字号:
//*********************************************************************
// inital.c 1828 的初始化程序文件
// by hibernate 2005.9.29
// ShenZhen Challenge Technology Co.,Ltd
//remarks:本文件根据vxis原参考程序中func_shi文件改写
//*********************************************************************
#include "inital_data.h"
#include "vxis1828.h"
#include "IIC_RW.h"
#include "config.h"
#include "osd.h"
#include "status.h"
#include "timer.h"
#include "handlekey.h"
//本文件函数定义
void setInit1828();
void handleFormat(); // 制式的处理函数定义
void set1828reg(unsigned char * array); // 1828 各种寄存器的设置函数
void setScreenMode(unsigned char current_format,unsigned char screen_mode); // 屏幕比例的设置函数
void initFormat(unsigned char format); // 制式的初始化函数定义
//****************************************************
// 函数:void setInit1828()
// 作用:对1828进行初始化,包含有制式等的设置
// remarks:对1828开机时需要有的功能就在这个函数中进行添加
//****************************************************
void setInit1828()
{
//unsigned char open_format;
unsigned char open_ch = 0x01; // 开机默认通道
set1828reg(&init1828_data); // 对1828进行初始化,1828下配置过程;
//DelayXms(0xFF);
DelayXms(0x10);
// 开机通道设置
set1828Ch(open_ch);
setCurrentCh(open_ch) ;
//open_format = getCurrentFormat();
//displayCap(0x01,open_format);
// 开机颜色设置
loadAppInitValue();
setICAppValue();
// Set initial address of OSD block
// The initial address of Title Block is default 0x00
osd_madr(content,0x20); // Set the initial address of Content Block
osd_madr(bottom,0xa0); // Set the initial address of Bottom Block
osdSwitch(0x00); // Turn the OSD T/C/B block off
osd_blink(0x0f); // Set the OSD blinking rate
osd_alpha(0x0d); // Set the OSD transparent
}
//****************************************************
// 函数:void handleFormat()
// 作用:对1828 制式有无变化进行处理
// remarks:1828制式有变化时需要进行制式变化寄存器参数设置
//****************************************************
void handleFormat()
{
unsigned char temp_format;
unsigned char now_format;
unsigned char now_ch;
temp_format = get1828Format();
now_format = getCurrentFormat();
now_ch = getCurrentCh();
if (temp_format != now_format)
{
initFormat(temp_format);
displayCap(now_ch,temp_format); // 变化时可以显示制式
setCurrentFormat(temp_format );
}
}
//****************************************************
// 函数: void iinitFormat(unsigned char current_format)
// 作用: 当制式有变化时,需要更改一些寄存器参数值
// remarks:这个函数只对不同的制式进行初始化
//****************************************************
void initFormat(unsigned char format)
{
DelayXms(0x10);
DelayXms(0x10);
if(format == 0x03)
set1828reg(&init_NTSC_data); // 更改NTSC制的寄存器参数
else
set1828reg(&init_PAL_data); // 更改PAL制的寄存器参数
}
//****************************************************
// 函数: void setScreenMode(unsigned char format,unsigned char screen_mode)
// 作用: 函数根据不同制式的标志位作出屏幕(比例)模式的变化
// 参数: format => 当前的制式
// screen_mode => 16:9 / 4:3 的标志
// remarks:
//****************************************************
void setScreenMode(unsigned char current_format,unsigned char screen_mode)
{
if(current_format == 0x03) // NTSC
{
if(screen_mode == 0x00) // 4:3 to 16:9
set1828reg(&r43to169_N_data); // 寄存器参数设置为16:9(NTSC)
else // 16:9 to4:3
set1828reg(&r169to43_N_data); // 寄存器参数设置为4:3(NTSC)
}
else //PAL
{
if(screen_mode == 0x00) // 4:3 to16:9
set1828reg(&r43to169_P_data); //寄存器参数设置为16:9(PAL)
else //16:9 to4:3 initial data of the aspect ratio from 16:9 to 4:3 in PAL
set1828reg(&r169to43_P_data); //寄存器参数设置为4:3(PAL)
}
}
//***********************************************
//函数:void set1828reg(unsigned char * array)
//作用:1828 各种寄存器的设置函数(从数组到1828)
//remark:1、 函数通过读取 array(数据数组) 向1828写入数据,
// 2、 array数组的格式可见数组定义
//************************************************
void set1828reg(unsigned char * array)
{
unsigned char count;
unsigned char i;
unsigned char tmp;
count = getLength(array);
for(i = 0;i < count;i+= 0x02)
{
tmp = array[i+1]; // 奇数位是数值
write1828(array[i],array[i+1]); // 偶数位是寄存器地址
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -