digilent-waveforms 0.0.10

Bindings for Digilent Waveforms API
Documentation
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
/************************************************************************/
/*                                                                      */
/*    dwf.h  --    Public Interface Declarations for DWF.DLL            */
/*                                                                      */
/************************************************************************/
/*    Author: Laszlo Attila Kovacs                                      */
/*    Copyright 2013 Digilent Inc.                                      */
/************************************************************************/
/*  File Description:                                                   */
/*                                                                      */
/*    This header file contains the public interface declarations for   */
/*    the DWF.DLL.  This interface consists of  hardware device         */
/*    enumeration, connection (open/close), and hardware instrument     */
/*    control.  This spans all 4 main instruments  supported by the     */
/*    WaveForms system:                                                 */
/*      Analog In, Analog Out, Analog I/O, and Digital I/O              */
/*                                                                      */
/*    For details on using this interface, refer to:                    */
/*    The WaveForms SDK User's Manual (available in the WaveForms SDK)  */
/*                                                                      */
/************************************************************************/
/*  Revision History:                                                   */
/*                                                                      */
/*  06/6/2009(KovacsLA) : Created                                       */
/*                                                                      */
/************************************************************************/


#pragma once

#ifndef DWFINC
#define DWFINC TRUE

#ifndef DWFAPI
#if defined(WIN32)
#if defined(__cplusplus)
            #define    DWFAPI extern "C" __declspec(dllimport)
        #else
            #define    DWFAPI __declspec(dllimport)
        #endif
#else
#if defined(__cplusplus)
#define DWFAPI extern "C"
#else
#define DWFAPI
#endif
#endif
#endif

#ifndef BOOL
typedef int BOOL;
#endif

#ifndef BYTE
typedef	unsigned char	BYTE;
#endif

// hardware device handle
typedef int HDWF;
const HDWF hdwfNone = 0;

// device enumeration filters
typedef int ENUMFILTER;
const ENUMFILTER enumfilterAll          = 0;
const ENUMFILTER enumfilterEExplorer    = 1;
const ENUMFILTER enumfilterDiscovery    = 2;
const ENUMFILTER enumfilterDiscovery2   = 3;
const ENUMFILTER enumfilterDDiscovery   = 4;

// device ID
typedef int DEVID;
const DEVID devidEExplorer  = 1;
const DEVID devidDiscovery  = 2;
const DEVID devidDiscovery2 = 3;
const DEVID devidDDiscovery = 4;

// device version
typedef int DEVVER;
const DEVVER devverEExplorerC   = 2;
const DEVVER devverEExplorerE   = 4;
const DEVVER devverEExplorerF   = 5;
const DEVVER devverDiscoveryA   = 1;
const DEVVER devverDiscoveryB   = 2;
const DEVVER devverDiscoveryC   = 3;

// trigger source
typedef BYTE TRIGSRC;
const TRIGSRC trigsrcNone               = 0;
const TRIGSRC trigsrcPC                 = 1;
const TRIGSRC trigsrcDetectorAnalogIn   = 2;
const TRIGSRC trigsrcDetectorDigitalIn  = 3;
const TRIGSRC trigsrcAnalogIn           = 4;
const TRIGSRC trigsrcDigitalIn          = 5;
const TRIGSRC trigsrcDigitalOut         = 6;
const TRIGSRC trigsrcAnalogOut1         = 7;
const TRIGSRC trigsrcAnalogOut2         = 8;
const TRIGSRC trigsrcAnalogOut3         = 9;
const TRIGSRC trigsrcAnalogOut4         = 10;
const TRIGSRC trigsrcExternal1          = 11;
const TRIGSRC trigsrcExternal2          = 12;
const TRIGSRC trigsrcExternal3          = 13;
const TRIGSRC trigsrcExternal4          = 14;
const TRIGSRC trigsrcHigh               = 15;
const TRIGSRC trigsrcLow                = 16;

// instrument states:
typedef BYTE DwfState;
const DwfState DwfStateReady        = 0;
const DwfState DwfStateConfig       = 4;
const DwfState DwfStatePrefill      = 5;
const DwfState DwfStateArmed        = 1;
const DwfState DwfStateWait         = 7;
const DwfState DwfStateTriggered    = 3;
const DwfState DwfStateRunning      = 3;
const DwfState DwfStateDone         = 2;

//
typedef int DwfEnumConfigInfo;
const DwfEnumConfigInfo DECIAnalogInChannelCount = 1;
const DwfEnumConfigInfo DECIAnalogOutChannelCount = 2;
const DwfEnumConfigInfo DECIAnalogIOChannelCount = 3;
const DwfEnumConfigInfo DECIDigitalInChannelCount = 4;
const DwfEnumConfigInfo DECIDigitalOutChannelCount = 5;
const DwfEnumConfigInfo DECIDigitalIOChannelCount = 6;
const DwfEnumConfigInfo DECIAnalogInBufferSize = 7;
const DwfEnumConfigInfo DECIAnalogOutBufferSize = 8;
const DwfEnumConfigInfo DECIDigitalInBufferSize = 9;
const DwfEnumConfigInfo DECIDigitalOutBufferSize = 10;

// acquisition modes:
typedef int ACQMODE;
const ACQMODE acqmodeSingle     = 0;
const ACQMODE acqmodeScanShift  = 1;
const ACQMODE acqmodeScanScreen = 2;
const ACQMODE acqmodeRecord     = 3;
const ACQMODE acqmodeOvers      = 4;
const ACQMODE acqmodeSingle1    = 5;

// analog acquisition filter:
typedef int FILTER;
const FILTER filterDecimate = 0;
const FILTER filterAverage  = 1;
const FILTER filterMinMax   = 2;

// analog acquisition filter:
typedef int DwfTriggerSlope;
const DwfTriggerSlope DwfTriggerSlopeRise   = 0;
const DwfTriggerSlope DwfTriggerSlopeFall   = 1;
const DwfTriggerSlope DwfTriggerSlopeEither = 2;

// analog in trigger mode:
typedef int TRIGTYPE;
const TRIGTYPE trigtypeEdge         = 0;
const TRIGTYPE trigtypePulse        = 1;
const TRIGTYPE trigtypeTransition   = 2;

// analog in trigger length condition
typedef int TRIGLEN;
const TRIGLEN triglenLess       = 0;
const TRIGLEN triglenTimeout    = 1;
const TRIGLEN triglenMore       = 2;

// error codes for DWF Public API:
typedef int DWFERC;
const   DWFERC dwfercNoErc                  = 0;        //  No error occurred
const   DWFERC dwfercUnknownError           = 1;        //  API waiting on pending API timed out
const   DWFERC dwfercApiLockTimeout         = 2;        //  API waiting on pending API timed out
const   DWFERC dwfercAlreadyOpened          = 3;        //  Device already opened
const   DWFERC dwfercNotSupported           = 4;        //  Device not supported
const   DWFERC dwfercInvalidParameter0      = 0x10;     //  Invalid parameter sent in API call
const   DWFERC dwfercInvalidParameter1      = 0x11;     //  Invalid parameter sent in API call
const   DWFERC dwfercInvalidParameter2      = 0x12;     //  Invalid parameter sent in API call
const   DWFERC dwfercInvalidParameter3      = 0x13;     //  Invalid parameter sent in API call
const   DWFERC dwfercInvalidParameter4      = 0x14;     //  Invalid parameter sent in API call

// analog out signal types
typedef BYTE FUNC;
const FUNC funcDC       = 0;
const FUNC funcSine     = 1;
const FUNC funcSquare   = 2;
const FUNC funcTriangle = 3;
const FUNC funcRampUp   = 4;
const FUNC funcRampDown = 5;
const FUNC funcNoise    = 6;
const FUNC funcPulse    = 7;
const FUNC funcTrapezium= 8;
const FUNC funcSinePower= 9;
const FUNC funcCustom   = 30;
const FUNC funcPlay     = 31;

// analog io channel node types
typedef BYTE ANALOGIO;
const ANALOGIO analogioEnable       = 1;
const ANALOGIO analogioVoltage      = 2;
const ANALOGIO analogioCurrent      = 3;
const ANALOGIO analogioPower        = 4;
const ANALOGIO analogioTemperature  = 5;

typedef int AnalogOutNode;
const AnalogOutNode AnalogOutNodeCarrier  = 0;
const AnalogOutNode AnalogOutNodeFM       = 1;
const AnalogOutNode AnalogOutNodeAM       = 2;

typedef int DwfAnalogOutMode;
const DwfAnalogOutMode DwfAnalogOutModeVoltage  = 0;
const DwfAnalogOutMode DwfAnalogOutModeCurrent  = 1;

