numeric oscilloscope

  1. /*--------------------------------------------------------------------------------
  2. 'Nom du projet : Oscilloscope
  3. 'Outil : Visual C++ 6
  4. 'Nom du fichier: Scope.h : implementation file
  5. 'Realisation:Mathieu Texier et Emmanuel Traineau
  6. 'Date: Juin 2003
  7. 'Responsable: Eric Meleiro
  8. '--------------------------------------------------------------------------------
  9. */
  10.  
  11. // spin déclaré dans oscilloDlg.cpp
  12. extern int m_volt;
  13. extern int m_time;
  14. extern int m_offset;
  15.  
  16. class CScope : public CStatic
  17. {
  18. // Construction
  19. public:
  20.         CScope();
  21.  
  22. // Attributes
  23. public:
  24.         HWND hwnd;
  25.         HDC hdc;
  26.         HPEN hp_green;
  27.         POINT *pts;
  28.         int cx;
  29.         int cy;
  30.         int cy2;
  31.         int cyscope;
  32.         short int qdx;
  33.         short int qdy;
  34.  
  35.  
  36. // Operations
  37. public:
  38.         void Reset (void);
  39.         void Quadrillage(void);
  40.        
  41.         // affiche la courbe lors de la lecture
  42.         void UpdateView (BYTE *ptr)
  43.         {
  44.                 int s;
  45.                 for (s=0; s<cx; s++)    // balayage de l'écran
  46.                 pts[s].y = cyscope - m_offset + ((10*ptr[s])/(8*m_volt)); // abscice de chaque point
  47.                 ::PatBlt (hdc, 0, 0, cx, cy, BLACKNESS);        //      remplit la fenètre de noir
  48.                 Quadrillage(); // affiche la grille    
  49.                 hp_green = ::CreatePen (PS_SOLID, 1, RGB(0,255,0));     //définition du pinceau vert
  50.                 ::SelectObject (hdc, hp_green)  ;//selection de se pinceau
  51.                 ::Polyline (hdc, pts, cx);      // trace un trait entre chaque point -> aaffiche la courbe
  52.         }
  53.  
  54.  
  55. // Implementation
  56. public:
  57.        
  58.        
  59.  
  60.         virtual ~CScope();
  61.  
  62.         // Generated message map functions
  63. protected:
  64.         //{{AFX_MSG(CScope)
  65.         afx_msg void OnDestroy();
  66.         afx_msg void OnPaint();
  67.         //}}AFX_MSG
  68.  
  69.         DECLARE_MESSAGE_MAP()
  70. };
  71.  
  72. /////////////////////////////////////////////////////////////////////////////
  73.  

contact - link to this site