Alvaro Cassinelli / Mbed 2 deprecated skinGames_forktest

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers simpleLaserRenderer.h Source File

simpleLaserRenderer.h

00001 #ifndef simpleLaserSensingRenderer_h
00002 #define simpleLaserSensingRenderer_h
00003 
00004 #include "blobConfig.h"
00005 // Include hardware interface for display and sensing:
00006 #include "hardwareIO.h"
00007 
00008 //extern DigitalOut myled3; // for tests...
00009 
00010 //#define debugDelayMirrors // this is to check visually the mirror delay (but it is also beautiful)
00011 
00012 #define RED_BLANKING // note: RED blanking introduces problems because the Lock-in looses signal, but we can add more points to compensate when there 
00013 // are many blobs, see "DEFAULT_OVERLAP_POINTS" (but will slow down...)
00014 
00015 #define RENDER_INTERVAL 0.00011 // good value in previous version (monaco) was 0.00011 // in seconds (Ticker)
00016 
00017 #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 
00018 // 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). 
00019 #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
00020 // WHEN THERE IS MORE THAN ONE SPOT:
00021 #define WAIT_FIRST 12 // special waiting time for mirror positioning to first point on next blob BEFORE re-activating laser
00022 #define WAIT_FIRST_LASER 0  // IMPORTANT waiting time for the activation of the RED laser and LOCK-IN (also waiting time for the mirrors)
00023 #define WAIT_LAST 0  // special waiting time for last point 
00024 
00025 // Redundant drawing for avoiding deformed saccade (note: this could be active when there is more than one blob, instead of using a #define...)
00026 #define DEFAULT_OVERLAP_POINTS 5 // 10
00027 
00028 enum lsdStateType {NORMAL_POINT, LAST_POINT, MOVE_NEXT_BLOB, START_POINT};
00029 
00030 class simpleLaserSensingRenderer {
00031 public:
00032 
00033     void setConfigToRender(blobConfig*); 
00034     //void startRenderer(); // pb: I cannot use the ticker function inside the class!
00035     void laserRenderThread();
00036     void laserRenderThreadONEBLOBONLY();
00037    // void laserRender(blobConfig*);
00038     
00039     blobConfig* ptBlobCfToRender;
00040     
00041     lsdStateType stateLsd;
00042     int totalBlobs;
00043     int currentBlob;
00044     int currentPoint;
00045     int currentMirrorDelay;
00046     int currentTotalPoints;
00047     int currentColor;
00048     unsigned short x,y; // auxiliary variables storing mirror position(0-4096)
00049     
00050     // New method to check complete display of one loop:
00051     unsigned char configTotalPoints;
00052     unsigned char pointDisplayCounter;
00053     unsigned char numOverlapPoints;
00054     
00055     void startFullDisplay();
00056     bool endedFullDisplay();
00057     bool endedFractionDisplay(int fract);
00058     
00059     int waitNormal, waitLaser, waitFirst, waitFirstLaser, waitLast;
00060 };
00061 
00062 #endif
00063 
00064 
00065