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/Camera.cpp@25:6f63053cee81, 2017-02-21 (annotated)
- Committer:
- hazheng
- Date:
- Tue Feb 21 20:00:41 2017 +0000
- Revision:
- 25:6f63053cee81
- Parent:
- 13:7dcb1642ef99
- Child:
- 26:5814404856e2
Added formal version of OV7725RegBuf class.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 3:c8867972ffc7 | 1 | #include "Camera.h" |
hazheng | 3:c8867972ffc7 | 2 | |
hazheng | 13:7dcb1642ef99 | 3 | #include "Core.h" |
hazheng | 13:7dcb1642ef99 | 4 | #include "OV7725RegAddr.h" |
hazheng | 13:7dcb1642ef99 | 5 | #include "PinAssignment.h" |
hazheng | 13:7dcb1642ef99 | 6 | #include "SWUSBServer.h" |
hazheng | 13:7dcb1642ef99 | 7 | |
hazheng | 13:7dcb1642ef99 | 8 | |
hazheng | 25:6f63053cee81 | 9 | DigitalOut testLED(LED_GREEN, 1); |
hazheng | 3:c8867972ffc7 | 10 | |
hazheng | 25:6f63053cee81 | 11 | void OnPixelClock() |
hazheng | 3:c8867972ffc7 | 12 | { |
hazheng | 25:6f63053cee81 | 13 | |
hazheng | 3:c8867972ffc7 | 14 | } |
hazheng | 3:c8867972ffc7 | 15 | |
hazheng | 25:6f63053cee81 | 16 | void OnHorizontalRise() |
hazheng | 3:c8867972ffc7 | 17 | { |
hazheng | 25:6f63053cee81 | 18 | |
hazheng | 3:c8867972ffc7 | 19 | } |
hazheng | 3:c8867972ffc7 | 20 | |
hazheng | 25:6f63053cee81 | 21 | void OnHorizontalFall() |
hazheng | 3:c8867972ffc7 | 22 | { |
hazheng | 25:6f63053cee81 | 23 | |
hazheng | 25:6f63053cee81 | 24 | } |
hazheng | 25:6f63053cee81 | 25 | |
hazheng | 25:6f63053cee81 | 26 | void OnFrameClock() |
hazheng | 25:6f63053cee81 | 27 | { |
hazheng | 3:c8867972ffc7 | 28 | |
hazheng | 3:c8867972ffc7 | 29 | testLED = testLED.read() == 1 ? 0 : 1; |
hazheng | 3:c8867972ffc7 | 30 | } |
hazheng | 3:c8867972ffc7 | 31 | |
hazheng | 13:7dcb1642ef99 | 32 | Camera::Camera(SW::Core & core) : |
hazheng | 13:7dcb1642ef99 | 33 | m_core(core), |
hazheng | 25:6f63053cee81 | 34 | m_pClock(InterruptIn(PIN_CC_PCLOCK)), |
hazheng | 25:6f63053cee81 | 35 | m_href(InterruptIn(PIN_CC_HREF)), |
hazheng | 25:6f63053cee81 | 36 | m_vsnyc(InterruptIn(PIN_CC_VSYNC)), |
hazheng | 3:c8867972ffc7 | 37 | m_currentIndex(0), |
hazheng | 3:c8867972ffc7 | 38 | m_currentRow(0), |
hazheng | 3:c8867972ffc7 | 39 | m_currentCol(0), |
hazheng | 25:6f63053cee81 | 40 | m_hasPic(false), |
hazheng | 25:6f63053cee81 | 41 | m_regBuf(NULL) |
hazheng | 3:c8867972ffc7 | 42 | { |
hazheng | 3:c8867972ffc7 | 43 | |
hazheng | 3:c8867972ffc7 | 44 | } |
hazheng | 3:c8867972ffc7 | 45 | |
hazheng | 3:c8867972ffc7 | 46 | Camera::~Camera() |
hazheng | 3:c8867972ffc7 | 47 | { |
hazheng | 3:c8867972ffc7 | 48 | |
hazheng | 3:c8867972ffc7 | 49 | } |
hazheng | 3:c8867972ffc7 | 50 | |
hazheng | 3:c8867972ffc7 | 51 | bool Camera::HasPicture() const |
hazheng | 3:c8867972ffc7 | 52 | { |
hazheng | 3:c8867972ffc7 | 53 | return m_hasPic; |
hazheng | 3:c8867972ffc7 | 54 | } |
hazheng | 3:c8867972ffc7 | 55 | |
hazheng | 3:c8867972ffc7 | 56 | const unsigned char * Camera::GetPicture() const |
hazheng | 3:c8867972ffc7 | 57 | { |
hazheng | 13:7dcb1642ef99 | 58 | return NULL; //m_pics[m_currentIndex == 0 ? 1 : 0]; |
hazheng | 13:7dcb1642ef99 | 59 | } |
hazheng | 13:7dcb1642ef99 | 60 |