📄 micron_config.c
字号:
/*****************************************************************************
* Micron_Config.c
*
* Copyright (c) 2007 Analog Devices, Inc. All Rights Reserved.
* This software is proprietary to Analog Devices, Inc. and its
* licensors.
*
* CHANGES: 10/24/2007 1.00 - initial public release
*
* SOFTWARE: VisualDSP++ 5.0 August 2007 Update
*
* HARDWARE: BF561 EZ-Kit Lite Board Rev 1.4
* Micron MTV9022 or MTV9032 Sensor
*
*
* DESCRIPTION:
*
* This file is used by main.c and configures the Micron Image Sensor to
* capture images.
*
* NOTE:
* >> If it is a 9V032 sensor, it issues dummy writes to enable the I2C
* >> Both the 9V032 and the 9V022 use the same configuration writes
*
* This file can configure the sensor to send a test image to the Blackfin.
* This can be done by uncommenting "#define TEST" in micron.h
*
******************************************************************************/
#include <sys/exception.h>
#include <I2C.h>
#include <micron.h>
#include <TWI_primitives.h>
void micron_init(void);
int byte, result = 0;
extern volatile int SCCB_In_Progress;
extern volatile int SCCB_DataOut;
void micron_init(void)
{
#ifdef _9V032
// I2C Enable
unsigned short dummy = 1;
if (!I2C_Reg_Write(false, false, 0xE0, 0x01, &dummy, 1))
if (!I2C_Reg_Write(false, false, 0xE6, 0x01, &dummy, 1))
while(1);
#endif
unsigned short word = 0x001F;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x31, &word, 1))
while(1);
word = 0x001A;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x32, &word, 1))
while(1);
word = 0x0012;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x33, &word, 1))
while(1);
word = 0x0000;
if (!I2C_Reg_Write(false, true, MICRONWR, 0xAF, &word, 1))
while(1);
word = 0x0003;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x2B, &word, 1))
while(1);
word = 0x0040;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x10, &word, 1))
while(1);
word = 0x0000;
if (!I2C_Reg_Write(false, true, MICRONWR, 0xB3, &word, 1))
while(1);
word = 0x0000;
if (!I2C_Reg_Write(false, true, MICRONWR, 0xB1, &word, 1))
while(1);
word = 0x0001;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x0C, &word, 1))
while(1);
word = 0x0000;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x0C, &word, 1))
while(1);
word = 0x0001;
if (!I2C_Reg_Write(false, true, MICRONWR, 0xB5, &word, 1))
while(1);
word = 0x0000;
if (!I2C_Reg_Write(false, true, MICRONWR, 0xB5, &word, 1))
while(1);
word = 0x0020;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x35, &word, 1))
while(1);
word = 0x0020;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x35, &word, 1))
while(1);
word = 0x0020;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x35, &word, 1))
while(1);
word = 0x0020;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x35, &word, 1))
while(1);
#ifdef TEST
// TEST IMAGE
word = 0x3800;
if (!I2C_Reg_Write(false, true, MICRONWR, 0x7F, &word, 1))
while(1);
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -