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
Hardwares/ArduCAM.h
- Committer:
- hazheng
- Date:
- 2017-04-10
- Revision:
- 64:43ab429a37e0
- Parent:
- 57:0d8a155d511d
- Child:
- 65:295c222fdf88
File content as of revision 64:43ab429a37e0:
#pragma once #ifndef ARDU_CAM_H #define ARDU_CAM_H #include <mbed.h> #include <rtos.h> #include "PinAssignment.h" #define RESOLUTION_WIDTH 160 #define RESOLUTION_HEIGHT 120 //#define MANUAL_REDUCE_RESULOTION_BY2 #define CAM_ROI_UPPER_LIMIT 8 //=====Must pick one and only one here!===== //#define ARDUCAM_SHIELD_OV2640 //#define ARDUCAM_SHIELD_OV7725 //#define ARDUCAM_SHIELD_OV7670 #define ARDUCAM_MINI_OV2640 //========================================== #if defined(ARDUCAM_SHIELD_OV2640) || defined(ARDUCAM_SHIELD_OV7725) || defined(ARDUCAM_SHIELD_OV7670) #define ARDUCAM_SHIELD #elif defined(ARDUCAM_MINI_OV2640) #define ARDUCAM_MINI #else #error Must pick one and only one ArduCam type! #endif #if defined(ARDUCAM_SHIELD_OV2640) || defined(ARDUCAM_MINI_OV2640) #define ARDUCAM_OV2640 #elif defined(ARDUCAM_SHIELD_OV7725) #define ARDUCAM_OV7725 #elif defined(ARDUCAM_SHIELD_OV7670) #define ARDUCAM_OV7670 #else #error Must pick one and only one ArduCam type! #endif #if defined(ARDUCAM_OV2640) #include "OV2640RegProg.h" //using namespace OV2640Prog; #elif defined(ARDUCAM_OV7725) #include "OV7725RegProg.h" //using namespace OV7725Prog; #elif defined(ARDUCAM_OV7670) #include "OV7670RegProg.h" //using namespace OV7670Prog; #endif #if defined(ARDUCAM_SHIELD) #define ARDUCHIP_VER_NUM 0x61 #elif defined(ARDUCAM_MINI) #define ARDUCHIP_VER_NUM 0x55 #endif #define ARDUCHIP_TEST1 0x00 //TEST register #define ARDUCHIP_TEST_MSG 0x72 #define ARDUCHIP_CAP_CTRL 0x01 //Capture Control Register #if defined(ARDUCAM_SHIELD) #define ARDUCHIP_MODE 0x02 //Mode register //#define MCU2LCD_MODE 0x00 //#define CAM2LCD_MODE 0x01 #define MCU2LCD_MODE 0x01 #define CAM2LCD_MODE 0x02 //#define LCD2MCU_MODE 0x04 #endif #define ARDUCHIP_FIFO 0x04 //FIFO and I2C control #define FIFO_CLEAR_MASK 0x01 #define FIFO_START_MASK 0x02 #define FIFO_RDPTR_RST_MASK 0x10 #define FIFO_WRPTR_RST_MASK 0x20 #define ARDUCHIP_TRIG 0x41 //Trigger source #define VSYNC_MASK 0x01 #define SHUTTER_MASK 0x02 #define CAP_DONE_MASK 0x08 #define FIFO_SIZE1 0x42 //Camera write FIFO size[7:0] for burst to read #define FIFO_SIZE2 0x43 //Camera write FIFO size[15:8] #define FIFO_SIZE3 0x44 //Camera write FIFO size[18:16] #define BURST_FIFO_READ 0x3C //Burst FIFO read operation #define SINGLE_FIFO_READ 0x3D //Single FIFO read operation #ifdef __cplusplus extern "C" { #endif bool ardu_cam_init(); void ardu_cam_start_capture(); uint32_t ardu_cam_get_fifo_length(); void ardu_cam_print_debug(); volatile const uint8_t* ardu_cam_get_center_array(); uint8_t ardu_cam_is_capture_finished(); void ardu_cam_display_img_utft(); void image_processing(); uint8_t ardu_cam_get_is_encounter_terminate(); #ifdef __cplusplus } #endif //uint8_t ardu_cam_read_reg(uint8_t addr); //void ardu_cam_write_reg(uint8_t addr, uint8_t data); //int ardu_cam_bus_write(int address, int value); //uint8_t ardu_cam_bus_read(int address); #endif //ARDU_CAM_H