-
Notifications
You must be signed in to change notification settings - Fork 0
/
DSO_frame.h
158 lines (143 loc) · 5.15 KB
/
DSO_frame.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//---------------------------------------------------------------------------
#ifndef DSO_frameH
#define DSO_frameH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <rxPlacemnt.hpp>
#include <ExtCtrls.hpp>
#include <Buttons.hpp>
#include "Hard.h"
#include "ShapeGL.h"
#include <Menus.hpp> // ÝÒÎ ÄÎËÆÍÎ ÁÛÒÜ ÍÈÆÅ ÂÑÅÕ rx*.h !!!!!
#include "DSO_cursor.h"
#define CNT_SHP 6 // 4 shapes chnl + 2 shapes triggers
#define CNT_CUR 6
//---------------------------------------------------------------------------
typedef void __fastcall (__closure *TcbSendChnlParams)(TChnlParams*) ;
typedef void __fastcall (__closure *TcbGetChnlParams )(uint8_t,TChnlParams*) ;
typedef void __fastcall (__closure *TcbSendTimParams )(TTimeParams*) ;
typedef void __fastcall (__closure *TcbGetTimParams )(uint8_t,TTimeParams*) ;
typedef void __fastcall (__closure *TcbChngTimDiv )(int chng) ;
enum TTrgMode {tmEdge=11,tmPulse,tmVideo,tmCAN,tmLIN,tmUART,tmSPI,tmI2C,tmALT};
enum TTrgSweep {tsAUTO=21,tsNORMAL,tsSINGLE};
enum TTrgSrc {srcCH1=31,srcCH2,srcCH3,srcCH4};
enum TTrgSlope {slRising=41,slFalling};
//---------------------------------------------------------------------------
class TFrmDSO : public TFrame
{
__published: // IDE-managed Components
TScrollBox *pView;
TLabel *Label1;
TLabel *Label2;
TPanel *pLeft;
TPanel *pTop2;
TPanel *pRight;
TPanel *pBottom2;
TFormStorage *FormStorage1;
TPanel *pTop;
TSpeedButton *bStretch;
TSpeedButton *bFixTrgT;
TSpeedButton *btn3;
TSpeedButton *btn4;
TPanel *pBottom;
TPopupMenu *pmChnl;
TMenuItem *On1;
TMenuItem *VDiv1;
TMenuItem *N20mV1;
TMenuItem *N50mV1;
TMenuItem *Couple1;
TMenuItem *DC1;
TMenuItem *AC1;
TMenuItem *GND1;
TLabel *lblTimDiv;
TShape *shpView;
TLabel *lblTrgT;
TPopupMenu *popTrgV;
TMenuItem *miMode;
TMenuItem *miEdge;
TMenuItem *miPulse;
TMenuItem *miVideo;
TMenuItem *miCAN;
TMenuItem *miLin;
TMenuItem *miUART;
TMenuItem *miSPI;
TMenuItem *miI2C;
TMenuItem *miALT;
TMenuItem *miSweep;
TMenuItem *miAUTO;
TMenuItem *miNORMAL;
TMenuItem *miSINGLE;
TMenuItem *miSource;
TMenuItem *miCH1;
TMenuItem *miCH2;
TMenuItem *miCH3;
TMenuItem *miCH4;
TMenuItem *miSlope;
TMenuItem *miRising;
TMenuItem *miFalling;
void __fastcall FMouseMove(TObject *Sender,TShiftState Shift,int X,int Y);
void __fastcall FResize(TObject *Sender);
void __fastcall BtnClick(TObject *Sender);
void __fastcall FMouseWheel(TObject *Sender, TShiftState Shift,
int WheelDelta, TPoint &MousePos, bool &Handled);
void __fastcall FMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
void __fastcall FDblClick(TObject *Sender);
void __fastcall popTrgClick(TObject *Sender);
void __fastcall FMouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
private: // User declarations
// uint32_t LvlsPos ;
CHard m_Hard ;
TRect Rect ;
TNotifyEvent FOnChange ;
double SmplPerDiv ;
USHORT CntGrid_H ;
USHORT CntGrid_V ;
TShapeGL* shpLvl[CNT_SHP] ;// shapes chnl + shapes triggers
TLabel* lblCh[4] ;
TLabel* lblDbg[4] ;
TDsoCursor* CursorDSO[CNT_CUR] ;
void __fastcall CalcDrawWaves(void) ;
void __fastcall DrawWaves (void) ;
void __fastcall DrawShapes (void) ;
void __fastcall DrawWaveInYT(USHORT nCH) ;
void __fastcall SetHardLvlChnl(UCHAR ch,int lvl);
void __fastcall ShowShpView(bool Fix_TrgT=false) ;
void __fastcall GetCursorInfo(void) ;
public: // User declarations
bool flDbg1, flDbg2, flDbg3, flDbg4 ;
TcbSendChnlParams cbSendChnlParams ;
TcbGetChnlParams cbGetChnlParams ;
TcbSendTimParams cbSendTimParams ;
TcbGetTimParams cbGetTimParams ;
TcbChngTimDiv cbChngTimDiv ;
__fastcall TFrmDSO(TComponent* Owner,TNotifyEvent _onChnge) ;
void __fastcall Init(TObject* Sender,uint32_t _lvlsPos) ;
void __fastcall SetChnlParams(TChnlParams* params) ;
void __fastcall SetTimeDiv(TTimeParams* timPrms, String StrTimDiv) ;
void __fastcall Dbg1(void) ;
String __fastcall GetSmplRate (void) ;
String __fastcall GetTimDiv (void) ;
String __fastcall GetSmplPerDiv(void) ;
String __fastcall GetTimClct (void) ;
size_t __fastcall CountSamples (void) ;//{ return m_Hard.BufferLen() ;}
void __fastcall Destroy(TObject* Sender) ;
USHORT __fastcall CollectData (void) ;
void __fastcall OnDraw(TObject *Sender) ;
uint16_t __fastcall GetDevIx(){ return m_Hard.m_nDeviceIndex ;}
TColor __fastcall GetChColor(uint8_t ch){return ch<4 ? TColor(m_Hard.m_clrRGB[ch]) : clGray ;}
char __fastcall GetCHMode(){return m_Hard.m_nCHMod ;}
// uint8_t __fastcall LoadLvl255(uint8_t nCh)
// { UCHAR* lvl = (UCHAR*)&(pLeft->Tag) ; return nCh < 4 ? lvl[nCh] : 127 ;}
// void __fastcall SaveLvl255(UCHAR nCh,UCHAR val)
// { UCHAR* lvl = (UCHAR*)&(pLeft->Tag) ; lvl[nCh] = val ;}
void __fastcall SaveProps(void){ FormStorage1->SaveFormPlacement() ;}
};
//---------------------------------------------------------------------------
extern PACKAGE TFrmDSO *FrmDSO;
//---------------------------------------------------------------------------
#endif