DSO138_SourceCodes_v037.rar
[DSO138] / libdso138.h
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 //      Filename:       libdso138.h
4 //      Version:                
5 //      Data:           
6 //
7 //      Author:         Liu, Zemin
8 //      Company:        JYE Tech Ltd.
9 //      Web:            www.jyetech.com
10 //
11 //-----------------------------------------------------------------------------
12 //
13 //      Target:                 STM32F103C8
14 //      Tool chain:     CodeSourcery G++
15 //
16 //-----------------------------------------------------------------------------
17 //      Required files:
18 //
19 //-----------------------------------------------------------------------------
20 //      Notes:
21 //
22 //
23 //-----------------------------------------------------------------------------
24 //      Revision History:
25 //
26 ///////////////////////////////////////////////////////////////////////////////
27
28 #ifndef libdso138_h
29
30 #define libdso138_h
31
32 //#include      "Common.h"
33
34 // =======================================================
35
36 #define VPosMax 255
37 #define VPosMin         -255
38
39 #define VSenMax VS_10mV
40 #define VSenMin         VS_5V
41
42 #define CplMax          CP_GND
43 #define CplMin          CP_DC
44
45 #define TBMax           TB_10us
46 #define TBMin           TB_500s
47
48 #define TrigModeMax     TM_Single
49 #define TrigModeMin             TM_Auto
50
51 #define TrigEdgeMax     TE_Rising
52 #define TrigEdgeMin             TE_Falling
53
54 #define TrigLvlMax              300
55 #define TrigLvlMin              -300
56
57 #define SampleBufSizeMax        0x400
58
59 #define RecLenMax               SampleBufSizeMax
60 #define RecLenMin               512
61
62
63 // =======================================================
64 //      Scope control type definitions
65 // =======================================================
66 //
67
68 // -- Time base type
69 enum    TimeBase {
70 //      TB_min,
71         TB_Custom       = 0,    
72         TB_500s,                
73         TB_200s,                
74         TB_100s,                
75         TB_50s,         
76         TB_20s,         
77         TB_10s,         
78         TB_5s,          
79         TB_2s,          
80         TB_1s,          
81         TB_05s,         
82         TB_02s,         
83         TB_01s,         
84         TB_50ms,        
85         TB_20ms,        
86         TB_10ms,        
87         TB_5ms,         
88         TB_2ms,         
89         TB_1ms,         
90         TB_05ms,        
91         TB_02ms,        
92         TB_01ms,        
93         TB_50us,        
94         TB_20us,        
95         TB_10us,        
96         TB_5us,         
97         TB_2us,         
98         TB_1us,         
99         TB_05us,        
100         TB_02us,
101         TB_01us,
102         TB_50ns,
103         TB_20ns,
104         TB_10ns,
105 //      TB_max
106         };
107
108 // -- Trig Mode type
109 enum TrigMode   {
110         TM_Auto,
111         TM_Normal,
112         TM_Single,
113         TM_Max
114         };
115
116
117 // -- Trig Edge type
118 enum TrigEdge {
119         TE_Falling,
120         TE_Rising,
121         };
122
123 // -- V sensitivity type
124 typedef enum    {
125         VS_UnCal                = 0,
126         VS_50V,
127         VS_20V,
128         VS_10V,
129         VS_5V,
130         VS_2V,
131         VS_1V,
132         VS_05V,
133         VS_02V,
134         VS_01V,
135         VS_50mV,
136         VS_20mV,
137         VS_10mV,
138         VS_5mV,
139         VS_Last
140         }TY_VSen ;
141
142 // -- Coupling type
143 enum    Couple{
144         CP_DC,
145         CP_AC,
146         CP_GND
147         };
148
149 enum FocusType {
150         FC_Timebase     = 0,
151         FC_TrigMode,
152         FC_TrigEdge,
153         FC_TrigLvl,
154         FC_HPos,
155         FC_VPos,
156         FC_Max
157
158 };
159
160
161 enum DsoStatus {
162         DSO_CaptureDone                 = 0x0001,
163         DSO_Trigged                     = 0x0002,
164         DSO_Hold                                = 0x0004,
165         DSO_Rolling                             = 0x0008,
166         DSO_NormalDisplay               = 0x0080,
167 };
168
169 enum DispUpdateFlags {
170         Disp_Panel              = 0x0001,
171         Disp_Param              = 0x0002,
172         Disp_Trace              = 0x0004,
173 };
174
175 // =====================================
176 // Exported variables
177 //
178 extern  U16     *SampleBuf;
179 extern  U16     *CurrentSample;
180 extern  U8      LibVersion[];
181 extern  U8      NoScopePanel;
182
183
184
185 // -- Function Prototypes --
186 void    DSO_Init(void);
187 void    StartCapture(void);
188 void    StopCapture(void);
189 U16     GetDsoStatus(void);
190 void    SetHold(void);
191 void    ClrHold(void);
192 void    UpdateTimebase(void);
193
194 S8      SetVSen(S8 vsen);
195 S8      SetCpl(S8 cpl);
196 S16     SetVPos(S16 vpos);
197 S8      SetTimeBase(S8 timebase);
198 S16     SetHPos(S16 hpos);
199 S8      SetTrigMode(S8 trigmode);
200 S8      SetTrigEdge(S8 trigslope);
201 S16 SetTrigLvl(S16 triglvl);
202 U16     SetRecLen(U16 reclen);
203 S16     SetVPosOfs(S16 ofs);
204
205 S8      GetVSen(void);
206 S8      GetCpl(void);
207 S16     GetVPos(void);
208 S8      GetTimebase(void);
209 S16     GetHPos(void);
210 S8      GetTrigMode(void);
211 S8      GetTrigEdge(void);
212 S16     GetTrigLvl(void);
213 U16     GetRecLen(void);
214 S16     GetVPosOfs(void);
215
216 void    DsoDisplay(void);
217 void    UpdateDisp(U16 disp);
218 void Rolling(void);
219 U8      SetFocus(U8 focus);
220 U8      GetFocus(void);
221
222 S16     GetAverage(void);
223
224 #endif
225