typedef int DwfAnalogOutIdle;
const DwfAnalogOutIdle DwfAnalogOutIdleDisable  = 0;
const DwfAnalogOutIdle DwfAnalogOutIdleOffset   = 1;
const DwfAnalogOutIdle DwfAnalogOutIdleInitial  = 2;

typedef int DwfDigitalInClockSource;
const DwfDigitalInClockSource DwfDigitalInClockSourceInternal = 0;
const DwfDigitalInClockSource DwfDigitalInClockSourceExternal = 1;

typedef int DwfDigitalInSampleMode;
const DwfDigitalInSampleMode DwfDigitalInSampleModeSimple   = 0;
// alternate samples: noise|sample|noise|sample|...
// where noise is more than 1 transition between 2 samples
const DwfDigitalInSampleMode DwfDigitalInSampleModeNoise    = 1;

typedef int DwfDigitalOutOutput;
const DwfDigitalOutOutput DwfDigitalOutOutputPushPull   = 0;
const DwfDigitalOutOutput DwfDigitalOutOutputOpenDrain  = 1;
const DwfDigitalOutOutput DwfDigitalOutOutputOpenSource = 2;
const DwfDigitalOutOutput DwfDigitalOutOutputThreeState = 3; // for custom and random

typedef int DwfDigitalOutType;
const DwfDigitalOutType DwfDigitalOutTypePulse      = 0;
const DwfDigitalOutType DwfDigitalOutTypeCustom     = 1;
const DwfDigitalOutType DwfDigitalOutTypeRandom     = 2;
const DwfDigitalOutType DwfDigitalOutTypeROM        = 3;
const DwfDigitalOutType DwfDigitalOutTypeFSM        = 3;

typedef int DwfDigitalOutIdle;
const DwfDigitalOutIdle DwfDigitalOutIdleInit     = 0;
const DwfDigitalOutIdle DwfDigitalOutIdleLow      = 1;
const DwfDigitalOutIdle DwfDigitalOutIdleHigh     = 2;
const DwfDigitalOutIdle DwfDigitalOutIdleZet      = 3;

typedef int DwfParam;
const DwfParam DwfParamUsbPower        = 2; // 1 keep the USB power enabled even when AUX is connected, Analog Discovery 2
const DwfParam DwfParamLedBrightness   = 3; // LED brightness 0 ... 100%, Digital Discovery
const DwfParam DwfParamOnClose         = 4; // 0 run, 1 stop, 2 shutdown
const DwfParam DwfParamAudioOut        = 5; // 0 disable / 1 enable audio output, Analog Discovery 1, 2
const DwfParam DwfParamUsbLimit        = 6; // 0..1000 mA USB power limit, -1 no limit, Analog Discovery 1, 2

// Macro used to verify if bit is 1 or 0 in given bit field
#define IsBitSet(fs, bit) ((fs & (1<<bit)) != 0)

// Error and version APIs:
DWFAPI BOOL FDwfGetLastError(DWFERC *pdwferc);
DWFAPI BOOL FDwfGetLastErrorMsg(char szError[512]);
DWFAPI BOOL FDwfGetVersion(char szVersion[32]);  // Returns DLL version, for instance: "3.8.5"

DWFAPI BOOL FDwfParamSet(DwfParam param, int value);
DWFAPI BOOL FDwfParamGet(DwfParam param, int *pvalue);

// DEVICE MANAGMENT FUNCTIONS
// Enumeration:
DWFAPI BOOL FDwfEnum(ENUMFILTER enumfilter, int *pcDevice);
DWFAPI BOOL FDwfEnumDeviceType(int idxDevice, DEVID *pDeviceId, DEVVER *pDeviceRevision);
DWFAPI BOOL FDwfEnumDeviceIsOpened(int idxDevice, BOOL *pfIsUsed);
DWFAPI BOOL FDwfEnumUserName(int idxDevice, char szUserName[32]);
DWFAPI BOOL FDwfEnumDeviceName(int idxDevice, char szDeviceName[32]);
DWFAPI BOOL FDwfEnumSN(int idxDevice, char szSN[32]);
DWFAPI BOOL FDwfEnumConfig(int idxDevice, int *pcConfig);
DWFAPI BOOL FDwfEnumConfigInfo(int idxConfig, DwfEnumConfigInfo info, int *pv);

// Open/Close:
DWFAPI BOOL FDwfDeviceOpen(int idxDevice, HDWF *phdwf);
DWFAPI BOOL FDwfDeviceConfigOpen(int idxDev, int idxCfg, HDWF *phdwf);
DWFAPI BOOL FDwfDeviceClose(HDWF hdwf);
DWFAPI BOOL FDwfDeviceCloseAll();
DWFAPI BOOL FDwfDeviceAutoConfigureSet(HDWF hdwf, BOOL fAutoConfigure);
DWFAPI BOOL FDwfDeviceAutoConfigureGet(HDWF hdwf, BOOL *pfAutoConfigure);
DWFAPI BOOL FDwfDeviceReset(HDWF hdwf);
DWFAPI BOOL FDwfDeviceEnableSet(HDWF hdwf, BOOL fEnable);
DWFAPI BOOL FDwfDeviceTriggerInfo(HDWF hdwf, int *pfstrigsrc); // use IsBitSet
DWFAPI BOOL FDwfDeviceTriggerSet(HDWF hdwf, int idxPin, TRIGSRC trigsrc);
DWFAPI BOOL FDwfDeviceTriggerGet(HDWF hdwf, int idxPin, TRIGSRC *ptrigsrc);
DWFAPI BOOL FDwfDeviceTriggerPC(HDWF hdwf);
DWFAPI BOOL FDwfDeviceTriggerSlopeInfo(HDWF hdwf, int *pfsslope); // use IsBitSet
DWFAPI BOOL FDwfDeviceParamSet(HDWF hdwf, DwfParam param, int value);
DWFAPI BOOL FDwfDeviceParamGet(HDWF hdwf, DwfParam param, int *pvalue);


// ANALOG IN INSTRUMENT FUNCTIONS
// Control and status:
DWFAPI BOOL FDwfAnalogInReset(HDWF hdwf);
DWFAPI BOOL FDwfAnalogInConfigure(HDWF hdwf, BOOL fReconfigure, BOOL fStart);
DWFAPI BOOL FDwfAnalogInTriggerForce(HDWF hdwf);
DWFAPI BOOL FDwfAnalogInStatus(HDWF hdwf, BOOL fReadData, DwfState *psts);
DWFAPI BOOL FDwfAnalogInStatusSamplesLeft(HDWF hdwf, int *pcSamplesLeft);
DWFAPI BOOL FDwfAnalogInStatusSamplesValid(HDWF hdwf, int *pcSamplesValid);
DWFAPI BOOL FDwfAnalogInStatusIndexWrite(HDWF hdwf, int *pidxWrite);
DWFAPI BOOL FDwfAnalogInStatusAutoTriggered(HDWF hdwf, BOOL *pfAuto);
DWFAPI BOOL FDwfAnalogInStatusData(HDWF hdwf, int idxChannel, double *rgdVoltData, int cdData);
DWFAPI BOOL FDwfAnalogInStatusData2(HDWF hdwf, int idxChannel, double *rgdVoltData, int idxData, int cdData);
DWFAPI BOOL FDwfAnalogInStatusData16(HDWF hdwf, int idxChannel, short *rgu16Data, int idxData, int cdData);
DWFAPI BOOL FDwfAnalogInStatusNoise(HDWF hdwf, int idxChannel, double *rgdMin, double *rgdMax, int cdData);
DWFAPI BOOL FDwfAnalogInStatusNoise2(HDWF hdwf, int idxChannel, double *rgdMin, double *rgdMax, int idxData, int cdData);
DWFAPI BOOL FDwfAnalogInStatusSample(HDWF hdwf, int idxChannel, double *pdVoltSample);

DWFAPI BOOL FDwfAnalogInStatusRecord(HDWF hdwf, int *pcdDataAvailable, int *pcdDataLost, int *pcdDataCorrupt);
DWFAPI BOOL FDwfAnalogInRecordLengthSet(HDWF hdwf, double sLegth);
DWFAPI BOOL FDwfAnalogInRecordLengthGet(HDWF hdwf, double *psLegth);

// Acquisition configuration:
DWFAPI BOOL FDwfAnalogInFrequencyInfo(HDWF hdwf, double *phzMin, double *phzMax);
DWFAPI BOOL FDwfAnalogInFrequencySet(HDWF hdwf, double hzFrequency);
DWFAPI BOOL FDwfAnalogInFrequencyGet(HDWF hdwf, double *phzFrequency);

DWFAPI BOOL FDwfAnalogInBitsInfo(HDWF hdwf, int *pnBits); // Returns the number of ADC bits

