LOCAL uint32_t _ov8830_flash(uint32_t param) { SENSOR_PRINT("Start:param=%d", param); SENSOR_PRINT_HIGH("end"); return SENSOR_SUCCESS; }
LOCAL uint32_t OV7675_Identify(uint32_t param) { #define OV7675_PID_VALUE 0x76 #define OV7675_PID_ADDR 0x0A #define OV7675_VER_VALUE 0x73 #define OV7675_VER_ADDR 0x0B uint32_t i; uint32_t nLoop; uint8_t ret; uint32_t err_cnt = 0; uint8_t reg[2] = {0x0A, 0x0B}; uint8_t value[2] = {0x76, 0x73}; for(i = 0; i<2; ) { nLoop = 1000; ret = OV7675_ReadReg(reg[i]); if( ret != value[i]) { err_cnt++; if(err_cnt>3) { SENSOR_PRINT_ERR("Fail to OV7675_Identify: ret: %d, value[%d]: %d", ret, i, value[i]); return SENSOR_FAIL; } else { //Masked by frank.yang,SENSOR_Sleep() will cause a Assert when called in boot precedure //SENSOR_Sleep(10); //while(nLoop--) /* SENSOR_Sleep(10);*/ continue; } } err_cnt = 0; i++; } _ov7675_InitExifInfo(); SENSOR_PRINT_HIGH("SENSOR: OV7675_Identify: it is OV7675"); return 0; }
LOCAL uint32_t GC0309_Identify(uint32_t param) { #define GC0309_PID_VALUE 0xa0 #define GC0309_PID_ADDR 0x00 #define GC0309_VER_VALUE 0xa0 #define GC0309_VER_ADDR 0x00 uint32_t i; uint32_t nLoop; uint8_t ret; uint32_t err_cnt = 0; uint8_t reg[2] = {0x00, 0x00}; uint8_t value[2] = {0xa0, 0xa0}; SENSOR_TRACE("GC0309_Identify"); for(i = 0; i<2; ) { nLoop = 1000; ret = GC0309_ReadReg(reg[i]); if( ret != value[i]) { err_cnt++; if(err_cnt>3) { SENSOR_PRINT_HIGH("It is not GC0309\n"); return SENSOR_FAIL; } else { while(nLoop--); continue; } } err_cnt = 0; i++; } SENSOR_TRACE("GC0309_Identify: it is GC0309\n"); return (uint32_t)SENSOR_SUCCESS; }