Arducam_OV5642_Library

Dependents:   DigitalCamera_OV5642_WIZwiki-W7500 RFID-RC522_buffer Prelude_OV5642_dev

Files at this revision

API Documentation at this revision

Comitter:
justinkim
Date:
Thu Oct 29 23:31:28 2015 +0000
Parent:
2:8cb6d03dccb8
Commit message:
TEST version 0.2 - adding FTP...

Changed in this revision

OV5642.cpp Show annotated file Show diff for this revision Revisions of this file
OV5642.h Show annotated file Show diff for this revision Revisions of this file
diff -r 8cb6d03dccb8 -r ee782b77485e OV5642.cpp
--- a/OV5642.cpp	Thu Oct 29 07:56:55 2015 +0000
+++ b/OV5642.cpp	Thu Oct 29 23:31:28 2015 +0000
@@ -351,17 +351,56 @@
     return 1;
 }
 
- 
-void ArduCAM::OV5642_set_JPEG_size(){
-    
-    wrSensorRegs16_8(ov5642_dvp_fmt_global_init);
-    wait_ms(100);        
-    wrSensorRegs16_8(ov5642_dvp_fmt_jpeg_qvga);
-    wrSensorReg16_8(0x4407, 0x04);
-    wrSensorReg16_8(0x3818, 0xA8); 
-    wrSensorReg16_8(0x3621, 0x10); 
-    wrSensorReg16_8(0x3801, 0x98);
+void ArduCAM::OV5642_set_JPEG_size(uint8_t size)
+{
+    wrSensorRegs16_8(ov5642_dvp_fmt_global_init); 
     wait_ms(100); 
+    switch(size)
+    {
+        case OV5642_320x240:    
+            wrSensorRegs16_8(ov5642_dvp_fmt_jpeg_qvga);
+            wrSensorReg16_8(0x4407,0x04);
+            wrSensorReg16_8(0x3818, 0xA8); 
+            wrSensorReg16_8(0x3621, 0x10); 
+            wrSensorReg16_8(0x3801 , 0xC8); 
+            break;
+        case OV5642_640x480:    
+            wrSensorRegs16_8(ov5642_dvp_fmt_jpeg_vga);
+            wrSensorReg16_8(0x3818, 0xA8); 
+            wrSensorReg16_8(0x3621, 0x10); 
+            wrSensorReg16_8(0x3801 , 0xC8);  
+            break;
+        case OV5642_1280x720:
+            wrSensorRegs16_8(ov5642_dvp_fmt_jpeg_qvga);
+            wrSensorRegs16_8(ov5642_res_720P);
+            wrSensorReg16_8(0x3818, 0xA8); 
+            wrSensorReg16_8(0x3621, 0x10); 
+            wrSensorReg16_8(0x3801 , 0xC8);
+            break;
+        case OV5642_1920x1080:
+            wrSensorRegs16_8(ov5642_dvp_fmt_jpeg_qvga);
+            wrSensorRegs16_8(ov5642_res_1080P);
+            wrSensorReg16_8(0x3818, 0xA8); 
+            wrSensorReg16_8(0x3621, 0x10); 
+            wrSensorReg16_8(0x3801 , 0xC8);
+            break;
+        case OV5642_2048x1563:
+            wrSensorRegs16_8(ov5642_dvp_fmt_jpeg_qxga);
+            wrSensorReg16_8(0x3818, 0xA8); 
+            wrSensorReg16_8(0x3621, 0x10); 
+            wrSensorReg16_8(0x3801 , 0xC8); 
+            break;
+        case OV5642_2592x1944:
+            wrSensorRegs16_8(ov5642_dvp_fmt_jpeg_5M);
+            wrSensorReg16_8(0x4407,0x08); 
+            wrSensorReg16_8(0x3818, 0xA8); 
+            wrSensorReg16_8(0x3621, 0x10); 
+            wrSensorReg16_8(0x3801 , 0xC8);  
+            break;
+        default:
+            wrSensorRegs16_8(ov5642_dvp_fmt_jpeg_qvga);
+            break;
+    }
 }
 
 void ArduCAM::set_format(uint8_t fmt)
diff -r 8cb6d03dccb8 -r ee782b77485e OV5642.h
--- a/OV5642.h	Thu Oct 29 07:56:55 2015 +0000
+++ b/OV5642.h	Thu Oct 29 23:31:28 2015 +0000
@@ -159,7 +159,7 @@
         uint8_t rdSensorReg8_16(uint8_t regID, uint16_t* regDat);
         uint8_t rdSensorReg16_16(uint16_t regID, uint16_t* regDat);
         
-        void OV5642_set_JPEG_size(void);
+        void OV5642_set_JPEG_size(uint8_t size);
         void set_format(uint8_t fmt);
         
         int bus_write(int address, int value);