DWFAPI BOOL FDwfAnalogInBufferSizeInfo(HDWF hdwf, int *pnSizeMin, int *pnSizeMax);
DWFAPI BOOL FDwfAnalogInBufferSizeSet(HDWF hdwf, int nSize);
DWFAPI BOOL FDwfAnalogInBufferSizeGet(HDWF hdwf, int *pnSize);

DWFAPI BOOL FDwfAnalogInNoiseSizeInfo(HDWF hdwf, int *pnSizeMax);
DWFAPI BOOL FDwfAnalogInNoiseSizeSet(HDWF hdwf, int nSize);
DWFAPI BOOL FDwfAnalogInNoiseSizeGet(HDWF hdwf, int *pnSize);

DWFAPI BOOL FDwfAnalogInAcquisitionModeInfo(HDWF hdwf, int *pfsacqmode); // use IsBitSet
DWFAPI BOOL FDwfAnalogInAcquisitionModeSet(HDWF hdwf, ACQMODE acqmode);
DWFAPI BOOL FDwfAnalogInAcquisitionModeGet(HDWF hdwf, ACQMODE *pacqmode);

// Channel configuration:
DWFAPI BOOL FDwfAnalogInChannelCount(HDWF hdwf, int *pcChannel);
DWFAPI BOOL FDwfAnalogInChannelEnableSet(HDWF hdwf, int idxChannel, BOOL fEnable);
DWFAPI BOOL FDwfAnalogInChannelEnableGet(HDWF hdwf, int idxChannel, BOOL *pfEnable);
DWFAPI BOOL FDwfAnalogInChannelFilterInfo(HDWF hdwf, int *pfsfilter); // use IsBitSet
DWFAPI BOOL FDwfAnalogInChannelFilterSet(HDWF hdwf, int idxChannel, FILTER filter);
DWFAPI BOOL FDwfAnalogInChannelFilterGet(HDWF hdwf, int idxChannel, FILTER *pfilter);
DWFAPI BOOL FDwfAnalogInChannelRangeInfo(HDWF hdwf, double *pvoltsMin, double *pvoltsMax, double *pnSteps);
DWFAPI BOOL FDwfAnalogInChannelRangeSteps(HDWF hdwf, double rgVoltsStep[32], int *pnSteps);
DWFAPI BOOL FDwfAnalogInChannelRangeSet(HDWF hdwf, int idxChannel, double voltsRange);
DWFAPI BOOL FDwfAnalogInChannelRangeGet(HDWF hdwf, int idxChannel, double *pvoltsRange);
DWFAPI BOOL FDwfAnalogInChannelOffsetInfo(HDWF hdwf, double *pvoltsMin, double *pvoltsMax, double *pnSteps);
DWFAPI BOOL FDwfAnalogInChannelOffsetSet(HDWF hdwf, int idxChannel, double voltOffset);
DWFAPI BOOL FDwfAnalogInChannelOffsetGet(HDWF hdwf, int idxChannel, double *pvoltOffset);
DWFAPI BOOL FDwfAnalogInChannelAttenuationSet(HDWF hdwf, int idxChannel, double xAttenuation);
DWFAPI BOOL FDwfAnalogInChannelAttenuationGet(HDWF hdwf, int idxChannel, double *pxAttenuation);

// Trigger configuration:
DWFAPI BOOL FDwfAnalogInTriggerSourceSet(HDWF hdwf, TRIGSRC trigsrc);
DWFAPI BOOL FDwfAnalogInTriggerSourceGet(HDWF hdwf, TRIGSRC *ptrigsrc);

DWFAPI BOOL FDwfAnalogInTriggerPositionInfo(HDWF hdwf, double *psecMin, double *psecMax, double *pnSteps);
DWFAPI BOOL FDwfAnalogInTriggerPositionSet(HDWF hdwf, double secPosition);
DWFAPI BOOL FDwfAnalogInTriggerPositionGet(HDWF hdwf, double *psecPosition);
DWFAPI BOOL FDwfAnalogInTriggerPositionStatus(HDWF hdwf, double *psecPosition);

DWFAPI BOOL FDwfAnalogInTriggerAutoTimeoutInfo(HDWF hdwf, double *psecMin, double *psecMax, double *pnSteps);
DWFAPI BOOL FDwfAnalogInTriggerAutoTimeoutSet(HDWF hdwf, double secTimeout);
DWFAPI BOOL FDwfAnalogInTriggerAutoTimeoutGet(HDWF hdwf, double *psecTimeout);

DWFAPI BOOL FDwfAnalogInTriggerHoldOffInfo(HDWF hdwf, double *psecMin, double *psecMax, double *pnStep);
DWFAPI BOOL FDwfAnalogInTriggerHoldOffSet(HDWF hdwf, double secHoldOff);
DWFAPI BOOL FDwfAnalogInTriggerHoldOffGet(HDWF hdwf, double *psecHoldOff);

DWFAPI BOOL FDwfAnalogInTriggerTypeInfo(HDWF hdwf, int *pfstrigtype); // use IsBitSet
DWFAPI BOOL FDwfAnalogInTriggerTypeSet(HDWF hdwf, TRIGTYPE trigtype);
DWFAPI BOOL FDwfAnalogInTriggerTypeGet(HDWF hdwf, TRIGTYPE *ptrigtype);

DWFAPI BOOL FDwfAnalogInTriggerChannelInfo(HDWF hdwf, int *pidxMin, int *pidxMax);
DWFAPI BOOL FDwfAnalogInTriggerChannelSet(HDWF hdwf, int idxChannel);
DWFAPI BOOL FDwfAnalogInTriggerChannelGet(HDWF hdwf, int *pidxChannel);

DWFAPI BOOL FDwfAnalogInTriggerFilterInfo(HDWF hdwf, int *pfsfilter); // use IsBitSet
DWFAPI BOOL FDwfAnalogInTriggerFilterSet(HDWF hdwf, FILTER filter);
DWFAPI BOOL FDwfAnalogInTriggerFilterGet(HDWF hdwf, FILTER *pfilter);

DWFAPI BOOL FDwfAnalogInTriggerLevelInfo(HDWF hdwf, double *pvoltsMin, double *pvoltsMax, double *pnSteps);
DWFAPI BOOL FDwfAnalogInTriggerLevelSet(HDWF hdwf, double voltsLevel);
DWFAPI BOOL FDwfAnalogInTriggerLevelGet(HDWF hdwf, double *pvoltsLevel);

DWFAPI BOOL FDwfAnalogInTriggerHysteresisInfo(HDWF hdwf, double *pvoltsMin, double *pvoltsMax, double *pnSteps);
DWFAPI BOOL FDwfAnalogInTriggerHysteresisSet(HDWF hdwf, double voltsLevel);
DWFAPI BOOL FDwfAnalogInTriggerHysteresisGet(HDWF hdwf, double *pvoltsHysteresis);

DWFAPI BOOL FDwfAnalogInTriggerConditionInfo(HDWF hdwf, int *pfstrigcond); // use IsBitSet
DWFAPI BOOL FDwfAnalogInTriggerConditionSet(HDWF hdwf, DwfTriggerSlope trigcond);
DWFAPI BOOL FDwfAnalogInTriggerConditionGet(HDWF hdwf, DwfTriggerSlope *ptrigcond);

DWFAPI BOOL FDwfAnalogInTriggerLengthInfo(HDWF hdwf, double *psecMin, double *psecMax, double *pnSteps);
DWFAPI BOOL FDwfAnalogInTriggerLengthSet(HDWF hdwf, double secLength);
DWFAPI BOOL FDwfAnalogInTriggerLengthGet(HDWF hdwf, double *psecLength);

DWFAPI BOOL FDwfAnalogInTriggerLengthConditionInfo(HDWF hdwf, int *pfstriglen); // use IsBitSet
DWFAPI BOOL FDwfAnalogInTriggerLengthConditionSet(HDWF hdwf, TRIGLEN triglen);
DWFAPI BOOL FDwfAnalogInTriggerLengthConditionGet(HDWF hdwf, TRIGLEN *ptriglen);

DWFAPI BOOL FDwfAnalogInSamplingSourceSet(HDWF hdwf, TRIGSRC trigsrc);
DWFAPI BOOL FDwfAnalogInSamplingSourceGet(HDWF hdwf, TRIGSRC *ptrigsrc);

DWFAPI BOOL FDwfAnalogInSamplingSlopeSet(HDWF hdwf, DwfTriggerSlope slope);
DWFAPI BOOL FDwfAnalogInSamplingSlopeGet(HDWF hdwf, DwfTriggerSlope *pslope);

DWFAPI BOOL FDwfAnalogInSamplingDelaySet(HDWF hdwf, double sec);
DWFAPI BOOL FDwfAnalogInSamplingDelayGet(HDWF hdwf, double *psec);


