just a test

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

Committer:
mbedalvaro
Date:
Tue Dec 02 04:28:42 2014 +0000
Revision:
48:7633d8e7b0d3
Parent:
45:a3b984a79d5d
this is the working version of the skin games sowtware (aka, scorelight but with pre-determined "games")

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedalvaro 31:5f039cbddee8 1 #ifndef simpleLaserSensingRenderer_h
mbedalvaro 31:5f039cbddee8 2 #define simpleLaserSensingRenderer_h
mbedalvaro 31:5f039cbddee8 3
mbedalvaro 31:5f039cbddee8 4 #include "blobConfig.h"
mbedalvaro 31:5f039cbddee8 5 // Include hardware interface for display and sensing:
mbedalvaro 31:5f039cbddee8 6 #include "hardwareIO.h"
mbedalvaro 31:5f039cbddee8 7
mbedalvaro 31:5f039cbddee8 8 //extern DigitalOut myled3; // for tests...
mbedalvaro 31:5f039cbddee8 9
mbedalvaro 45:a3b984a79d5d 10 //#define debugDelayMirrors // this is to check visually the mirror delay (but it is also beautiful)
mbedalvaro 31:5f039cbddee8 11
mbedalvaro 31:5f039cbddee8 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 31:5f039cbddee8 13 // are many blobs, see "DEFAULT_OVERLAP_POINTS" (but will slow down...)
mbedalvaro 31:5f039cbddee8 14
mbedalvaro 31:5f039cbddee8 15 #define RENDER_INTERVAL 0.00011 // good value in previous version (monaco) was 0.00011 // in seconds (Ticker)
mbedalvaro 31:5f039cbddee8 16
mbedalvaro 31:5f039cbddee8 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 31:5f039cbddee8 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 31:5f039cbddee8 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 31:5f039cbddee8 20 // WHEN THERE IS MORE THAN ONE SPOT:
mbedalvaro 31:5f039cbddee8 21 #define WAIT_FIRST 12 // special waiting time for mirror positioning to first point on next blob BEFORE re-activating laser
mbedalvaro 31:5f039cbddee8 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 31:5f039cbddee8 23 #define WAIT_LAST 0 // special waiting time for last point
mbedalvaro 31:5f039cbddee8 24
mbedalvaro 31:5f039cbddee8 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 44:46e25fa1669b 26 #define DEFAULT_OVERLAP_POINTS 5 // 10
mbedalvaro 31:5f039cbddee8 27
mbedalvaro 31:5f039cbddee8 28 enum lsdStateType {NORMAL_POINT, LAST_POINT, MOVE_NEXT_BLOB, START_POINT};
mbedalvaro 31:5f039cbddee8 29
mbedalvaro 31:5f039cbddee8 30 class simpleLaserSensingRenderer {
mbedalvaro 31:5f039cbddee8 31 public:
mbedalvaro 31:5f039cbddee8 32
mbedalvaro 31:5f039cbddee8 33 void setConfigToRender(blobConfig*);
mbedalvaro 31:5f039cbddee8 34 //void startRenderer(); // pb: I cannot use the ticker function inside the class!
mbedalvaro 31:5f039cbddee8 35 void laserRenderThread();
mbedalvaro 31:5f039cbddee8 36 void laserRenderThreadONEBLOBONLY();
mbedalvaro 31:5f039cbddee8 37 // void laserRender(blobConfig*);
mbedalvaro 31:5f039cbddee8 38
mbedalvaro 31:5f039cbddee8 39 blobConfig* ptBlobCfToRender;
mbedalvaro 31:5f039cbddee8 40
mbedalvaro 31:5f039cbddee8 41 lsdStateType stateLsd;
mbedalvaro 31:5f039cbddee8 42 int totalBlobs;
mbedalvaro 31:5f039cbddee8 43 int currentBlob;
mbedalvaro 31:5f039cbddee8 44 int currentPoint;
mbedalvaro 31:5f039cbddee8 45 int currentMirrorDelay;
mbedalvaro 31:5f039cbddee8 46 int currentTotalPoints;
mbedalvaro 31:5f039cbddee8 47 int currentColor;
mbedalvaro 31:5f039cbddee8 48 unsigned short x,y; // auxiliary variables storing mirror position(0-4096)
mbedalvaro 31:5f039cbddee8 49
mbedalvaro 31:5f039cbddee8 50 // New method to check complete display of one loop:
mbedalvaro 31:5f039cbddee8 51 unsigned char configTotalPoints;
mbedalvaro 31:5f039cbddee8 52 unsigned char pointDisplayCounter;
mbedalvaro 31:5f039cbddee8 53 unsigned char numOverlapPoints;
mbedalvaro 44:46e25fa1669b 54
mbedalvaro 44:46e25fa1669b 55 void startFullDisplay();
mbedalvaro 31:5f039cbddee8 56 bool endedFullDisplay();
mbedalvaro 44:46e25fa1669b 57 bool endedFractionDisplay(int fract);
mbedalvaro 31:5f039cbddee8 58
mbedalvaro 31:5f039cbddee8 59 int waitNormal, waitLaser, waitFirst, waitFirstLaser, waitLast;
mbedalvaro 31:5f039cbddee8 60 };
mbedalvaro 31:5f039cbddee8 61
mbedalvaro 31:5f039cbddee8 62 #endif
mbedalvaro 31:5f039cbddee8 63
mbedalvaro 31:5f039cbddee8 64
mbedalvaro 31:5f039cbddee8 65