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
Diff: Hardwares/ArduCAM.cpp
- Revision:
- 54:f1f5648dfacf
- Parent:
- 50:c387c88141fb
- Child:
- 56:7d3395ae022d
--- a/Hardwares/ArduCAM.cpp Thu Apr 06 19:42:40 2017 +0000 +++ b/Hardwares/ArduCAM.cpp Thu Apr 06 20:36:51 2017 +0000 @@ -26,7 +26,6 @@ static uint8_t temp_mid_pos = RESOLUTION_WIDTH / 2; static uint8_t black_calibrate = 70; static volatile uint8_t centerLine[CAM_ROI_UPPER_LIMIT]; -//volatile const uint8_t* outCenterLine = centerLine; static Thread * m_imgProcessThread = NULL; void image_processing(); @@ -92,13 +91,13 @@ #if defined(ARDUCAM_OV2640) camReg->SCCBWrite(0xff, 0x01); #endif - uint8_t camVer = camReg->SCCBRead(CAM_PID_ADDR); - sprintf(buf, "Cam VerH %#x", camVer); - g_core.GetUSBServer().PushReliableMsg('D', buf); + //uint8_t camVer = camReg->SCCBRead(CAM_PID_ADDR); + //sprintf(buf, "Cam VerH %#x", camVer); + //g_core.GetUSBServer().PushReliableMsg('D', buf); - camVer = camReg->SCCBRead(CAM_VER_ADDR); - sprintf(buf, "Cam VerL %#x", camVer); - g_core.GetUSBServer().PushReliableMsg('D', buf); + //camVer = camReg->SCCBRead(CAM_VER_ADDR); + //sprintf(buf, "Cam VerL %#x", camVer); + //g_core.GetUSBServer().PushReliableMsg('D', buf); delete camReg; @@ -111,17 +110,17 @@ VerNum = ardu_cam_spi_read_8(0x40); - sprintf(buf, "Ardu Ver %#x", VerNum); - g_core.GetUSBServer().PushReliableMsg('D', buf); + //sprintf(buf, "Ardu Ver %#x", VerNum); + //g_core.GetUSBServer().PushReliableMsg('D', buf); ardu_cam_spi_write_8(ARDUCHIP_TEST1, ARDUCHIP_TEST_MSG); uint8_t testV = ardu_cam_spi_read_8(ARDUCHIP_TEST1); if(VerNum != ARDUCHIP_VER_NUM || testV != ARDUCHIP_TEST_MSG) { - g_core.GetUSBServer().PushReliableMsg('D', "CameraInit Fa"); + //g_core.GetUSBServer().PushReliableMsg('D', "CameraInit Fa"); return false; } - g_core.GetUSBServer().PushReliableMsg('D', "CameraInit Su"); + //g_core.GetUSBServer().PushReliableMsg('D', "CameraInit Su"); //ardu_cam_set_mode(MCU2LCD_MODE); ardu_cam_spi_write_8(ARDUCHIP_CAP_CTRL, 0x00); @@ -181,9 +180,9 @@ void ardu_cam_print_debug() { uint32_t len = ardu_cam_get_fifo_length(); - char buf[20]; - sprintf(buf, "Cam L %#x", len); - g_core.GetUSBServer().PushReliableMsg('D', buf); + //char buf[20]; + //sprintf(buf, "Cam L %#x", len); + //g_core.GetUSBServer().PushReliableMsg('D', buf); //if(len < (RESOLUTION_HEIGHT * RESOLUTION_WIDTH * 2)) // return; @@ -238,7 +237,7 @@ lineBuf[j + 1] = ardu_cam_get_pixel(); } - g_core.GetUSBServer().PushReliableMsg('P', lineBuf); + //g_core.GetUSBServer().PushReliableMsg('P', lineBuf); wait(0.35); #endif