// ANALOG OUT INSTRUMENT FUNCTIONS
// Configuration:
DWFAPI BOOL FDwfAnalogOutCount(HDWF hdwf, int *pcChannel);

DWFAPI BOOL FDwfAnalogOutMasterSet(HDWF hdwf, int idxChannel, int idxMaster);
DWFAPI BOOL FDwfAnalogOutMasterGet(HDWF hdwf, int idxChannel, int *pidxMaster);

DWFAPI BOOL FDwfAnalogOutTriggerSourceSet(HDWF hdwf, int idxChannel, TRIGSRC trigsrc);
DWFAPI BOOL FDwfAnalogOutTriggerSourceGet(HDWF hdwf, int idxChannel, TRIGSRC *ptrigsrc);

DWFAPI BOOL FDwfAnalogOutTriggerSlopeSet(HDWF hdwf, int idxChannel, DwfTriggerSlope slope);
DWFAPI BOOL FDwfAnalogOutTriggerSlopeGet(HDWF hdwf, int idxChannel, DwfTriggerSlope *pslope);

DWFAPI BOOL FDwfAnalogOutRunInfo(HDWF hdwf, int idxChannel, double *psecMin, double *psecMax);
DWFAPI BOOL FDwfAnalogOutRunSet(HDWF hdwf, int idxChannel, double secRun);
DWFAPI BOOL FDwfAnalogOutRunGet(HDWF hdwf, int idxChannel, double *psecRun);
DWFAPI BOOL FDwfAnalogOutRunStatus(HDWF hdwf, int idxChannel, double *psecRun);

DWFAPI BOOL FDwfAnalogOutWaitInfo(HDWF hdwf, int idxChannel, double *psecMin, double *psecMax);
DWFAPI BOOL FDwfAnalogOutWaitSet(HDWF hdwf, int idxChannel, double secWait);
DWFAPI BOOL FDwfAnalogOutWaitGet(HDWF hdwf, int idxChannel, double *psecWait);

DWFAPI BOOL FDwfAnalogOutRepeatInfo(HDWF hdwf, int idxChannel, int *pnMin, int *pnMax);
DWFAPI BOOL FDwfAnalogOutRepeatSet(HDWF hdwf, int idxChannel, int cRepeat);
DWFAPI BOOL FDwfAnalogOutRepeatGet(HDWF hdwf, int idxChannel, int *pcRepeat);
DWFAPI BOOL FDwfAnalogOutRepeatStatus(HDWF hdwf, int idxChannel, int *pcRepeat);

DWFAPI BOOL FDwfAnalogOutRepeatTriggerSet(HDWF hdwf, int idxChannel, BOOL fRepeatTrigger);
DWFAPI BOOL FDwfAnalogOutRepeatTriggerGet(HDWF hdwf, int idxChannel, BOOL *pfRepeatTrigger);

// EExplorer channel 3&4 current/voltage limitation
DWFAPI BOOL FDwfAnalogOutLimitationInfo(HDWF hdwf, int idxChannel, double *pMin, double *pMax);
DWFAPI BOOL FDwfAnalogOutLimitationSet(HDWF hdwf, int idxChannel, double limit);
DWFAPI BOOL FDwfAnalogOutLimitationGet(HDWF hdwf, int idxChannel, double *plimit);

DWFAPI BOOL FDwfAnalogOutModeSet(HDWF hdwf, int idxChannel, DwfAnalogOutMode mode);
DWFAPI BOOL FDwfAnalogOutModeGet(HDWF hdwf, int idxChannel, DwfAnalogOutMode *pmode);

DWFAPI BOOL FDwfAnalogOutIdleInfo(HDWF hdwf, int idxChannel, int *pfsidle);
DWFAPI BOOL FDwfAnalogOutIdleSet(HDWF hdwf, int idxChannel, DwfAnalogOutIdle idle);
DWFAPI BOOL FDwfAnalogOutIdleGet(HDWF hdwf, int idxChannel, DwfAnalogOutIdle *pidle);

DWFAPI BOOL FDwfAnalogOutNodeInfo(HDWF hdwf, int idxChannel, int *pfsnode); // use IsBitSet

DWFAPI BOOL FDwfAnalogOutNodeEnableSet(HDWF hdwf, int idxChannel, AnalogOutNode node, BOOL fEnable);
DWFAPI BOOL FDwfAnalogOutNodeEnableGet(HDWF hdwf, int idxChannel, AnalogOutNode node, BOOL *pfEnable);

DWFAPI BOOL FDwfAnalogOutNodeFunctionInfo(HDWF hdwf, int idxChannel, AnalogOutNode node, int *pfsfunc); // use IsBitSet
DWFAPI BOOL FDwfAnalogOutNodeFunctionSet(HDWF hdwf, int idxChannel, AnalogOutNode node, FUNC func);
DWFAPI BOOL FDwfAnalogOutNodeFunctionGet(HDWF hdwf, int idxChannel, AnalogOutNode node, FUNC *pfunc);

DWFAPI BOOL FDwfAnalogOutNodeFrequencyInfo(HDWF hdwf, int idxChannel, AnalogOutNode node, double *phzMin, double *phzMax);
DWFAPI BOOL FDwfAnalogOutNodeFrequencySet(HDWF hdwf, int idxChannel, AnalogOutNode node, double hzFrequency);
DWFAPI BOOL FDwfAnalogOutNodeFrequencyGet(HDWF hdwf, int idxChannel, AnalogOutNode node, double *phzFrequency);
// Carrier Amplitude or Modulation Index
DWFAPI BOOL FDwfAnalogOutNodeAmplitudeInfo(HDWF hdwf, int idxChannel, AnalogOutNode node, double *pMin, double *pMax);
DWFAPI BOOL FDwfAnalogOutNodeAmplitudeSet(HDWF hdwf, int idxChannel, AnalogOutNode node, double vAmplitude);
DWFAPI BOOL FDwfAnalogOutNodeAmplitudeGet(HDWF hdwf, int idxChannel, AnalogOutNode node, double *pvAmplitude);

DWFAPI BOOL FDwfAnalogOutNodeOffsetInfo(HDWF hdwf, int idxChannel, AnalogOutNode node, double *pMin, double *pMax);
DWFAPI BOOL FDwfAnalogOutNodeOffsetSet(HDWF hdwf, int idxChannel, AnalogOutNode node, double vOffset);
DWFAPI BOOL FDwfAnalogOutNodeOffsetGet(HDWF hdwf, int idxChannel, AnalogOutNode node, double *pvOffset);

DWFAPI BOOL FDwfAnalogOutNodeSymmetryInfo(HDWF hdwf, int idxChannel, AnalogOutNode node, double *ppercentageMin, double *ppercentageMax);
DWFAPI BOOL FDwfAnalogOutNodeSymmetrySet(HDWF hdwf, int idxChannel, AnalogOutNode node, double percentageSymmetry);
DWFAPI BOOL FDwfAnalogOutNodeSymmetryGet(HDWF hdwf, int idxChannel, AnalogOutNode node, double *ppercentageSymmetry);

DWFAPI BOOL FDwfAnalogOutNodePhaseInfo(HDWF hdwf, int idxChannel, AnalogOutNode node, double *pdegreeMin, double *pdegreeMax);
DWFAPI BOOL FDwfAnalogOutNodePhaseSet(HDWF hdwf, int idxChannel, AnalogOutNode node, double degreePhase);
DWFAPI BOOL FDwfAnalogOutNodePhaseGet(HDWF hdwf, int idxChannel, AnalogOutNode node, double *pdegreePhase);

DWFAPI BOOL FDwfAnalogOutNodeDataInfo(HDWF hdwf, int idxChannel, AnalogOutNode node, int *pnSamplesMin, int *pnSamplesMax);
DWFAPI BOOL FDwfAnalogOutNodeDataSet(HDWF hdwf, int idxChannel, AnalogOutNode node, double *rgdData, int cdData);

// needed for EExplorer, not used for ADiscovery
DWFAPI BOOL FDwfAnalogOutCustomAMFMEnableSet(HDWF hdwf, int idxChannel, BOOL fEnable);
DWFAPI BOOL FDwfAnalogOutCustomAMFMEnableGet(HDWF hdwf, int idxChannel, BOOL *pfEnable);

// Control:
DWFAPI BOOL FDwfAnalogOutReset(HDWF hdwf, int idxChannel);
DWFAPI BOOL FDwfAnalogOutConfigure(HDWF hdwf, int idxChannel, BOOL fStart);
DWFAPI BOOL FDwfAnalogOutStatus(HDWF hdwf, int idxChannel, DwfState *psts);
DWFAPI BOOL FDwfAnalogOutNodePlayStatus(HDWF hdwf, int idxChannel, AnalogOutNode node, int *cdDataFree, int *cdDataLost, int *cdDataCorrupted);
DWFAPI BOOL FDwfAnalogOutNodePlayData(HDWF hdwf, int idxChannel, AnalogOutNode node, double *rgdData, int cdData);


