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
Camera.h@3:c8867972ffc7, 2017-02-01 (annotated)
- Committer:
- hazheng
- Date:
- Wed Feb 01 00:35:48 2017 +0000
- Revision:
- 3:c8867972ffc7
Added code for camera.
Who changed what in which revision?
User | Revision | Line number | New 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 | 3:c8867972ffc7 | 5 | #define CAM_MAX_ROW 480 |
hazheng | 3:c8867972ffc7 | 6 | #define CAM_MAX_COL 640 |
hazheng | 3:c8867972ffc7 | 7 | |
hazheng | 3:c8867972ffc7 | 8 | class Camera |
hazheng | 3:c8867972ffc7 | 9 | { |
hazheng | 3:c8867972ffc7 | 10 | public: |
hazheng | 3:c8867972ffc7 | 11 | |
hazheng | 3:c8867972ffc7 | 12 | Camera(); |
hazheng | 3:c8867972ffc7 | 13 | |
hazheng | 3:c8867972ffc7 | 14 | ~Camera(); |
hazheng | 3:c8867972ffc7 | 15 | |
hazheng | 3:c8867972ffc7 | 16 | bool HasPicture() const; |
hazheng | 3:c8867972ffc7 | 17 | |
hazheng | 3:c8867972ffc7 | 18 | const unsigned char * GetPicture() const; |
hazheng | 3:c8867972ffc7 | 19 | |
hazheng | 3:c8867972ffc7 | 20 | private: |
hazheng | 3:c8867972ffc7 | 21 | |
hazheng | 3:c8867972ffc7 | 22 | void OnPixelClock(); |
hazheng | 3:c8867972ffc7 | 23 | |
hazheng | 3:c8867972ffc7 | 24 | void OnFrameClock(); |
hazheng | 3:c8867972ffc7 | 25 | |
hazheng | 3:c8867972ffc7 | 26 | void OnHorizontalClock(); |
hazheng | 3:c8867972ffc7 | 27 | |
hazheng | 3:c8867972ffc7 | 28 | InterruptIn m_pClock; |
hazheng | 3:c8867972ffc7 | 29 | |
hazheng | 3:c8867972ffc7 | 30 | InterruptIn m_href; |
hazheng | 3:c8867972ffc7 | 31 | |
hazheng | 3:c8867972ffc7 | 32 | InterruptIn m_vsnyc; |
hazheng | 3:c8867972ffc7 | 33 | |
hazheng | 3:c8867972ffc7 | 34 | std::vector<DigitalIn> m_dIn; |
hazheng | 3:c8867972ffc7 | 35 | |
hazheng | 3:c8867972ffc7 | 36 | unsigned char m_pics[2][(CAM_MAX_ROW + 1) * (CAM_MAX_COL + 1)]; |
hazheng | 3:c8867972ffc7 | 37 | |
hazheng | 3:c8867972ffc7 | 38 | unsigned char m_currentIndex; |
hazheng | 3:c8867972ffc7 | 39 | |
hazheng | 3:c8867972ffc7 | 40 | unsigned int m_currentRow; |
hazheng | 3:c8867972ffc7 | 41 | |
hazheng | 3:c8867972ffc7 | 42 | unsigned int m_currentCol; |
hazheng | 3:c8867972ffc7 | 43 | |
hazheng | 3:c8867972ffc7 | 44 | bool m_hasPic; |
hazheng | 3:c8867972ffc7 | 45 | }; |