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:
36:7e747e19f660
Parent:
35:ac4fcca21560
Child:
37:7074a6118d03
--- a/Hardwares/ArduCAM.cpp	Mon Mar 13 02:43:53 2017 +0000
+++ b/Hardwares/ArduCAM.cpp	Tue Mar 14 22:23:15 2017 +0000
@@ -1,13 +1,10 @@
 #include "ArduCAM.h"
 
-#define RESOLUTION_WIDTH 160
-#define RESOLUTION_HEIGHT 120
 
 #include "GlobalVariable.h"
 #include "SWUSBServer.h"
 
 #include "CamRegBuf.h"
-#include "OV2640RegProg.h"
 
 #include <string>
 
@@ -68,34 +65,25 @@
 {
     char buf[20];
     
-    
-    CamRegBuf * camReg = new CamRegBuf(g_core, OV2640_WRITE, OV2640_READ);
-    /*
-    camReg->SCCBWrite(0xff, 0x00);
-    uint8_t camVer = camReg->SCCBRead(0xDA);
-    sprintf(buf, "Cam MOD %#x", camVer);
-    g_core.GetUSBServer().PushReliableMsg('D', buf);
-    */
-    camReg->SCCBWrite(0xff, 0x01);
-    camReg->SCCBWrite(0x12, 0x80);
+    CamRegBuf * camReg = new CamRegBuf(g_core, CAM_SCCB_WRITE, CAM_SCCB_READ);
+
+    camReg->WriteRegSet(ResetProg);
     wait_ms(5);
     camReg->WriteRegSet(OV2640Prog::QVGA);
     wait_ms(100);
     
+#if defined(ARDUCAM_OV2640)
     camReg->SCCBWrite(0xff, 0x01);
-    uint8_t camVer = camReg->SCCBRead(OV2640_PID_ADDR);
+#endif
+    uint8_t camVer = camReg->SCCBRead(CAM_PID_ADDR);
     sprintf(buf, "Cam VerH %#x", camVer);
     g_core.GetUSBServer().PushReliableMsg('D', buf);
     
-    camVer = camReg->SCCBRead(OV2640_VER_ADDR);
+    camVer = camReg->SCCBRead(CAM_VER_ADDR);
     sprintf(buf, "Cam VerL %#x", camVer);
     g_core.GetUSBServer().PushReliableMsg('D', buf);
-    /*
-    camReg->SCCBWrite(0xff, 0x00);
-    camVer = camReg->SCCBRead(0xDA);
-    sprintf(buf, "Cam MOD %#x", camVer);
-    g_core.GetUSBServer().PushReliableMsg('D', buf);
-    */
+
+
     delete camReg;
     camReg = NULL;