// ANALOG IO INSTRUMENT FUNCTIONS
// Control:
DWFAPI BOOL FDwfAnalogIOReset(HDWF hdwf);
DWFAPI BOOL FDwfAnalogIOConfigure(HDWF hdwf);
DWFAPI BOOL FDwfAnalogIOStatus(HDWF hdwf);

// Configure:
DWFAPI BOOL FDwfAnalogIOEnableInfo(HDWF hdwf, BOOL *pfSet, BOOL *pfStatus);
DWFAPI BOOL FDwfAnalogIOEnableSet(HDWF hdwf, BOOL fMasterEnable);
DWFAPI BOOL FDwfAnalogIOEnableGet(HDWF hdwf, BOOL *pfMasterEnable);
DWFAPI BOOL FDwfAnalogIOEnableStatus(HDWF hdwf, BOOL *pfMasterEnable);
DWFAPI BOOL FDwfAnalogIOChannelCount(HDWF hdwf, int *pnChannel);
DWFAPI BOOL FDwfAnalogIOChannelName(HDWF hdwf, int idxChannel, char szName[32], char szLabel[16]);
DWFAPI BOOL FDwfAnalogIOChannelInfo(HDWF hdwf, int idxChannel, int *pnNodes);
DWFAPI BOOL FDwfAnalogIOChannelNodeName(HDWF hdwf, int idxChannel, int idxNode, char szNodeName[32], char szNodeUnits[16]);
DWFAPI BOOL FDwfAnalogIOChannelNodeInfo(HDWF hdwf, int idxChannel, int idxNode, ANALOGIO *panalogio);
DWFAPI BOOL FDwfAnalogIOChannelNodeSetInfo(HDWF hdwf, int idxChannel, int idxNode, double *pmin, double *pmax, int *pnSteps);
DWFAPI BOOL FDwfAnalogIOChannelNodeSet(HDWF hdwf, int idxChannel, int idxNode, double value);
DWFAPI BOOL FDwfAnalogIOChannelNodeGet(HDWF hdwf, int idxChannel, int idxNode, double *pvalue);
DWFAPI BOOL FDwfAnalogIOChannelNodeStatusInfo(HDWF hdwf, int idxChannel, int idxNode, double *pmin, double *pmax, int *pnSteps);
DWFAPI BOOL FDwfAnalogIOChannelNodeStatus(HDWF hdwf, int idxChannel, int idxNode, double *pvalue);


// DIGITAL IO INSTRUMENT FUNCTIONS
// Control:
DWFAPI BOOL FDwfDigitalIOReset(HDWF hdwf);
DWFAPI BOOL FDwfDigitalIOConfigure(HDWF hdwf);
DWFAPI BOOL FDwfDigitalIOStatus(HDWF hdwf);

// Configure:
DWFAPI BOOL FDwfDigitalIOOutputEnableInfo(HDWF hdwf, unsigned int *pfsOutputEnableMask);
DWFAPI BOOL FDwfDigitalIOOutputEnableSet(HDWF hdwf, unsigned int fsOutputEnable);
DWFAPI BOOL FDwfDigitalIOOutputEnableGet(HDWF hdwf, unsigned int *pfsOutputEnable);
DWFAPI BOOL FDwfDigitalIOOutputInfo(HDWF hdwf, unsigned int *pfsOutputMask);
DWFAPI BOOL FDwfDigitalIOOutputSet(HDWF hdwf, unsigned int fsOutput);
DWFAPI BOOL FDwfDigitalIOOutputGet(HDWF hdwf, unsigned int *pfsOutput);
DWFAPI BOOL FDwfDigitalIOInputInfo(HDWF hdwf, unsigned int *pfsInputMask);
DWFAPI BOOL FDwfDigitalIOInputStatus(HDWF hdwf, unsigned int *pfsInput);
DWFAPI BOOL FDwfDigitalIOOutputEnableInfo64(HDWF hdwf, unsigned long long *pfsOutputEnableMask);
DWFAPI BOOL FDwfDigitalIOOutputEnableSet64(HDWF hdwf, unsigned long long fsOutputEnable);
DWFAPI BOOL FDwfDigitalIOOutputEnableGet64(HDWF hdwf, unsigned long long *pfsOutputEnable);
DWFAPI BOOL FDwfDigitalIOOutputInfo64(HDWF hdwf, unsigned long long *pfsOutputMask);
DWFAPI BOOL FDwfDigitalIOOutputSet64(HDWF hdwf, unsigned long long fsOutput);
DWFAPI BOOL FDwfDigitalIOOutputGet64(HDWF hdwf, unsigned long long *pfsOutput);
DWFAPI BOOL FDwfDigitalIOInputInfo64(HDWF hdwf, unsigned long long *pfsInputMask);
DWFAPI BOOL FDwfDigitalIOInputStatus64(HDWF hdwf, unsigned long long *pfsInput);


// DIGITAL IN INSTRUMENT FUNCTIONS
// Control and status:
DWFAPI BOOL FDwfDigitalInReset(HDWF hdwf);
DWFAPI BOOL FDwfDigitalInConfigure(HDWF hdwf, BOOL fReconfigure, BOOL fStart);
DWFAPI BOOL FDwfDigitalInStatus(HDWF hdwf, BOOL fReadData, DwfState *psts);
DWFAPI BOOL FDwfDigitalInStatusSamplesLeft(HDWF hdwf, int *pcSamplesLeft);
DWFAPI BOOL FDwfDigitalInStatusSamplesValid(HDWF hdwf, int *pcSamplesValid);
DWFAPI BOOL FDwfDigitalInStatusIndexWrite(HDWF hdwf, int *pidxWrite);
DWFAPI BOOL FDwfDigitalInStatusAutoTriggered(HDWF hdwf, BOOL *pfAuto);
DWFAPI BOOL FDwfDigitalInStatusData(HDWF hdwf, void *rgData, int countOfDataBytes);
DWFAPI BOOL FDwfDigitalInStatusData2(HDWF hdwf, void *rgData, int idxSample, int countOfDataBytes);
DWFAPI BOOL FDwfDigitalInStatusNoise2(HDWF hdwf, void *rgData, int idxSample, int countOfDataBytes);
DWFAPI BOOL FDwfDigitalInStatusRecord(HDWF hdwf, int *pcdDataAvailable, int *pcdDataLost, int *pcdDataCorrupt);

// Acquisition configuration:
DWFAPI BOOL FDwfDigitalInInternalClockInfo(HDWF hdwf, double *phzFreq);

DWFAPI BOOL FDwfDigitalInClockSourceInfo(HDWF hdwf, int *pfsDwfDigitalInClockSource); // use IsBitSet
DWFAPI BOOL FDwfDigitalInClockSourceSet(HDWF hdwf, DwfDigitalInClockSource v);
DWFAPI BOOL FDwfDigitalInClockSourceGet(HDWF hdwf, DwfDigitalInClockSource *pv);

DWFAPI BOOL FDwfDigitalInDividerInfo(HDWF hdwf, unsigned int *pdivMax);
DWFAPI BOOL FDwfDigitalInDividerSet(HDWF hdwf, unsigned int div);
DWFAPI BOOL FDwfDigitalInDividerGet(HDWF hdwf, unsigned int *pdiv);

DWFAPI BOOL FDwfDigitalInBitsInfo(HDWF hdwf, int *pnBits); // Returns the number of Digital In bits
DWFAPI BOOL FDwfDigitalInSampleFormatSet(HDWF hdwf, int nBits);  // valid options 8/16/32
DWFAPI BOOL FDwfDigitalInSampleFormatGet(HDWF hdwf, int *pnBits);

DWFAPI BOOL FDwfDigitalInInputOrderSet(HDWF hdwf, bool fDioFirst); // for Digital Discovery

DWFAPI BOOL FDwfDigitalInBufferSizeInfo(HDWF hdwf, int *pnSizeMax);
DWFAPI BOOL FDwfDigitalInBufferSizeSet(HDWF hdwf, int nSize);
DWFAPI BOOL FDwfDigitalInBufferSizeGet(HDWF hdwf, int *pnSize);

DWFAPI BOOL FDwfDigitalInSampleModeInfo(HDWF hdwf, int *pfsDwfDigitalInSampleMode); // use IsBitSet
DWFAPI BOOL FDwfDigitalInSampleModeSet(HDWF hdwf, DwfDigitalInSampleMode v);  //
DWFAPI BOOL FDwfDigitalInSampleModeGet(HDWF hdwf, DwfDigitalInSampleMode *pv);

DWFAPI BOOL FDwfDigitalInSampleSensibleSet(HDWF hdwf, unsigned int fs);
DWFAPI BOOL FDwfDigitalInSampleSensibleGet(HDWF hdwf, unsigned int *pfs);

