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

Committer:
hazheng
Date:
Wed Feb 08 23:47:02 2017 +0000
Revision:
13:7dcb1642ef99
Parent:
9:b72e18f80f49
Child:
25:6f63053cee81
Finished reading SCCB from camera.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hazheng 3:c8867972ffc7 1 #pragma once
hazheng 3:c8867972ffc7 2 #include "mbed.h"
hazheng 3:c8867972ffc7 3 #include <vector>
hazheng 3:c8867972ffc7 4
hazheng 13:7dcb1642ef99 5 #include "OV7725RegBuf.h"
hazheng 13:7dcb1642ef99 6
hazheng 3:c8867972ffc7 7 #define CAM_MAX_ROW 480
hazheng 3:c8867972ffc7 8 #define CAM_MAX_COL 640
hazheng 3:c8867972ffc7 9
hazheng 13:7dcb1642ef99 10 namespace SW
hazheng 13:7dcb1642ef99 11 {
hazheng 13:7dcb1642ef99 12 class Core;
hazheng 13:7dcb1642ef99 13 }
hazheng 13:7dcb1642ef99 14
hazheng 3:c8867972ffc7 15 class Camera
hazheng 3:c8867972ffc7 16 {
hazheng 3:c8867972ffc7 17 public:
hazheng 3:c8867972ffc7 18
hazheng 13:7dcb1642ef99 19 Camera(SW::Core & core);
hazheng 3:c8867972ffc7 20
hazheng 3:c8867972ffc7 21 ~Camera();
hazheng 3:c8867972ffc7 22
hazheng 3:c8867972ffc7 23 bool HasPicture() const;
hazheng 3:c8867972ffc7 24
hazheng 3:c8867972ffc7 25 const unsigned char * GetPicture() const;
hazheng 3:c8867972ffc7 26
hazheng 13:7dcb1642ef99 27 //Blocking method. Do not use during the running state!!
hazheng 13:7dcb1642ef99 28 void ReadRegisters();
hazheng 13:7dcb1642ef99 29
hazheng 3:c8867972ffc7 30 private:
hazheng 3:c8867972ffc7 31
hazheng 13:7dcb1642ef99 32 Camera();
hazheng 13:7dcb1642ef99 33
hazheng 3:c8867972ffc7 34 void OnPixelClock();
hazheng 3:c8867972ffc7 35
hazheng 3:c8867972ffc7 36 void OnFrameClock();
hazheng 3:c8867972ffc7 37
hazheng 3:c8867972ffc7 38 void OnHorizontalClock();
hazheng 3:c8867972ffc7 39
hazheng 13:7dcb1642ef99 40 //Blocking method. Do not use during the running state!!
hazheng 13:7dcb1642ef99 41 void SCCBWrite(const uint8_t RegAddr, uint8_t Data);
hazheng 13:7dcb1642ef99 42
hazheng 13:7dcb1642ef99 43 //Blocking method. Do not use during the running state!!
hazheng 13:7dcb1642ef99 44 uint8_t SCCBRead(const uint8_t RegAddr);
hazheng 13:7dcb1642ef99 45
hazheng 13:7dcb1642ef99 46 SW::Core & m_core;
hazheng 13:7dcb1642ef99 47
hazheng 3:c8867972ffc7 48 InterruptIn m_pClock;
hazheng 3:c8867972ffc7 49
hazheng 3:c8867972ffc7 50 InterruptIn m_href;
hazheng 3:c8867972ffc7 51
hazheng 3:c8867972ffc7 52 InterruptIn m_vsnyc;
hazheng 3:c8867972ffc7 53
hazheng 13:7dcb1642ef99 54 I2C m_sccbCtrl;
hazheng 3:c8867972ffc7 55
hazheng 13:7dcb1642ef99 56 //unsigned char m_pics[2][(CAM_MAX_ROW + 1) * (CAM_MAX_COL + 1)];
hazheng 3:c8867972ffc7 57
hazheng 3:c8867972ffc7 58 unsigned char m_currentIndex;
hazheng 3:c8867972ffc7 59
hazheng 3:c8867972ffc7 60 unsigned int m_currentRow;
hazheng 3:c8867972ffc7 61
hazheng 3:c8867972ffc7 62 unsigned int m_currentCol;
hazheng 3:c8867972ffc7 63
hazheng 3:c8867972ffc7 64 bool m_hasPic;
hazheng 13:7dcb1642ef99 65
hazheng 13:7dcb1642ef99 66 OV7725RegBuf m_regBuf;
hazheng 3:c8867972ffc7 67 };