Custom version for NXP cup car

Dependents:   NXPCUPcar

Committer:
Clarkk
Date:
Thu Jun 01 13:17:03 2017 +0000
Revision:
1:68bb92736e14
Parent:
0:ccbc44580fab
Few changes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Clarkk 0:ccbc44580fab 1 #include "mbed.h"
Clarkk 0:ccbc44580fab 2
Clarkk 0:ccbc44580fab 3 #ifndef _VISION_H
Clarkk 0:ccbc44580fab 4 #define _VISION_H
Clarkk 0:ccbc44580fab 5
Clarkk 1:68bb92736e14 6 struct Point {
Clarkk 1:68bb92736e14 7 float x;
Clarkk 1:68bb92736e14 8 float y;
Clarkk 1:68bb92736e14 9 };
Clarkk 1:68bb92736e14 10
Clarkk 0:ccbc44580fab 11 struct lineScanData {
Clarkk 0:ccbc44580fab 12 uint8_t mostWhiteIndex;
Clarkk 0:ccbc44580fab 13 uint16_t maxLightValue;
Clarkk 0:ccbc44580fab 14 uint8_t rightEdgeIndex;
Clarkk 0:ccbc44580fab 15 uint8_t leftEdgeIndex;
Clarkk 1:68bb92736e14 16 struct Point rightEdgePosition;
Clarkk 1:68bb92736e14 17 struct Point leftEdgePosition;
Clarkk 1:68bb92736e14 18 Timer age;
Clarkk 0:ccbc44580fab 19 };
Clarkk 0:ccbc44580fab 20
Clarkk 0:ccbc44580fab 21 class Vision
Clarkk 0:ccbc44580fab 22 {
Clarkk 0:ccbc44580fab 23 public:
Clarkk 0:ccbc44580fab 24
Clarkk 0:ccbc44580fab 25 Vision();
Clarkk 1:68bb92736e14 26 bool processTasks();
Clarkk 0:ccbc44580fab 27 void saveData(uint16_t* line);
Clarkk 0:ccbc44580fab 28 struct lineScanData processLine();
Clarkk 0:ccbc44580fab 29 bool lightCompensation;
Clarkk 0:ccbc44580fab 30 struct lineScanData getRoadData();
Clarkk 0:ccbc44580fab 31
Clarkk 0:ccbc44580fab 32 private:
Clarkk 0:ccbc44580fab 33
Clarkk 0:ccbc44580fab 34 uint16_t lineData[128];
Clarkk 0:ccbc44580fab 35 bool newDataToProcess;
Clarkk 0:ccbc44580fab 36 struct lineScanData currentRoadData;
Clarkk 1:68bb92736e14 37 Timer dataAge;
Clarkk 0:ccbc44580fab 38 void lineScanLightAdjust();
Clarkk 1:68bb92736e14 39 struct Point getPixelPosition(uint8_t pixelIndex);
Clarkk 0:ccbc44580fab 40 };
Clarkk 0:ccbc44580fab 41
Clarkk 0:ccbc44580fab 42 #endif