DWFAPI BOOL FDwfDigitalInAcquisitionModeInfo(HDWF hdwf, int *pfsacqmode); // use IsBitSet
DWFAPI BOOL FDwfDigitalInAcquisitionModeSet(HDWF hdwf, ACQMODE acqmode);
DWFAPI BOOL FDwfDigitalInAcquisitionModeGet(HDWF hdwf, ACQMODE *pacqmode);

// Trigger configuration:
DWFAPI BOOL FDwfDigitalInTriggerSourceSet(HDWF hdwf, TRIGSRC trigsrc);
DWFAPI BOOL FDwfDigitalInTriggerSourceGet(HDWF hdwf, TRIGSRC *ptrigsrc);

DWFAPI BOOL FDwfDigitalInTriggerSlopeSet(HDWF hdwf, DwfTriggerSlope slope);
DWFAPI BOOL FDwfDigitalInTriggerSlopeGet(HDWF hdwf, DwfTriggerSlope *pslope);

DWFAPI BOOL FDwfDigitalInTriggerPositionInfo(HDWF hdwf, unsigned int *pnSamplesAfterTriggerMax);
DWFAPI BOOL FDwfDigitalInTriggerPositionSet(HDWF hdwf, unsigned int cSamplesAfterTrigger);
DWFAPI BOOL FDwfDigitalInTriggerPositionGet(HDWF hdwf, unsigned int *pcSamplesAfterTrigger);

DWFAPI BOOL FDwfDigitalInTriggerPrefillSet(HDWF hdwf, unsigned int cSamplesBeforeTrigger);
DWFAPI BOOL FDwfDigitalInTriggerPrefillGet(HDWF hdwf, unsigned int *pcSamplesBeforeTrigger);

DWFAPI BOOL FDwfDigitalInTriggerAutoTimeoutInfo(HDWF hdwf, double *psecMin, double *psecMax, double *pnSteps);
DWFAPI BOOL FDwfDigitalInTriggerAutoTimeoutSet(HDWF hdwf, double secTimeout);
DWFAPI BOOL FDwfDigitalInTriggerAutoTimeoutGet(HDWF hdwf, double *psecTimeout);

DWFAPI BOOL FDwfDigitalInTriggerInfo(HDWF hdwf, unsigned int *pfsLevelLow, unsigned int *pfsLevelHigh, unsigned int *pfsEdgeRise, unsigned int *pfsEdgeFall);
DWFAPI BOOL FDwfDigitalInTriggerSet(HDWF hdwf, unsigned int fsLevelLow, unsigned int fsLevelHigh, unsigned int fsEdgeRise, unsigned int fsEdgeFall);
DWFAPI BOOL FDwfDigitalInTriggerGet(HDWF hdwf, unsigned int *pfsLevelLow, unsigned int *pfsLevelHigh, unsigned int *pfsEdgeRise, unsigned int *pfsEdgeFall);
// the logic for trigger bits: Low and High and (Rise or Fall)
// bits set in Rise and Fall means any edge

DWFAPI BOOL FDwfDigitalInTriggerResetSet(HDWF hdwf, unsigned int fsLevelLow, unsigned int fsLevelHigh, unsigned int fsEdgeRise, unsigned int fsEdgeFall);
DWFAPI BOOL FDwfDigitalInTriggerCountSet(HDWF hdwf, int cCount, int fRestart);
DWFAPI BOOL FDwfDigitalInTriggerLengthSet(HDWF hdwf, double secMin, double secMax, int idxSync);
DWFAPI BOOL FDwfDigitalInTriggerMatchSet(HDWF hdwf, int iPin, unsigned int fsMask, unsigned int fsValue, int cBitStuffing);


// DIGITAL OUT INSTRUMENT FUNCTIONS
// Control:
DWFAPI BOOL FDwfDigitalOutReset(HDWF hdwf);
DWFAPI BOOL FDwfDigitalOutConfigure(HDWF hdwf, BOOL fStart);
DWFAPI BOOL FDwfDigitalOutStatus(HDWF hdwf, DwfState *psts);

// Configuration:
DWFAPI BOOL FDwfDigitalOutInternalClockInfo(HDWF hdwf, double *phzFreq);

DWFAPI BOOL FDwfDigitalOutTriggerSourceSet(HDWF hdwf, TRIGSRC trigsrc);
DWFAPI BOOL FDwfDigitalOutTriggerSourceGet(HDWF hdwf, TRIGSRC *ptrigsrc);

DWFAPI BOOL FDwfDigitalOutRunInfo(HDWF hdwf, double *psecMin, double *psecMax);
DWFAPI BOOL FDwfDigitalOutRunSet(HDWF hdwf, double secRun);
DWFAPI BOOL FDwfDigitalOutRunGet(HDWF hdwf, double *psecRun);
DWFAPI BOOL FDwfDigitalOutRunStatus(HDWF hdwf, double *psecRun);

DWFAPI BOOL FDwfDigitalOutWaitInfo(HDWF hdwf, double *psecMin, double *psecMax);
DWFAPI BOOL FDwfDigitalOutWaitSet(HDWF hdwf, double secWait);
DWFAPI BOOL FDwfDigitalOutWaitGet(HDWF hdwf, double *psecWait);

DWFAPI BOOL FDwfDigitalOutRepeatInfo(HDWF hdwf, unsigned int *pnMin, unsigned int *pnMax);
DWFAPI BOOL FDwfDigitalOutRepeatSet(HDWF hdwf, unsigned int cRepeat);
DWFAPI BOOL FDwfDigitalOutRepeatGet(HDWF hdwf, unsigned int *pcRepeat);
DWFAPI BOOL FDwfDigitalOutRepeatStatus(HDWF hdwf, unsigned int *pcRepeat);

DWFAPI BOOL FDwfDigitalOutTriggerSlopeSet(HDWF hdwf, DwfTriggerSlope slope);
DWFAPI BOOL FDwfDigitalOutTriggerSlopeGet(HDWF hdwf, DwfTriggerSlope *pslope);

DWFAPI BOOL FDwfDigitalOutRepeatTriggerSet(HDWF hdwf, BOOL fRepeatTrigger);
DWFAPI BOOL FDwfDigitalOutRepeatTriggerGet(HDWF hdwf, BOOL *pfRepeatTrigger);

DWFAPI BOOL FDwfDigitalOutCount(HDWF hdwf, int *pcChannel);
DWFAPI BOOL FDwfDigitalOutEnableSet(HDWF hdwf, int idxChannel, BOOL fEnable);
DWFAPI BOOL FDwfDigitalOutEnableGet(HDWF hdwf, int idxChannel, BOOL *pfEnable);

DWFAPI BOOL FDwfDigitalOutOutputInfo(HDWF hdwf, int idxChannel, int *pfsDwfDigitalOutOutput); // use IsBitSet
DWFAPI BOOL FDwfDigitalOutOutputSet(HDWF hdwf, int idxChannel, DwfDigitalOutOutput v);
DWFAPI BOOL FDwfDigitalOutOutputGet(HDWF hdwf, int idxChannel, DwfDigitalOutOutput *pv);

DWFAPI BOOL FDwfDigitalOutTypeInfo(HDWF hdwf, int idxChannel, int *pfsDwfDigitalOutType); // use IsBitSet
DWFAPI BOOL FDwfDigitalOutTypeSet(HDWF hdwf, int idxChannel, DwfDigitalOutType v);
DWFAPI BOOL FDwfDigitalOutTypeGet(HDWF hdwf, int idxChannel, DwfDigitalOutType *pv);

DWFAPI BOOL FDwfDigitalOutIdleInfo(HDWF hdwf, int idxChannel, int *pfsDwfDigitalOutIdle); // use IsBitSet
DWFAPI BOOL FDwfDigitalOutIdleSet(HDWF hdwf, int idxChannel, DwfDigitalOutIdle v);
DWFAPI BOOL FDwfDigitalOutIdleGet(HDWF hdwf, int idxChannel, DwfDigitalOutIdle *pv);

DWFAPI BOOL FDwfDigitalOutDividerInfo(HDWF hdwf, int idxChannel, unsigned int *vMin, unsigned int *vMax);
DWFAPI BOOL FDwfDigitalOutDividerInitSet(HDWF hdwf, int idxChannel, unsigned int v);
DWFAPI BOOL FDwfDigitalOutDividerInitGet(HDWF hdwf, int idxChannel, unsigned int *pv);
DWFAPI BOOL FDwfDigitalOutDividerSet(HDWF hdwf, int idxChannel, unsigned int v);
DWFAPI BOOL FDwfDigitalOutDividerGet(HDWF hdwf, int idxChannel, unsigned int *pv);

