SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.

Dependencies:   TSI USBDevice mbed-dev

Fork of SmartWheels by haofan Zheng

Revision:
32:5badeff825dc
Parent:
30:ff7f83ad6369
Child:
33:e3fcc4d6bb9b
diff -r f29f71336710 -r 5badeff825dc Hardwares/OV2640RegProg.h
--- a/Hardwares/OV2640RegProg.h	Thu Mar 02 04:26:33 2017 +0000
+++ b/Hardwares/OV2640RegProg.h	Thu Mar 02 23:56:42 2017 +0000
@@ -10,44 +10,254 @@
 #define OV2640_PID_VALUE        0x26
 #define OV2640_VER_VALUE        0x42
 
-#define PROGMEM  //May need to remove this later.
+#define OV2640_PID_ADDR      0x0A
+#define OV2640_VER_ADDR      0x0B
 
 namespace OV2640Prog
 {
+const struct sensor_reg SVGA[]  =
+{
+        {0xff, 0x00},
+    {0x2c, 0xff},
+    {0x2e, 0xdf},
+    {0xff, 0x01},
+    {0x3c, 0x32},
+//
+    {0x11, 0x00},
+    {0x09, 0x02},
+    {0x04, 0x28},
+    {0x13, 0xe5},
+    {0x14, 0x48},
+
+    {0x2c, 0x0c},
+    {0x33, 0x78},
+    {0x3a, 0x33},
+    {0x3b, 0xfB},
+//
+    {0x3e, 0x00},
+    {0x43, 0x11},
+    {0x16, 0x10},
+//
+    {0x39, 0x92},
+//
+    {0x35, 0xda},
+    {0x22, 0x1a},
+    {0x37, 0xc3},
+    {0x23, 0x00},
+    {0x34, 0xc0},
+    {0x36, 0x1a},
+    {0x06, 0x88},
+    {0x07, 0xc0},
+    {0x0d, 0x87},
+    {0x0e, 0x41},
+    {0x4c, 0x00},
+    {0x48, 0x00},
+    {0x5B, 0x00},
+    {0x42, 0x03},
+//
+    {0x4a, 0x81},
+    {0x21, 0x99},
+//
+    {0x24, 0x40},
+    {0x25, 0x38},
+    {0x26, 0x82},
+    {0x5c, 0x00},
+    {0x63, 0x00},
+    {0x46, 0x22},
+    {0x0c, 0x3c},
+//
+    {0x61, 0x70},
+    {0x62, 0x80},
+    {0x7c, 0x05},
+//
+    {0x20, 0x80},
+    {0x28, 0x30},
+    {0x6c, 0x00},
+    {0x6d, 0x80},
+    {0x6e, 0x00},
+    {0x70, 0x02},
+    {0x71, 0x94},
+
+    {0x73, 0xc1},
+//
+    {0x12, 0x40},
+    {0x17, 0x11},
+    {0x18, 0x43},
+    {0x19, 0x00},
+    {0x1a, 0x4b},
+    {0x32, 0x09},
+    {0x37, 0xc0},
+    {0x4f, 0xca},
+    {0x50, 0xa8},
+    {0x5a, 0x23},
+    {0x6d, 0x00},
+    {0x3d, 0x38},
+//
+    {0xff, 0x00},
+    {0xe5, 0x7f},
+    {0xf9, 0xc0},
+    {0x41, 0x24},
+    {0xe0, 0x14},
+    {0x76, 0xff},
+    {0x33, 0xa0},
+    {0x42, 0x20},
+    {0x43, 0x18},
+    {0x4c, 0x00},
+    {0x87, 0xd5},
+    {0x88, 0x3f},
+    {0xd7, 0x03},
+    {0xd9, 0x10},
+    {0xd3, 0x82},
+//
+    {0xc8, 0x08},
+    {0xc9, 0x80},
+//
+    {0x7c, 0x00},
+    {0x7d, 0x00},
+    {0x7c, 0x03},
+    {0x7d, 0x48},
+    {0x7d, 0x48},
+    {0x7c, 0x08},
+    {0x7d, 0x20},
+    {0x7d, 0x10},
+    {0x7d, 0x0e},
+//
+    {0x90, 0x00},
+    {0x91, 0x0e},
+    {0x91, 0x1a},
+    {0x91, 0x31},
+
+    {0x91, 0x5a},
+    {0x91, 0x69},
+    {0x91, 0x75},
+    {0x91, 0x7e},
+    {0x91, 0x88},
+    {0x91, 0x8f},
+    {0x91, 0x96},
+    {0x91, 0xa3},
+    {0x91, 0xaf},
+    {0x91, 0xc4},
+    {0x91, 0xd7},
+    {0x91, 0xe8},
+    {0x91, 0x20},
+//
+    {0x92, 0x00},
+    {0x93, 0x06},
+    {0x93, 0xe3},
+    {0x93, 0x05},
+    {0x93, 0x05},
+    {0x93, 0x00},
+    {0x93, 0x04},
+    {0x93, 0x00},
+    {0x93, 0x00},
+    {0x93, 0x00},
+    {0x93, 0x00},
+    {0x93, 0x00},
+    {0x93, 0x00},
+    {0x93, 0x00},
+//
+    {0x96, 0x00},
+    {0x97, 0x08},
+    {0x97, 0x19},
+    {0x97, 0x02},
+    {0x97, 0x0c},
+    {0x97, 0x24},
+    {0x97, 0x30},
+    {0x97, 0x28},
+    {0x97, 0x26},
+    {0x97, 0x02},
+    {0x97, 0x98},
+    {0x97, 0x80},
+    {0x97, 0x00},
+    {0x97, 0x00},
+//
+    {0xc3, 0xed},
+    {0xa4, 0x00},
+    {0xa8, 0x00},
+    {0xc5, 0x11},
+
+    {0xc6, 0x51},
+    {0xbf, 0x80},
+    {0xc7, 0x10},
+    {0xb6, 0x66},
+    {0xb8, 0xA5},
+    {0xb7, 0x64},
+    {0xb9, 0x7C},
+    {0xb3, 0xaf},
+    {0xb4, 0x97},
+    {0xb5, 0xFF},
+    {0xb0, 0xC5},
+    {0xb1, 0x94},
+    {0xb2, 0x0f},
+    {0xc4, 0x5c},
+//
+    {0xc0, 0x64},
+    {0xc1, 0x4B},
+    {0x8c, 0x00},
+    {0x86, 0x3D},
+    {0x50, 0x00},
+    {0x51, 0xC8},
+    {0x52, 0x96},
+    {0x53, 0x00},
+    {0x54, 0x00},
+    {0x55, 0x00},
+    {0x5a, 0xC8},
+    {0x5b, 0x96},
+    {0x5c, 0x00},
+    {0xd3, 0x82},
+//
+    {0xc3, 0xed},
+    {0x7f, 0x00},
+//
+    {0xda, 0x08},
+//
+    {0xe5, 0x1f},
+    {0xe1, 0x67},
+    {0xe0, 0x00},
+    {0xdd, 0x7f},
+    {0x05, 0x00},
     
-const struct sensor_reg QVGA[] PROGMEM =
+    {0xff, 0xff}
+};
+
+const struct sensor_reg QVGA[]  =
 {
     {0xff, 0x0}, 
     {0x2c, 0xff}, 
     {0x2e, 0xdf}, 
     {0xff, 0x1}, 
-    {0x3c, 0x32}, 
+    {0x3c, 0x32},
+     
     {0x11, 0x0}, 
     {0x9, 0x2}, 
-    {0x4, 0xa8}, 
+    {0x4, 0xa8}, /////////// 
     {0x13, 0xe5}, 
     {0x14, 0x48}, 
     {0x2c, 0xc}, 
     {0x33, 0x78}, 
     {0x3a, 0x33}, 
     {0x3b, 0xfb}, 
+    
     {0x3e, 0x0}, 
     {0x43, 0x11}, 
     {0x16, 0x10}, 
-    {0x39, 0x2}, 
-    {0x35, 0x88}, 
-
-    {0x22, 0xa}, 
-    {0x37, 0x40}, 
+    
+    {0x39, 0x2}, ///////////
+    
+    {0x35, 0x88}, ///////////////
+    {0x22, 0xa}, /////////////
+    {0x37, 0x40}, ///////////
     {0x23, 0x0}, 
-    {0x34, 0xa0}, 
-    {0x6, 0x2}, 
+    {0x34, 0xa0},/////////////////// 
+    {0x6, 0x2}, //++++++++++++++
     {0x6, 0x88}, 
     {0x7, 0xc0}, 
-    {0xd, 0xb7}, 
-    {0xe, 0x1}, 
+    {0xd, 0xb7}, ////////
+    {0xe, 0x1}, /////////
     {0x4c, 0x0}, 
-    {0x4a, 0x81}, 
+    
+    {0x4a, 0x81}, //++++++++++++++
+    
     {0x21, 0x99}, 
     {0x24, 0x40}, 
     {0x25, 0x38}, 
@@ -55,14 +265,18 @@
     {0x5c, 0x0}, 
     {0x63, 0x0}, 
     {0x46, 0x22}, 
-    {0xc, 0x3a}, 
-    {0x5d, 0x55}, 
-    {0x5e, 0x7d}, 
-    {0x5f, 0x7d}, 
-    {0x60, 0x55}, 
+    {0xc, 0x3a}, ///////////
+    
+    
+    {0x5d, 0x55},////// 
+    {0x5e, 0x7d}, //////////
+    {0x5f, 0x7d}, //////////
+    {0x60, 0x55}, ///////
+    
     {0x61, 0x70}, 
     {0x62, 0x80}, 
     {0x7c, 0x5}, 
+    
     {0x20, 0x80}, 
     {0x28, 0x30}, 
     {0x6c, 0x0}, 
@@ -71,11 +285,16 @@
     {0x70, 0x2}, 
     {0x71, 0x94}, 
     {0x73, 0xc1}, 
+    
     {0x3d, 0x34}, 
-    {0x12, 0x4}, 
+    
+    {0x12, 0x4}, //////////// 
     {0x5a, 0x57}, 
+    
     {0x4f, 0xbb}, 
     {0x50, 0x9c}, 
+   
+   
     {0xff, 0x0}, 
     {0xe5, 0x7f}, 
     {0xf9, 0xc0}, 
@@ -86,13 +305,15 @@
     {0x42, 0x20}, 
     {0x43, 0x18}, 
     {0x4c, 0x0}, 
-    {0x87, 0xd0}, 
+    {0x87, 0xd0}, ///////
     {0x88, 0x3f}, 
     {0xd7, 0x3}, 
     {0xd9, 0x10}, 
     {0xd3, 0x82}, 
+    
     {0xc8, 0x8}, 
     {0xc9, 0x80}, 
+    
     {0x7c, 0x0}, 
     {0x7d, 0x0}, 
     {0x7c, 0x3}, 
@@ -119,14 +340,14 @@
     {0x91, 0xd7}, 
     {0x91, 0xe8}, 
     {0x91, 0x20}, 
+    
     {0x92, 0x0}, 
-
     {0x93, 0x6}, 
     {0x93, 0xe3}, 
-    {0x93, 0x3}, 
-    {0x93, 0x3}, 
+    {0x93, 0x3}, ////////
+    {0x93, 0x3}, /////////
     {0x93, 0x0}, 
-    {0x93, 0x2}, 
+    {0x93, 0x2}, ///////
     {0x93, 0x0}, 
     {0x93, 0x0}, 
     {0x93, 0x0}, 
@@ -134,6 +355,7 @@
     {0x93, 0x0}, 
     {0x93, 0x0}, 
     {0x93, 0x0}, 
+    
     {0x96, 0x0}, 
     {0x97, 0x8}, 
     {0x97, 0x19}, 
@@ -148,6 +370,8 @@
     {0x97, 0x80}, 
     {0x97, 0x0}, 
     {0x97, 0x0}, 
+    
+    //////
     {0xa4, 0x0}, 
     {0xa8, 0x0}, 
     {0xc5, 0x11}, 
@@ -165,6 +389,7 @@
     {0xb1, 0x94}, 
     {0xb2, 0xf}, 
     {0xc4, 0x5c}, 
+    
     {0xa6, 0x0}, 
     {0xa7, 0x20}, 
     {0xa7, 0xd8}, 
@@ -222,7 +447,7 @@
     {0xff,0xff},
 };        
 
-const struct sensor_reg JPEG_INIT[] PROGMEM =
+const struct sensor_reg JPEG_INIT[]  =
 {
   { 0xff, 0x00 },
   { 0x2c, 0xff },
@@ -418,7 +643,7 @@
   { 0xff, 0xff },
 };             
 
-const struct sensor_reg YUV422[] PROGMEM =
+const struct sensor_reg YUV422[]  =
 {
   { 0xFF, 0x00 },
   { 0x05, 0x00 },
@@ -432,7 +657,7 @@
   { 0xff, 0xff },
 };
 
-const struct sensor_reg JPEG[] PROGMEM =  
+const struct sensor_reg JPEG[]  =  
 {
   { 0xe0, 0x14 },
   { 0xe1, 0x77 },
@@ -446,7 +671,7 @@
 }; 
 
 /* JPG 160x120 */
-const struct sensor_reg 160x120_JPEG[] PROGMEM =  
+const struct sensor_reg P160x120_JPEG[] = 
 {
   { 0xff, 0x01 },
   { 0x12, 0x40 },
@@ -493,7 +718,7 @@
 
 /* JPG 320x240 */
 
-const struct sensor_reg 320x240_JPEG[] PROGMEM =  
+const struct sensor_reg P320x240_JPEG[]  =  
 {
   { 0xff, 0x01 },
   { 0x12, 0x40 },