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:
- 9:b72e18f80f49
- Parent:
- 3:c8867972ffc7
- Child:
- 13:7dcb1642ef99
diff -r 92f6baeea027 -r b72e18f80f49 Hardwares/Camera.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hardwares/Camera.h Mon Feb 06 21:07:52 2017 +0000 @@ -0,0 +1,45 @@ +#pragma once +#include "mbed.h" +#include <vector> + +#define CAM_MAX_ROW 480 +#define CAM_MAX_COL 640 + +class Camera +{ +public: + + Camera(); + + ~Camera(); + + bool HasPicture() const; + + const unsigned char * GetPicture() const; + +private: + + void OnPixelClock(); + + void OnFrameClock(); + + void OnHorizontalClock(); + + InterruptIn m_pClock; + + InterruptIn m_href; + + InterruptIn m_vsnyc; + + std::vector<DigitalIn> m_dIn; + + unsigned char m_pics[2][(CAM_MAX_ROW + 1) * (CAM_MAX_COL + 1)]; + + unsigned char m_currentIndex; + + unsigned int m_currentRow; + + unsigned int m_currentCol; + + bool m_hasPic; +};