DWFAPI BOOL FDwfDigitalOutCounterInfo(HDWF hdwf, int idxChannel, unsigned int *vMin, unsigned int *vMax);
DWFAPI BOOL FDwfDigitalOutCounterInitSet(HDWF hdwf, int idxChannel, BOOL fHigh, unsigned int v);
DWFAPI BOOL FDwfDigitalOutCounterInitGet(HDWF hdwf, int idxChannel, int *pfHigh, unsigned int *pv);
DWFAPI BOOL FDwfDigitalOutCounterSet(HDWF hdwf, int idxChannel, unsigned int vLow, unsigned int vHigh);
DWFAPI BOOL FDwfDigitalOutCounterGet(HDWF hdwf, int idxChannel, unsigned int *pvLow, unsigned int *pvHigh);


DWFAPI BOOL FDwfDigitalOutDataInfo(HDWF hdwf, int idxChannel, unsigned int *pcountOfBitsMax);
DWFAPI BOOL FDwfDigitalOutDataSet(HDWF hdwf, int idxChannel, void *rgBits, unsigned int countOfBits);
// bits order is lsb first
// for TS output the count of bits its the total number of IO|OE bits, it should be an even number
// BYTE:   0                 |1     ...
// bit:    0 |1 |2 |3 |...|7 |0 |1 |...
// sample: IO|OE|IO|OE|...|OE|IO|OE|...


DWFAPI BOOL FDwfDigitalUartReset(HDWF hdwf);
DWFAPI BOOL FDwfDigitalUartRateSet(HDWF hdwf, double hz);
DWFAPI BOOL FDwfDigitalUartBitsSet(HDWF hdwf, int cBits);
DWFAPI BOOL FDwfDigitalUartParitySet(HDWF hdwf, int parity); // 0 none, 1 odd, 2 even
DWFAPI BOOL FDwfDigitalUartStopSet(HDWF hdwf, double cBit);
DWFAPI BOOL FDwfDigitalUartTxSet(HDWF hdwf, int idxChannel);
DWFAPI BOOL FDwfDigitalUartRxSet(HDWF hdwf, int idxChannel);

DWFAPI BOOL FDwfDigitalUartTx(HDWF hdwf, char *szTx, int cTx);
DWFAPI BOOL FDwfDigitalUartRx(HDWF hdwf, char *szRx, int cRx, int *pcRx, int *pParity);

DWFAPI BOOL FDwfDigitalSpiReset(HDWF hdwf);
DWFAPI BOOL FDwfDigitalSpiFrequencySet(HDWF hdwf, double hz);
DWFAPI BOOL FDwfDigitalSpiClockSet(HDWF hdwf, int idxChannel);
DWFAPI BOOL FDwfDigitalSpiDataSet(HDWF hdwf, int idxDQ, int idxChannel); // 0 DQ0_MOSI_SISO, 1 DQ1_MISO, 2 DQ2, 3 DQ3
DWFAPI BOOL FDwfDigitalSpiModeSet(HDWF hdwf, int iMode); // bit1 CPOL, bit0 CPHA
DWFAPI BOOL FDwfDigitalSpiOrderSet(HDWF hdwf, int fMSBLSB); // bit order: 0 MSB first, 1 LSB first

DWFAPI BOOL FDwfDigitalSpiSelect(HDWF hdwf, int idxChannel, int level); // 0 low, 1 high, -1 Z
// cDQ 0 SISO, 1 MOSI/MISO, 2 dual, 4 quad, // 1-32 bits / word
DWFAPI BOOL FDwfDigitalSpiWriteRead(HDWF hdwf, int cDQ, int cBitPerWord, unsigned char *rgTX, int cTX, unsigned char *rgRX, int cRX);
DWFAPI BOOL FDwfDigitalSpiWriteRead16(HDWF hdwf, int cDQ, int cBitPerWord, unsigned short *rgTX, int cTX, unsigned short *rgRX, int cRX);
DWFAPI BOOL FDwfDigitalSpiWriteRead32(HDWF hdwf, int cDQ, int cBitPerWord, unsigned int *rgTX, int cTX, unsigned int *rgRX, int cRX);
DWFAPI BOOL FDwfDigitalSpiRead(HDWF hdwf, int cDQ, int cBitPerWord, unsigned char *rgRX, int cRX);
DWFAPI BOOL FDwfDigitalSpiReadOne(HDWF hdwf, int cDQ, int cBitPerWord, unsigned int *pRX);
DWFAPI BOOL FDwfDigitalSpiRead16(HDWF hdwf, int cDQ, int cBitPerWord, unsigned short *rgRX, int cRX);
DWFAPI BOOL FDwfDigitalSpiRead32(HDWF hdwf, int cDQ, int cBitPerWord, unsigned int *rgRX, int cRX);
DWFAPI BOOL FDwfDigitalSpiWrite(HDWF hdwf, int cDQ, int cBitPerWord, unsigned char *rgTX, int cTX);
DWFAPI BOOL FDwfDigitalSpiWriteOne(HDWF hdwf, int cDQ, int cBits, unsigned int vTX);
DWFAPI BOOL FDwfDigitalSpiWrite16(HDWF hdwf, int cDQ, int cBitPerWord, unsigned short *rgTX, int cTX);
DWFAPI BOOL FDwfDigitalSpiWrite32(HDWF hdwf, int cDQ, int cBitPerWord, unsigned int *rgTX, int cTX);

DWFAPI BOOL FDwfDigitalI2cReset(HDWF hdwf);
DWFAPI BOOL FDwfDigitalI2cClear(HDWF hdwf, int *pfFree);
DWFAPI BOOL FDwfDigitalI2cRateSet(HDWF hdwf, double hz);
DWFAPI BOOL FDwfDigitalI2cReadNakSet(HDWF hdwf, int fNakLastReadByte);
DWFAPI BOOL FDwfDigitalI2cSclSet(HDWF hdwf, int idxChannel);
DWFAPI BOOL FDwfDigitalI2cSdaSet(HDWF hdwf, int idxChannel);

DWFAPI BOOL FDwfDigitalI2cWriteRead(HDWF hdwf, unsigned char adr8bits, unsigned char *rgbTx, int cTx, unsigned char *rgRx, int cRx, int *pNak);
DWFAPI BOOL FDwfDigitalI2cRead(HDWF hdwf, unsigned char adr8bits, unsigned char *rgbRx, int cRx, int *pNak);
DWFAPI BOOL FDwfDigitalI2cWrite(HDWF hdwf, unsigned char adr8bits, unsigned char *rgbTx, int cTx, int *pNak);
DWFAPI BOOL FDwfDigitalI2cWriteOne(HDWF hdwf, unsigned char adr8bits, unsigned char bTx, int *pNak);

DWFAPI BOOL FDwfDigitalCanReset(HDWF hdwf);
DWFAPI BOOL FDwfDigitalCanRateSet(HDWF hdwf, double hz);
DWFAPI BOOL FDwfDigitalCanPolaritySet(HDWF hdwf, int fHigh); // 0 low, 1 high
DWFAPI BOOL FDwfDigitalCanTxSet(HDWF hdwf, int idxChannel);
DWFAPI BOOL FDwfDigitalCanRxSet(HDWF hdwf, int idxChannel);

DWFAPI BOOL FDwfDigitalCanTx(HDWF hdwf, int vID, int fExtended, int fRemote, int cDLC, unsigned char *rgTX);
DWFAPI BOOL FDwfDigitalCanRx(HDWF hdwf, int *pvID, int *pfExtended, int *pfRemote, int *pcDLC, unsigned char *rgRX, int cRX, int *pvStatus);

typedef int DwfAnalogImpedance;
const DwfAnalogImpedance DwfAnalogImpedanceImpedance = 0; // Ohms
const DwfAnalogImpedance DwfAnalogImpedanceImpedancePhase = 1; // Radians
const DwfAnalogImpedance DwfAnalogImpedanceResistance = 2; // Ohms
const DwfAnalogImpedance DwfAnalogImpedanceReactance = 3; // Ohms
const DwfAnalogImpedance DwfAnalogImpedanceAdmittance = 4; // Siemen
const DwfAnalogImpedance DwfAnalogImpedanceAdmittancePhase = 5; // Radians
const DwfAnalogImpedance DwfAnalogImpedanceConductance = 6; // Siemen
const DwfAnalogImpedance DwfAnalogImpedanceSusceptance = 7; // Siemen
const DwfAnalogImpedance DwfAnalogImpedanceSeriesCapactance = 8; // Farad
const DwfAnalogImpedance DwfAnalogImpedanceParallelCapacitance = 9; // Farad
const DwfAnalogImpedance DwfAnalogImpedanceSeriesInductance = 10; // Henry
const DwfAnalogImpedance DwfAnalogImpedanceParallelInductance = 11; // Henry
const DwfAnalogImpedance DwfAnalogImpedanceDissipation = 12; // factor
const DwfAnalogImpedance DwfAnalogImpedanceQuality = 13; // factor

