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/Camera.h
- Revision:
- 13:7dcb1642ef99
- Parent:
- 9:b72e18f80f49
- Child:
- 25:6f63053cee81
--- a/Hardwares/Camera.h Wed Feb 08 18:00:33 2017 +0000 +++ b/Hardwares/Camera.h Wed Feb 08 23:47:02 2017 +0000 @@ -2,14 +2,21 @@ #include "mbed.h" #include <vector> +#include "OV7725RegBuf.h" + #define CAM_MAX_ROW 480 #define CAM_MAX_COL 640 +namespace SW +{ + class Core; +} + class Camera { public: - Camera(); + Camera(SW::Core & core); ~Camera(); @@ -17,23 +24,36 @@ const unsigned char * GetPicture() const; + //Blocking method. Do not use during the running state!! + void ReadRegisters(); + private: + Camera(); + void OnPixelClock(); void OnFrameClock(); void OnHorizontalClock(); + //Blocking method. Do not use during the running state!! + void SCCBWrite(const uint8_t RegAddr, uint8_t Data); + + //Blocking method. Do not use during the running state!! + uint8_t SCCBRead(const uint8_t RegAddr); + + SW::Core & m_core; + InterruptIn m_pClock; InterruptIn m_href; InterruptIn m_vsnyc; - std::vector<DigitalIn> m_dIn; + I2C m_sccbCtrl; - unsigned char m_pics[2][(CAM_MAX_ROW + 1) * (CAM_MAX_COL + 1)]; + //unsigned char m_pics[2][(CAM_MAX_ROW + 1) * (CAM_MAX_COL + 1)]; unsigned char m_currentIndex; @@ -42,4 +62,6 @@ unsigned int m_currentCol; bool m_hasPic; + + OV7725RegBuf m_regBuf; };