David Fletcher / Mbed 2 deprecated cc3100_Test_websock_Camera_CM4F

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ov2640.cpp Source File

ov2640.cpp

00001 
00002 #include "mbed.h"
00003 #include "i2cconfig.h"
00004 #include "ov2640_regs.h"
00005 #include "ov2640.h"
00006 #include "ov5642.h"
00007 #include "camera_app.h"
00008 #include "app_config.h"
00009 
00010 
00011 extern DCMI_HandleTypeDef phdcmi;
00012  
00013 void camId(){
00014     uint8_t vid, pid;
00015     
00016     rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid);
00017     rdSensorReg8_8(OV2640_CHIPID_LOW, &pid);
00018     if((vid != 0x26) || (pid != 0x42)){
00019         printf("Can't find OV2640 module! vid 0x%x pid 0x%x\r\n",vid, pid);      
00020         HAL_DCMI_MspDeInit (&phdcmi);
00021         while(1);
00022     }else{
00023       printf("OV2640 detected\r\n");
00024     }
00025 }
00026 void initCam(){
00027 #if defined OV2640_CAM
00028             wrSensorReg8_8(0xff, 0x01);
00029             wrSensorReg8_8(0x12, 0x80);
00030             wait_ms(100);
00031 #ifdef ENABLE_JPEG             
00032             wrSensorRegs8_8(OV2640_JPEG_INIT);
00033             wrSensorRegs8_8(OV2640_YUV422);
00034             wrSensorRegs8_8(OV2640_JPEG);
00035             wrSensorReg8_8(0xff, 0x01);
00036             wrSensorReg8_8(0x15, 0x00);
00037             wrSensorRegs8_8(OV2640_320x240_JPEG);               
00038 #else                        
00039             wrSensorRegs8_8(OV2640_QVGA);
00040             
00041 #endif//ENABLE_JPEG 
00042 #endif//OV2640_CAM                  
00043 }
00044 
00045 
00046 
00047