just a test

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

Committer:
mbedalvaro
Date:
Mon Jun 18 11:37:00 2012 +0000
Revision:
25:74cb85b85fd2
Parent:
17:356ca5690a59
Child:
30:d8af03f01cd4
corrected some mistakes on color control;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedalvaro 0:345b3bc7a0ea 1 #ifndef simpleLaserSensingRenderer_h
mbedalvaro 0:345b3bc7a0ea 2 #define simpleLaserSensingRenderer_h
mbedalvaro 0:345b3bc7a0ea 3
mbedalvaro 0:345b3bc7a0ea 4 #include "blobConfig.h"
mbedalvaro 0:345b3bc7a0ea 5 // Include hardware interface for display and sensing:
mbedalvaro 0:345b3bc7a0ea 6 #include "hardwareIO.h"
mbedalvaro 0:345b3bc7a0ea 7
mbedalvaro 0:345b3bc7a0ea 8 //extern DigitalOut myled3; // for tests...
mbedalvaro 0:345b3bc7a0ea 9
mbedalvaro 0:345b3bc7a0ea 10 #define debugDelayMirrors // this is to check visually the mirror delay (but it is also beautiful)
mbedalvaro 0:345b3bc7a0ea 11
mbedalvaro 25:74cb85b85fd2 12 #define RED_BLANKING // note: RED blanking introduces problems because the Lock-in looses signal, but we can add more points to compensate when there
mbedalvaro 25:74cb85b85fd2 13 // are many blobs, see "DEFAULT_OVERLAP_POINTS" (but will slow down...)
mbedalvaro 15:56a0bf424e8d 14
mbedalvaro 5:73cd58b58f95 15 #define RENDER_INTERVAL 0.00011 // good value in previous version (monaco) was 0.00011 // in seconds (Ticker)
mbedalvaro 4:f9d364f10335 16
mbedalvaro 14:0fc33a3a7b4b 17 #define WAIT_NORMAL 0 // good :0 // (minimum is 0) waiting time for setting mirror position MINUS waiting laser time (note that this total waiting time may be equal to 0 if we set a good sampling freq for the renderer, but
mbedalvaro 4:f9d364f10335 18 // and if the shape is regular so that this time does not change significatively - this is not the case for multiple blobs or highly deformed blobs).
mbedalvaro 15:56a0bf424e8d 19 #define WAIT_LASER 0 // (minimum is 0) waiting time for activating the laser (if there are color changes IN BETWEEN points). Maybe needed for the green laser
mbedalvaro 15:56a0bf424e8d 20 // WHEN THERE IS MORE THAN ONE SPOT:
mbedalvaro 17:356ca5690a59 21 #define WAIT_FIRST 12 // special waiting time for mirror positioning to first point on next blob BEFORE re-activating laser
mbedalvaro 16:2ff1cb2ae1b1 22 #define WAIT_FIRST_LASER 0 // IMPORTANT waiting time for the activation of the RED laser and LOCK-IN (also waiting time for the mirrors)
mbedalvaro 16:2ff1cb2ae1b1 23 #define WAIT_LAST 0 // special waiting time for last point
mbedalvaro 16:2ff1cb2ae1b1 24
mbedalvaro 16:2ff1cb2ae1b1 25 // Redundant drawing for avoiding deformed saccade (note: this could be active when there is more than one blob, instead of using a #define...)
mbedalvaro 17:356ca5690a59 26 #define DEFAULT_OVERLAP_POINTS 10
mbedalvaro 4:f9d364f10335 27
mbedalvaro 4:f9d364f10335 28 enum lsdStateType {NORMAL_POINT, LAST_POINT, MOVE_NEXT_BLOB, START_POINT};
mbedalvaro 0:345b3bc7a0ea 29
mbedalvaro 0:345b3bc7a0ea 30 class simpleLaserSensingRenderer {
mbedalvaro 0:345b3bc7a0ea 31 public:
mbedalvaro 0:345b3bc7a0ea 32
mbedalvaro 0:345b3bc7a0ea 33 void setConfigToRender(blobConfig*);
mbedalvaro 0:345b3bc7a0ea 34 //void startRenderer(); // pb: I cannot use the ticker function inside the class!
mbedalvaro 0:345b3bc7a0ea 35 void laserRenderThread();
mbedalvaro 7:0df17f3078bc 36 void laserRenderThreadONEBLOBONLY();
mbedalvaro 0:345b3bc7a0ea 37 // void laserRender(blobConfig*);
mbedalvaro 0:345b3bc7a0ea 38
mbedalvaro 0:345b3bc7a0ea 39 blobConfig* ptBlobCfToRender;
mbedalvaro 4:f9d364f10335 40
mbedalvaro 4:f9d364f10335 41 lsdStateType stateLsd;
mbedalvaro 0:345b3bc7a0ea 42 int totalBlobs;
mbedalvaro 0:345b3bc7a0ea 43 int currentBlob;
mbedalvaro 0:345b3bc7a0ea 44 int currentPoint;
mbedalvaro 0:345b3bc7a0ea 45 int currentMirrorDelay;
mbedalvaro 0:345b3bc7a0ea 46 int currentTotalPoints;
mbedalvaro 0:345b3bc7a0ea 47 int currentColor;
mbedalvaro 9:3321170d157c 48 unsigned short x,y; // auxiliary variables storing mirror position(0-4096)
mbedalvaro 9:3321170d157c 49
mbedalvaro 13:9f03eac02700 50 // New method to check complete display of one loop:
mbedalvaro 13:9f03eac02700 51 unsigned char configTotalPoints;
mbedalvaro 13:9f03eac02700 52 unsigned char pointDisplayCounter;
mbedalvaro 17:356ca5690a59 53 unsigned char numOverlapPoints;
mbedalvaro 13:9f03eac02700 54 bool endedFullDisplay();
mbedalvaro 13:9f03eac02700 55 void startFullDisplay();
mbedalvaro 4:f9d364f10335 56
mbedalvaro 15:56a0bf424e8d 57 int waitNormal, waitLaser, waitFirst, waitFirstLaser, waitLast;
mbedalvaro 0:345b3bc7a0ea 58 };
mbedalvaro 0:345b3bc7a0ea 59
mbedalvaro 0:345b3bc7a0ea 60 #endif
mbedalvaro 0:345b3bc7a0ea 61
mbedalvaro 0:345b3bc7a0ea 62
mbedalvaro 0:345b3bc7a0ea 63