DWFAPI BOOL FDwfAnalogImpedanceReset(HDWF hdwf);
DWFAPI BOOL FDwfAnalogImpedanceModeSet(HDWF hdwf, int mode); // 0 W1-C1-DUT-C2-R-GND, 1 W1-C1-R-C2-DUT-GND, 8 Impedance Analyzer for AD
DWFAPI BOOL FDwfAnalogImpedanceModeGet(HDWF hdwf, int *mode);
DWFAPI BOOL FDwfAnalogImpedanceReferenceSet(HDWF hdwf, double ohms);
DWFAPI BOOL FDwfAnalogImpedanceReferenceGet(HDWF hdwf, double *pohms);
DWFAPI BOOL FDwfAnalogImpedanceFrequencySet(HDWF hdwf, double hz);
DWFAPI BOOL FDwfAnalogImpedanceFrequencyGet(HDWF hdwf, double *phz);
DWFAPI BOOL FDwfAnalogImpedanceAmplitudeSet(HDWF hdwf, double volts);
DWFAPI BOOL FDwfAnalogImpedanceAmplitudeGet(HDWF hdwf, double *pvolts);
DWFAPI BOOL FDwfAnalogImpedanceOffsetSet(HDWF hdwf, double volts);
DWFAPI BOOL FDwfAnalogImpedanceOffsetGet(HDWF hdwf, double *pvolts);
DWFAPI BOOL FDwfAnalogImpedanceProbeSet(HDWF hdwf, double ohmRes, double faradCap);
DWFAPI BOOL FDwfAnalogImpedanceProbeGet(HDWF hdwf, double *pohmRes, double *pfaradCap);
DWFAPI BOOL FDwfAnalogImpedancePeriodSet(HDWF hdwf, int cMinPeriods);
DWFAPI BOOL FDwfAnalogImpedancePeriodGet(HDWF hdwf, int *cMinPeriods);
DWFAPI BOOL FDwfAnalogImpedanceCompReset(HDWF hdwf);
DWFAPI BOOL FDwfAnalogImpedanceCompSet(HDWF hdwf, double ohmOpenResistance, double ohmOpenReactance, double ohmShortResistance, double ohmShortReactance);
DWFAPI BOOL FDwfAnalogImpedanceCompGet(HDWF hdwf, double *pohmOpenResistance, double *pohmOpenReactance, double *pohmShortResistance, double *pohmShortReactance);
DWFAPI BOOL FDwfAnalogImpedanceConfigure(HDWF hdwf, int fStart); // 1 start, 0 stop
DWFAPI BOOL FDwfAnalogImpedanceStatus(HDWF hdwf, DwfState *psts);
DWFAPI BOOL FDwfAnalogImpedanceStatusInput(HDWF hdwf, int idxChannel, double *pgain, double *pradian);
DWFAPI BOOL FDwfAnalogImpedanceStatusMeasure(HDWF hdwf, DwfAnalogImpedance measure, double *pvalue);


// OBSOLETE but supported, avoid using the following in new projects:
const DwfParam DwfParamKeepOnClose     = 1; // keep the device running after close, use DwfParamOnClose

// use FDwfDigitalInTriggerSourceSet trigsrcAnalogIn
// call FDwfDigitalInConfigure before FDwfAnalogInConfigure
DWFAPI BOOL FDwfDigitalInMixedSet(HDWF hdwf, BOOL fEnable);

// use DwfTriggerSlope
typedef int TRIGCOND;
const TRIGCOND trigcondRisingPositive   = 0;
const TRIGCOND trigcondFallingNegative  = 1;

// use FDwfDeviceTriggerInfo(hdwf, ptrigsrcInfo);
DWFAPI BOOL FDwfAnalogInTriggerSourceInfo(HDWF hdwf, int *pfstrigsrc); // use IsBitSet
DWFAPI BOOL FDwfAnalogOutTriggerSourceInfo(HDWF hdwf, int idxChannel, int *pfstrigsrc); // use IsBitSet
DWFAPI BOOL FDwfDigitalInTriggerSourceInfo(HDWF hdwf, int *pfstrigsrc); // use IsBitSet
DWFAPI BOOL FDwfDigitalOutTriggerSourceInfo(HDWF hdwf, int *pfstrigsrc); // use IsBitSet

// use DwfState
typedef BYTE STS;
const STS stsRdy        = 0;
const STS stsArm        = 1;
const STS stsDone       = 2;
const STS stsTrig       = 3;
const STS stsCfg        = 4;
const STS stsPrefill    = 5;
const STS stsNotDone    = 6;
const STS stsTrigDly    = 7;
const STS stsError      = 8;
const STS stsBusy       = 9;
const STS stsStop       = 10;


// use FDwfAnalogOutNode*
DWFAPI BOOL FDwfAnalogOutEnableSet(HDWF hdwf, int idxChannel, BOOL fEnable);
DWFAPI BOOL FDwfAnalogOutEnableGet(HDWF hdwf, int idxChannel, BOOL *pfEnable);
DWFAPI BOOL FDwfAnalogOutFunctionInfo(HDWF hdwf, int idxChannel, int *pfsfunc); // use IsBitSet
DWFAPI BOOL FDwfAnalogOutFunctionSet(HDWF hdwf, int idxChannel, FUNC func);
DWFAPI BOOL FDwfAnalogOutFunctionGet(HDWF hdwf, int idxChannel, FUNC *pfunc);
DWFAPI BOOL FDwfAnalogOutFrequencyInfo(HDWF hdwf, int idxChannel, double *phzMin, double *phzMax);
DWFAPI BOOL FDwfAnalogOutFrequencySet(HDWF hdwf, int idxChannel, double hzFrequency);
DWFAPI BOOL FDwfAnalogOutFrequencyGet(HDWF hdwf, int idxChannel, double *phzFrequency);
DWFAPI BOOL FDwfAnalogOutAmplitudeInfo(HDWF hdwf, int idxChannel, double *pvoltsMin, double *pvoltsMax);
DWFAPI BOOL FDwfAnalogOutAmplitudeSet(HDWF hdwf, int idxChannel, double voltsAmplitude);
DWFAPI BOOL FDwfAnalogOutAmplitudeGet(HDWF hdwf, int idxChannel, double *pvoltsAmplitude);
DWFAPI BOOL FDwfAnalogOutOffsetInfo(HDWF hdwf, int idxChannel, double *pvoltsMin, double *pvoltsMax);
DWFAPI BOOL FDwfAnalogOutOffsetSet(HDWF hdwf, int idxChannel, double voltsOffset);
DWFAPI BOOL FDwfAnalogOutOffsetGet(HDWF hdwf, int idxChannel, double *pvoltsOffset);
DWFAPI BOOL FDwfAnalogOutSymmetryInfo(HDWF hdwf, int idxChannel, double *ppercentageMin, double *ppercentageMax);
DWFAPI BOOL FDwfAnalogOutSymmetrySet(HDWF hdwf, int idxChannel, double percentageSymmetry);
DWFAPI BOOL FDwfAnalogOutSymmetryGet(HDWF hdwf, int idxChannel, double *ppercentageSymmetry);
DWFAPI BOOL FDwfAnalogOutPhaseInfo(HDWF hdwf, int idxChannel, double *pdegreeMin, double *pdegreeMax);
DWFAPI BOOL FDwfAnalogOutPhaseSet(HDWF hdwf, int idxChannel, double degreePhase);
DWFAPI BOOL FDwfAnalogOutPhaseGet(HDWF hdwf, int idxChannel, double *pdegreePhase);
DWFAPI BOOL FDwfAnalogOutDataInfo(HDWF hdwf, int idxChannel, int *pnSamplesMin, int *pnSamplesMax);
DWFAPI BOOL FDwfAnalogOutDataSet(HDWF hdwf, int idxChannel, double *rgdData, int cdData);
DWFAPI BOOL FDwfAnalogOutPlayStatus(HDWF hdwf, int idxChannel, int *cdDataFree, int *cdDataLost, int *cdDataCorrupted);
DWFAPI BOOL FDwfAnalogOutPlayData(HDWF hdwf, int idxChannel, double *rgdData, int cdData);

DWFAPI BOOL FDwfEnumAnalogInChannels(int idxDevice, int *pnChannels);
DWFAPI BOOL FDwfEnumAnalogInBufferSize(int idxDevice, int *pnBufferSize);
DWFAPI BOOL FDwfEnumAnalogInBits(int idxDevice, int *pnBits);
DWFAPI BOOL FDwfEnumAnalogInFrequency(int idxDevice, double *phzFrequency);

#endif