📄 i2c.c
字号:
#include <csl_i2c.h>
I2C_Config Config_I2C = {
0, /* 7 bit address mode */
0x0000, /* own address - don't care if master */
144, /* clkout value (Mhz) */
400, /* transfer rate 400kbps*/
0, /* 8bit/Byte */
0, /* DLB mode off */
1 /* FREE mode of on */
};
/*Initialize array for OV7620*/
Uint16 common_control_a[2] = {0x12,0x24}; /*enable AGC, select YCrCb as video data output,enable auto white balance,use standard black level compensation to do A/D BLC field method*/
Uint16 common_control_b[2] = {0x13,0x11}; /*16bit format,CCIR656 format, enable auto adjust mode*/
Uint16 common_control_h[2] = {0x28,0x20}; /*select progressive mode*/
void initI2C(void)
{
I2C_config(&Config_I2C);
/*Configure the registers of OV7620*/
I2C_write(common_control_a,2,1,0x42,1,30000); /*configure common_control_a register, data length is 2, master mode, slaveaddress is 0x1A, tansfermode is S-A-D-P, timeout value is 30000*/
I2C_write(common_control_b,2,1,0x42,1,30000);
I2C_write(common_control_h,2,1,0x42,1,30000);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -