pico_sys_dynamic/
ps2000.rs

1pub const PS2000_FIRST_USB: u32 = 1;
2pub const PS2000_LAST_USB: u32 = 127;
3pub const PS2000_MAX_UNITS: u32 = 127;
4pub const PS2000_MAX_TIMEBASE: u32 = 19;
5pub const PS2105_MAX_TIMEBASE: u32 = 20;
6pub const PS2104_MAX_TIMEBASE: u32 = 19;
7pub const PS2200_MAX_TIMEBASE: u32 = 23;
8pub const PS2000_MAX_OVERSAMPLE: u32 = 256;
9pub const PS2105_MAX_ETS_CYCLES: u32 = 250;
10pub const PS2105_MAX_ETS_INTERLEAVE: u32 = 50;
11pub const PS2104_MAX_ETS_CYCLES: u32 = 125;
12pub const PS2104_MAX_ETS_INTERLEAVE: u32 = 25;
13pub const PS2203_MAX_ETS_CYCLES: u32 = 250;
14pub const PS2203_MAX_ETS_INTERLEAVE: u32 = 50;
15pub const PS2204_MAX_ETS_CYCLES: u32 = 250;
16pub const PS2204_MAX_ETS_INTERLEAVE: u32 = 40;
17pub const PS2205_MAX_ETS_CYCLES: u32 = 250;
18pub const PS2205_MAX_ETS_INTERLEAVE: u32 = 40;
19pub const PS2000_MIN_ETS_CYCLES_INTERLEAVE_RATIO: u32 = 1;
20pub const PS2000_MAX_ETS_CYCLES_INTERLEAVE_RATIO: u32 = 10;
21pub const PS2000_MIN_SIGGEN_FREQ: f64 = 0.0;
22pub const PS2000_MAX_SIGGEN_FREQ: f64 = 100000.0;
23pub const PS2000_MAX_VALUE: u32 = 32767;
24pub const PS2000_MIN_VALUE: i32 = -32767;
25pub const PS2000_LOST_DATA: i32 = -32768;
26
27pub const enPS2000Channel_PS2000_CHANNEL_A: enPS2000Channel = 0;
28pub const enPS2000Channel_PS2000_CHANNEL_B: enPS2000Channel = 1;
29pub const enPS2000Channel_PS2000_CHANNEL_C: enPS2000Channel = 2;
30pub const enPS2000Channel_PS2000_CHANNEL_D: enPS2000Channel = 3;
31pub const enPS2000Channel_PS2000_EXTERNAL: enPS2000Channel = 4;
32pub const enPS2000Channel_PS2000_MAX_CHANNELS: enPS2000Channel = 4;
33pub const enPS2000Channel_PS2000_NONE: enPS2000Channel = 5;
34pub type enPS2000Channel = ::std::os::raw::c_uint;
35pub use self::enPS2000Channel as PS2000_CHANNEL;
36pub const enPS2000Range_PS2000_10MV: enPS2000Range = 0;
37pub const enPS2000Range_PS2000_20MV: enPS2000Range = 1;
38pub const enPS2000Range_PS2000_50MV: enPS2000Range = 2;
39pub const enPS2000Range_PS2000_100MV: enPS2000Range = 3;
40pub const enPS2000Range_PS2000_200MV: enPS2000Range = 4;
41pub const enPS2000Range_PS2000_500MV: enPS2000Range = 5;
42pub const enPS2000Range_PS2000_1V: enPS2000Range = 6;
43pub const enPS2000Range_PS2000_2V: enPS2000Range = 7;
44pub const enPS2000Range_PS2000_5V: enPS2000Range = 8;
45pub const enPS2000Range_PS2000_10V: enPS2000Range = 9;
46pub const enPS2000Range_PS2000_20V: enPS2000Range = 10;
47pub const enPS2000Range_PS2000_50V: enPS2000Range = 11;
48pub const enPS2000Range_PS2000_MAX_RANGES: enPS2000Range = 12;
49pub type enPS2000Range = ::std::os::raw::c_uint;
50pub use self::enPS2000Range as PS2000_RANGE;
51pub const enPS2000TimeUnits_PS2000_FS: enPS2000TimeUnits = 0;
52pub const enPS2000TimeUnits_PS2000_PS: enPS2000TimeUnits = 1;
53pub const enPS2000TimeUnits_PS2000_NS: enPS2000TimeUnits = 2;
54pub const enPS2000TimeUnits_PS2000_US: enPS2000TimeUnits = 3;
55pub const enPS2000TimeUnits_PS2000_MS: enPS2000TimeUnits = 4;
56pub const enPS2000TimeUnits_PS2000_S: enPS2000TimeUnits = 5;
57pub const enPS2000TimeUnits_PS2000_MAX_TIME_UNITS: enPS2000TimeUnits = 6;
58pub type enPS2000TimeUnits = ::std::os::raw::c_uint;
59pub use self::enPS2000TimeUnits as PS2000_TIME_UNITS;
60pub const enPS2000Error_PS2000_OK: enPS2000Error = 0;
61pub const enPS2000Error_PS2000_MAX_UNITS_OPENED: enPS2000Error = 1;
62pub const enPS2000Error_PS2000_MEM_FAIL: enPS2000Error = 2;
63pub const enPS2000Error_PS2000_NOT_FOUND: enPS2000Error = 3;
64pub const enPS2000Error_PS2000_FW_FAIL: enPS2000Error = 4;
65pub const enPS2000Error_PS2000_NOT_RESPONDING: enPS2000Error = 5;
66pub const enPS2000Error_PS2000_CONFIG_FAIL: enPS2000Error = 6;
67pub const enPS2000Error_PS2000_OS_NOT_SUPPORTED: enPS2000Error = 7;
68pub const enPS2000Error_PS2000_PICOPP_TOO_OLD: enPS2000Error = 8;
69pub type enPS2000Error = ::std::os::raw::c_uint;
70pub use self::enPS2000Error as PS2000_ERROR;
71pub const enPS2000Info_PS2000_DRIVER_VERSION: enPS2000Info = 0;
72pub const enPS2000Info_PS2000_USB_VERSION: enPS2000Info = 1;
73pub const enPS2000Info_PS2000_HARDWARE_VERSION: enPS2000Info = 2;
74pub const enPS2000Info_PS2000_VARIANT_INFO: enPS2000Info = 3;
75pub const enPS2000Info_PS2000_BATCH_AND_SERIAL: enPS2000Info = 4;
76pub const enPS2000Info_PS2000_CAL_DATE: enPS2000Info = 5;
77pub const enPS2000Info_PS2000_ERROR_CODE: enPS2000Info = 6;
78pub const enPS2000Info_PS2000_KERNEL_DRIVER_VERSION: enPS2000Info = 7;
79pub const enPS2000Info_PS2000_DRIVER_PATH: enPS2000Info = 8;
80pub type enPS2000Info = ::std::os::raw::c_uint;
81pub use self::enPS2000Info as PS2000_INFO;
82pub const enPS2000TriggerDirection_PS2000_RISING: enPS2000TriggerDirection = 0;
83pub const enPS2000TriggerDirection_PS2000_FALLING: enPS2000TriggerDirection = 1;
84pub const enPS2000TriggerDirection_PS2000_MAX_DIRS: enPS2000TriggerDirection = 2;
85pub type enPS2000TriggerDirection = ::std::os::raw::c_uint;
86pub use self::enPS2000TriggerDirection as PS2000_TDIR;
87pub const enPS2000OpenProgress_PS2000_OPEN_PROGRESS_FAIL: enPS2000OpenProgress = -1;
88pub const enPS2000OpenProgress_PS2000_OPEN_PROGRESS_PENDING: enPS2000OpenProgress = 0;
89pub const enPS2000OpenProgress_PS2000_OPEN_PROGRESS_COMPLETE: enPS2000OpenProgress = 1;
90pub type enPS2000OpenProgress = ::std::os::raw::c_int;
91pub use self::enPS2000OpenProgress as PS2000_OPEN_PROGRESS;
92pub const enPS2000EtsMode_PS2000_ETS_OFF: enPS2000EtsMode = 0;
93pub const enPS2000EtsMode_PS2000_ETS_FAST: enPS2000EtsMode = 1;
94pub const enPS2000EtsMode_PS2000_ETS_SLOW: enPS2000EtsMode = 2;
95pub const enPS2000EtsMode_PS2000_ETS_MODES_MAX: enPS2000EtsMode = 3;
96pub type enPS2000EtsMode = ::std::os::raw::c_uint;
97pub use self::enPS2000EtsMode as PS2000_ETS_MODE;
98pub const enPS2000ButtonState_PS2000_NO_PRESS: enPS2000ButtonState = 0;
99pub const enPS2000ButtonState_PS2000_SHORT_PRESS: enPS2000ButtonState = 1;
100pub const enPS2000ButtonState_PS2000_LONG_PRESS: enPS2000ButtonState = 2;
101pub type enPS2000ButtonState = ::std::os::raw::c_uint;
102pub use self::enPS2000ButtonState as PS2000_BUTTON_STATE;
103pub const enPS2000SweepType_PS2000_UP: enPS2000SweepType = 0;
104pub const enPS2000SweepType_PS2000_DOWN: enPS2000SweepType = 1;
105pub const enPS2000SweepType_PS2000_UPDOWN: enPS2000SweepType = 2;
106pub const enPS2000SweepType_PS2000_DOWNUP: enPS2000SweepType = 3;
107pub const enPS2000SweepType_MAX_SWEEP_TYPES: enPS2000SweepType = 4;
108pub type enPS2000SweepType = ::std::os::raw::c_uint;
109pub use self::enPS2000SweepType as PS2000_SWEEP_TYPE;
110pub const enPS2000WaveType_PS2000_SINE: enPS2000WaveType = 0;
111pub const enPS2000WaveType_PS2000_SQUARE: enPS2000WaveType = 1;
112pub const enPS2000WaveType_PS2000_TRIANGLE: enPS2000WaveType = 2;
113pub const enPS2000WaveType_PS2000_RAMPUP: enPS2000WaveType = 3;
114pub const enPS2000WaveType_PS2000_RAMPDOWN: enPS2000WaveType = 4;
115pub const enPS2000WaveType_PS2000_DC_VOLTAGE: enPS2000WaveType = 5;
116pub const enPS2000WaveType_PS2000_GAUSSIAN: enPS2000WaveType = 6;
117pub const enPS2000WaveType_PS2000_SINC: enPS2000WaveType = 7;
118pub const enPS2000WaveType_PS2000_HALF_SINE: enPS2000WaveType = 8;
119pub type enPS2000WaveType = ::std::os::raw::c_uint;
120pub use self::enPS2000WaveType as PS2000_WAVE_TYPE;
121pub type GetOverviewBuffersMaxMin = ::std::option::Option<
122    extern "C" fn(
123        overviewBuffers: *mut *mut i16,
124        overflow: i16,
125        triggeredAt: u32,
126        triggered: i16,
127        auto_stop: i16,
128        nValues: u32,
129    ),
130>;
131pub const enPS2000ThresholdDirection_PS2000_ABOVE: enPS2000ThresholdDirection = 0;
132pub const enPS2000ThresholdDirection_PS2000_BELOW: enPS2000ThresholdDirection = 1;
133pub const enPS2000ThresholdDirection_PS2000_ADV_RISING: enPS2000ThresholdDirection = 2;
134pub const enPS2000ThresholdDirection_PS2000_ADV_FALLING: enPS2000ThresholdDirection = 3;
135pub const enPS2000ThresholdDirection_PS2000_RISING_OR_FALLING: enPS2000ThresholdDirection = 4;
136pub const enPS2000ThresholdDirection_PS2000_INSIDE: enPS2000ThresholdDirection = 0;
137pub const enPS2000ThresholdDirection_PS2000_OUTSIDE: enPS2000ThresholdDirection = 1;
138pub const enPS2000ThresholdDirection_PS2000_ENTER: enPS2000ThresholdDirection = 2;
139pub const enPS2000ThresholdDirection_PS2000_EXIT: enPS2000ThresholdDirection = 3;
140pub const enPS2000ThresholdDirection_PS2000_ENTER_OR_EXIT: enPS2000ThresholdDirection = 4;
141pub const enPS2000ThresholdDirection_PS2000_ADV_NONE: enPS2000ThresholdDirection = 2;
142pub type enPS2000ThresholdDirection = ::std::os::raw::c_uint;
143pub use self::enPS2000ThresholdDirection as PS2000_THRESHOLD_DIRECTION;
144pub const enPS2000ThresholdMode_PS2000_LEVEL: enPS2000ThresholdMode = 0;
145pub const enPS2000ThresholdMode_PS2000_WINDOW: enPS2000ThresholdMode = 1;
146pub type enPS2000ThresholdMode = ::std::os::raw::c_uint;
147pub use self::enPS2000ThresholdMode as PS2000_THRESHOLD_MODE;
148pub const enPS2000TriggerState_PS2000_CONDITION_DONT_CARE: enPS2000TriggerState = 0;
149pub const enPS2000TriggerState_PS2000_CONDITION_TRUE: enPS2000TriggerState = 1;
150pub const enPS2000TriggerState_PS2000_CONDITION_FALSE: enPS2000TriggerState = 2;
151pub const enPS2000TriggerState_PS2000_CONDITION_MAX: enPS2000TriggerState = 3;
152pub type enPS2000TriggerState = ::std::os::raw::c_uint;
153pub use self::enPS2000TriggerState as PS2000_TRIGGER_STATE;
154pub const enPS2000PulseWidthType_PS2000_PW_TYPE_NONE: enPS2000PulseWidthType = 0;
155pub const enPS2000PulseWidthType_PS2000_PW_TYPE_LESS_THAN: enPS2000PulseWidthType = 1;
156pub const enPS2000PulseWidthType_PS2000_PW_TYPE_GREATER_THAN: enPS2000PulseWidthType = 2;
157pub const enPS2000PulseWidthType_PS2000_PW_TYPE_IN_RANGE: enPS2000PulseWidthType = 3;
158pub const enPS2000PulseWidthType_PS2000_PW_TYPE_OUT_OF_RANGE: enPS2000PulseWidthType = 4;
159pub type enPS2000PulseWidthType = ::std::os::raw::c_uint;
160pub use self::enPS2000PulseWidthType as PS2000_PULSE_WIDTH_TYPE;
161#[repr(C, packed)]
162#[derive(Debug, Copy, Clone)]
163pub struct tPS2000TriggerChannelProperties {
164    pub thresholdMajor: i16,
165    pub thresholdMinor: i16,
166    pub hysteresis: u16,
167    pub channel: i16,
168    pub thresholdMode: PS2000_THRESHOLD_MODE,
169}
170
171pub type PS2000_TRIGGER_CHANNEL_PROPERTIES = tPS2000TriggerChannelProperties;
172#[repr(C, packed)]
173#[derive(Debug, Copy, Clone)]
174pub struct tPS2000TriggerConditions {
175    pub channelA: PS2000_TRIGGER_STATE,
176    pub channelB: PS2000_TRIGGER_STATE,
177    pub channelC: PS2000_TRIGGER_STATE,
178    pub channelD: PS2000_TRIGGER_STATE,
179    pub external: PS2000_TRIGGER_STATE,
180    pub pulseWidthQualifier: PS2000_TRIGGER_STATE,
181}
182
183pub type PS2000_TRIGGER_CONDITIONS = tPS2000TriggerConditions;
184#[repr(C, packed)]
185#[derive(Debug, Copy, Clone)]
186pub struct tPS2000PwqConditions {
187    pub channelA: PS2000_TRIGGER_STATE,
188    pub channelB: PS2000_TRIGGER_STATE,
189    pub channelC: PS2000_TRIGGER_STATE,
190    pub channelD: PS2000_TRIGGER_STATE,
191    pub external: PS2000_TRIGGER_STATE,
192}
193
194pub type PS2000_PWQ_CONDITIONS = tPS2000PwqConditions;
195
196extern crate libloading;
197pub struct PS2000Loader {
198    __library: ::libloading::Library,
199    pub ps2000_apply_fix: Result<unsafe extern "C" fn(u32, u16), ::libloading::Error>,
200    pub ps2000_open_unit: Result<unsafe extern "C" fn() -> i16, ::libloading::Error>,
201    pub ps2000_get_unit_info: Result<
202        unsafe extern "C" fn(handle: i16, string: *mut i8, string_length: i16, line: i16) -> i16,
203        ::libloading::Error,
204    >,
205    pub ps2000_flash_led: Result<unsafe extern "C" fn(handle: i16) -> i16, ::libloading::Error>,
206    pub ps2000_close_unit: Result<unsafe extern "C" fn(handle: i16) -> i16, ::libloading::Error>,
207    pub ps2000_set_channel: Result<
208        unsafe extern "C" fn(handle: i16, channel: i16, enabled: i16, dc: i16, range: i16) -> i16,
209        ::libloading::Error,
210    >,
211    pub ps2000_get_timebase: Result<
212        unsafe extern "C" fn(
213            handle: i16,
214            timebase: i16,
215            no_of_samples: i32,
216            time_interval: *mut i32,
217            time_units: *mut i16,
218            oversample: i16,
219            max_samples: *mut i32,
220        ) -> i16,
221        ::libloading::Error,
222    >,
223    pub ps2000_set_trigger: Result<
224        unsafe extern "C" fn(
225            handle: i16,
226            source: i16,
227            threshold: i16,
228            direction: i16,
229            delay: i16,
230            auto_trigger_ms: i16,
231        ) -> i16,
232        ::libloading::Error,
233    >,
234    pub ps2000_set_trigger2: Result<
235        unsafe extern "C" fn(
236            handle: i16,
237            source: i16,
238            threshold: i16,
239            direction: i16,
240            delay: f32,
241            auto_trigger_ms: i16,
242        ) -> i16,
243        ::libloading::Error,
244    >,
245    pub ps2000_run_block: Result<
246        unsafe extern "C" fn(
247            handle: i16,
248            no_of_values: i32,
249            timebase: i16,
250            oversample: i16,
251            time_indisposed_ms: *mut i32,
252        ) -> i16,
253        ::libloading::Error,
254    >,
255    pub ps2000_run_streaming: Result<
256        unsafe extern "C" fn(
257            handle: i16,
258            sample_interval_ms: i16,
259            max_samples: i32,
260            windowed: i16,
261        ) -> i16,
262        ::libloading::Error,
263    >,
264    pub ps2000_run_streaming_ns: Result<
265        unsafe extern "C" fn(
266            handle: i16,
267            sample_interval: u32,
268            time_units: PS2000_TIME_UNITS,
269            max_samples: u32,
270            auto_stop: i16,
271            noOfSamplesPerAggregate: u32,
272            overview_buffer_size: u32,
273        ) -> i16,
274        ::libloading::Error,
275    >,
276    pub ps2000_ready: Result<unsafe extern "C" fn(handle: i16) -> i16, ::libloading::Error>,
277    pub ps2000_stop: Result<unsafe extern "C" fn(handle: i16) -> i16, ::libloading::Error>,
278    pub ps2000_get_values: Result<
279        unsafe extern "C" fn(
280            handle: i16,
281            buffer_a: *mut i16,
282            buffer_b: *mut i16,
283            buffer_c: *mut i16,
284            buffer_d: *mut i16,
285            overflow: *mut i16,
286            no_of_values: i32,
287        ) -> i32,
288        ::libloading::Error,
289    >,
290    pub ps2000_get_times_and_values: Result<
291        unsafe extern "C" fn(
292            handle: i16,
293            times: *mut i32,
294            buffer_a: *mut i16,
295            buffer_b: *mut i16,
296            buffer_c: *mut i16,
297            buffer_d: *mut i16,
298            overflow: *mut i16,
299            time_units: i16,
300            no_of_values: i32,
301        ) -> i32,
302        ::libloading::Error,
303    >,
304    pub ps2000_last_button_press:
305        Result<unsafe extern "C" fn(handle: i16) -> i16, ::libloading::Error>,
306    pub ps2000_set_ets: Result<
307        unsafe extern "C" fn(handle: i16, mode: i16, ets_cycles: i16, ets_interleave: i16) -> i32,
308        ::libloading::Error,
309    >,
310    pub ps2000_set_led:
311        Result<unsafe extern "C" fn(handle: i16, state: i16) -> i16, ::libloading::Error>,
312    pub ps2000_open_unit_async: Result<unsafe extern "C" fn() -> i16, ::libloading::Error>,
313    pub ps2000_open_unit_progress: Result<
314        unsafe extern "C" fn(handle: *mut i16, progress_percent: *mut i16) -> i16,
315        ::libloading::Error,
316    >,
317    pub ps2000_get_streaming_last_values: Result<
318        unsafe extern "C" fn(handle: i16, arg1: GetOverviewBuffersMaxMin) -> i16,
319        ::libloading::Error,
320    >,
321    pub ps2000_overview_buffer_status: Result<
322        unsafe extern "C" fn(handle: i16, previous_buffer_overrun: *mut i16) -> i16,
323        ::libloading::Error,
324    >,
325    pub ps2000_get_streaming_values: Result<
326        unsafe extern "C" fn(
327            handle: i16,
328            start_time: *mut f64,
329            pbuffer_a_max: *mut i16,
330            pbuffer_a_min: *mut i16,
331            pbuffer_b_max: *mut i16,
332            pbuffer_b_min: *mut i16,
333            pbuffer_c_max: *mut i16,
334            pbuffer_c_min: *mut i16,
335            pbuffer_d_max: *mut i16,
336            pbuffer_d_min: *mut i16,
337            overflow: *mut i16,
338            triggerAt: *mut u32,
339            triggered: *mut i16,
340            no_of_values: u32,
341            noOfSamplesPerAggregate: u32,
342        ) -> u32,
343        ::libloading::Error,
344    >,
345    pub ps2000_get_streaming_values_no_aggregation: Result<
346        unsafe extern "C" fn(
347            handle: i16,
348            start_time: *mut f64,
349            pbuffer_a: *mut i16,
350            pbuffer_b: *mut i16,
351            pbuffer_c: *mut i16,
352            pbuffer_d: *mut i16,
353            overflow: *mut i16,
354            triggerAt: *mut u32,
355            trigger: *mut i16,
356            no_of_values: u32,
357        ) -> u32,
358        ::libloading::Error,
359    >,
360    pub ps2000_set_light:
361        Result<unsafe extern "C" fn(handle: i16, state: i16) -> i16, ::libloading::Error>,
362    pub ps2000_set_sig_gen_arbitrary: Result<
363        unsafe extern "C" fn(
364            handle: i16,
365            offsetVoltage: i32,
366            pkToPk: u32,
367            startDeltaPhase: u32,
368            stopDeltaPhase: u32,
369            deltaPhaseIncrement: u32,
370            dwellCount: u32,
371            arbitraryWaveform: *mut u8,
372            arbitraryWaveformSize: i32,
373            sweepType: PS2000_SWEEP_TYPE,
374            sweeps: u32,
375        ) -> i16,
376        ::libloading::Error,
377    >,
378    pub ps2000_set_sig_gen_built_in: Result<
379        unsafe extern "C" fn(
380            handle: i16,
381            offsetVoltage: i32,
382            pkToPk: u32,
383            waveType: PS2000_WAVE_TYPE,
384            startFrequency: f32,
385            stopFrequency: f32,
386            increment: f32,
387            dwellTime: f32,
388            sweepType: PS2000_SWEEP_TYPE,
389            sweeps: u32,
390        ) -> i16,
391        ::libloading::Error,
392    >,
393    pub ps2000SetAdvTriggerChannelProperties: Result<
394        unsafe extern "C" fn(
395            handle: i16,
396            channelProperties: *mut PS2000_TRIGGER_CHANNEL_PROPERTIES,
397            nChannelProperties: i16,
398            autoTriggerMilliseconds: i32,
399        ) -> i16,
400        ::libloading::Error,
401    >,
402    pub ps2000SetAdvTriggerChannelConditions: Result<
403        unsafe extern "C" fn(
404            handle: i16,
405            conditions: *mut PS2000_TRIGGER_CONDITIONS,
406            nConditions: i16,
407        ) -> i16,
408        ::libloading::Error,
409    >,
410    pub ps2000SetAdvTriggerChannelDirections: Result<
411        unsafe extern "C" fn(
412            handle: i16,
413            channelA: PS2000_THRESHOLD_DIRECTION,
414            channelB: PS2000_THRESHOLD_DIRECTION,
415            channelC: PS2000_THRESHOLD_DIRECTION,
416            channelD: PS2000_THRESHOLD_DIRECTION,
417            ext: PS2000_THRESHOLD_DIRECTION,
418        ) -> i16,
419        ::libloading::Error,
420    >,
421    pub ps2000SetPulseWidthQualifier: Result<
422        unsafe extern "C" fn(
423            handle: i16,
424            conditions: *mut PS2000_PWQ_CONDITIONS,
425            nConditions: i16,
426            direction: PS2000_THRESHOLD_DIRECTION,
427            lower: u32,
428            upper: u32,
429            type_: PS2000_PULSE_WIDTH_TYPE,
430        ) -> i16,
431        ::libloading::Error,
432    >,
433    pub ps2000SetAdvTriggerDelay: Result<
434        unsafe extern "C" fn(handle: i16, delay: u32, preTriggerDelay: f32) -> i16,
435        ::libloading::Error,
436    >,
437    pub ps2000PingUnit: Result<unsafe extern "C" fn(handle: i16) -> i16, ::libloading::Error>,
438}
439impl PS2000Loader {
440    pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
441    where
442        P: AsRef<::std::ffi::OsStr>,
443    {
444        let __library = ::libloading::Library::new(path)?;
445        let ps2000_apply_fix = __library.get(b"ps2000_apply_fix\0").map(|sym| *sym);
446        let ps2000_open_unit = __library.get(b"ps2000_open_unit\0").map(|sym| *sym);
447        let ps2000_get_unit_info = __library.get(b"ps2000_get_unit_info\0").map(|sym| *sym);
448        let ps2000_flash_led = __library.get(b"ps2000_flash_led\0").map(|sym| *sym);
449        let ps2000_close_unit = __library.get(b"ps2000_close_unit\0").map(|sym| *sym);
450        let ps2000_set_channel = __library.get(b"ps2000_set_channel\0").map(|sym| *sym);
451        let ps2000_get_timebase = __library.get(b"ps2000_get_timebase\0").map(|sym| *sym);
452        let ps2000_set_trigger = __library.get(b"ps2000_set_trigger\0").map(|sym| *sym);
453        let ps2000_set_trigger2 = __library.get(b"ps2000_set_trigger2\0").map(|sym| *sym);
454        let ps2000_run_block = __library.get(b"ps2000_run_block\0").map(|sym| *sym);
455        let ps2000_run_streaming = __library.get(b"ps2000_run_streaming\0").map(|sym| *sym);
456        let ps2000_run_streaming_ns = __library.get(b"ps2000_run_streaming_ns\0").map(|sym| *sym);
457        let ps2000_ready = __library.get(b"ps2000_ready\0").map(|sym| *sym);
458        let ps2000_stop = __library.get(b"ps2000_stop\0").map(|sym| *sym);
459        let ps2000_get_values = __library.get(b"ps2000_get_values\0").map(|sym| *sym);
460        let ps2000_get_times_and_values = __library
461            .get(b"ps2000_get_times_and_values\0")
462            .map(|sym| *sym);
463        let ps2000_last_button_press = __library.get(b"ps2000_last_button_press\0").map(|sym| *sym);
464        let ps2000_set_ets = __library.get(b"ps2000_set_ets\0").map(|sym| *sym);
465        let ps2000_set_led = __library.get(b"ps2000_set_led\0").map(|sym| *sym);
466        let ps2000_open_unit_async = __library.get(b"ps2000_open_unit_async\0").map(|sym| *sym);
467        let ps2000_open_unit_progress = __library
468            .get(b"ps2000_open_unit_progress\0")
469            .map(|sym| *sym);
470        let ps2000_get_streaming_last_values = __library
471            .get(b"ps2000_get_streaming_last_values\0")
472            .map(|sym| *sym);
473        let ps2000_overview_buffer_status = __library
474            .get(b"ps2000_overview_buffer_status\0")
475            .map(|sym| *sym);
476        let ps2000_get_streaming_values = __library
477            .get(b"ps2000_get_streaming_values\0")
478            .map(|sym| *sym);
479        let ps2000_get_streaming_values_no_aggregation = __library
480            .get(b"ps2000_get_streaming_values_no_aggregation\0")
481            .map(|sym| *sym);
482        let ps2000_set_light = __library.get(b"ps2000_set_light\0").map(|sym| *sym);
483        let ps2000_set_sig_gen_arbitrary = __library
484            .get(b"ps2000_set_sig_gen_arbitrary\0")
485            .map(|sym| *sym);
486        let ps2000_set_sig_gen_built_in = __library
487            .get(b"ps2000_set_sig_gen_built_in\0")
488            .map(|sym| *sym);
489        let ps2000SetAdvTriggerChannelProperties = __library
490            .get(b"ps2000SetAdvTriggerChannelProperties\0")
491            .map(|sym| *sym);
492        let ps2000SetAdvTriggerChannelConditions = __library
493            .get(b"ps2000SetAdvTriggerChannelConditions\0")
494            .map(|sym| *sym);
495        let ps2000SetAdvTriggerChannelDirections = __library
496            .get(b"ps2000SetAdvTriggerChannelDirections\0")
497            .map(|sym| *sym);
498        let ps2000SetPulseWidthQualifier = __library
499            .get(b"ps2000SetPulseWidthQualifier\0")
500            .map(|sym| *sym);
501        let ps2000SetAdvTriggerDelay = __library.get(b"ps2000SetAdvTriggerDelay\0").map(|sym| *sym);
502        let ps2000PingUnit = __library.get(b"ps2000PingUnit\0").map(|sym| *sym);
503        Ok(PS2000Loader {
504            __library,
505            ps2000_apply_fix,
506            ps2000_open_unit,
507            ps2000_get_unit_info,
508            ps2000_flash_led,
509            ps2000_close_unit,
510            ps2000_set_channel,
511            ps2000_get_timebase,
512            ps2000_set_trigger,
513            ps2000_set_trigger2,
514            ps2000_run_block,
515            ps2000_run_streaming,
516            ps2000_run_streaming_ns,
517            ps2000_ready,
518            ps2000_stop,
519            ps2000_get_values,
520            ps2000_get_times_and_values,
521            ps2000_last_button_press,
522            ps2000_set_ets,
523            ps2000_set_led,
524            ps2000_open_unit_async,
525            ps2000_open_unit_progress,
526            ps2000_get_streaming_last_values,
527            ps2000_overview_buffer_status,
528            ps2000_get_streaming_values,
529            ps2000_get_streaming_values_no_aggregation,
530            ps2000_set_light,
531            ps2000_set_sig_gen_arbitrary,
532            ps2000_set_sig_gen_built_in,
533            ps2000SetAdvTriggerChannelProperties,
534            ps2000SetAdvTriggerChannelConditions,
535            ps2000SetAdvTriggerChannelDirections,
536            ps2000SetPulseWidthQualifier,
537            ps2000SetAdvTriggerDelay,
538            ps2000PingUnit,
539        })
540    }
541    pub unsafe fn ps2000_apply_fix(&self, a: u32, b: u16) {
542        let sym = self
543            .ps2000_apply_fix
544            .as_ref()
545            .expect("Expected function, got error.");
546        (sym)(a, b)
547    }
548    pub unsafe fn ps2000_open_unit(&self) -> i16 {
549        let sym = self
550            .ps2000_open_unit
551            .as_ref()
552            .expect("Expected function, got error.");
553        (sym)()
554    }
555    pub unsafe fn ps2000_get_unit_info(
556        &self,
557        handle: i16,
558        string: *mut i8,
559        string_length: i16,
560        line: i16,
561    ) -> i16 {
562        let sym = self
563            .ps2000_get_unit_info
564            .as_ref()
565            .expect("Expected function, got error.");
566        (sym)(handle, string, string_length, line)
567    }
568    pub unsafe fn ps2000_flash_led(&self, handle: i16) -> i16 {
569        let sym = self
570            .ps2000_flash_led
571            .as_ref()
572            .expect("Expected function, got error.");
573        (sym)(handle)
574    }
575    pub unsafe fn ps2000_close_unit(&self, handle: i16) -> i16 {
576        let sym = self
577            .ps2000_close_unit
578            .as_ref()
579            .expect("Expected function, got error.");
580        (sym)(handle)
581    }
582    pub unsafe fn ps2000_set_channel(
583        &self,
584        handle: i16,
585        channel: i16,
586        enabled: i16,
587        dc: i16,
588        range: i16,
589    ) -> i16 {
590        let sym = self
591            .ps2000_set_channel
592            .as_ref()
593            .expect("Expected function, got error.");
594        (sym)(handle, channel, enabled, dc, range)
595    }
596    pub unsafe fn ps2000_get_timebase(
597        &self,
598        handle: i16,
599        timebase: i16,
600        no_of_samples: i32,
601        time_interval: *mut i32,
602        time_units: *mut i16,
603        oversample: i16,
604        max_samples: *mut i32,
605    ) -> i16 {
606        let sym = self
607            .ps2000_get_timebase
608            .as_ref()
609            .expect("Expected function, got error.");
610        (sym)(
611            handle,
612            timebase,
613            no_of_samples,
614            time_interval,
615            time_units,
616            oversample,
617            max_samples,
618        )
619    }
620    pub unsafe fn ps2000_set_trigger(
621        &self,
622        handle: i16,
623        source: i16,
624        threshold: i16,
625        direction: i16,
626        delay: i16,
627        auto_trigger_ms: i16,
628    ) -> i16 {
629        let sym = self
630            .ps2000_set_trigger
631            .as_ref()
632            .expect("Expected function, got error.");
633        (sym)(handle, source, threshold, direction, delay, auto_trigger_ms)
634    }
635    pub unsafe fn ps2000_set_trigger2(
636        &self,
637        handle: i16,
638        source: i16,
639        threshold: i16,
640        direction: i16,
641        delay: f32,
642        auto_trigger_ms: i16,
643    ) -> i16 {
644        let sym = self
645            .ps2000_set_trigger2
646            .as_ref()
647            .expect("Expected function, got error.");
648        (sym)(handle, source, threshold, direction, delay, auto_trigger_ms)
649    }
650    pub unsafe fn ps2000_run_block(
651        &self,
652        handle: i16,
653        no_of_values: i32,
654        timebase: i16,
655        oversample: i16,
656        time_indisposed_ms: *mut i32,
657    ) -> i16 {
658        let sym = self
659            .ps2000_run_block
660            .as_ref()
661            .expect("Expected function, got error.");
662        (sym)(
663            handle,
664            no_of_values,
665            timebase,
666            oversample,
667            time_indisposed_ms,
668        )
669    }
670    pub unsafe fn ps2000_run_streaming(
671        &self,
672        handle: i16,
673        sample_interval_ms: i16,
674        max_samples: i32,
675        windowed: i16,
676    ) -> i16 {
677        let sym = self
678            .ps2000_run_streaming
679            .as_ref()
680            .expect("Expected function, got error.");
681        (sym)(handle, sample_interval_ms, max_samples, windowed)
682    }
683    pub unsafe fn ps2000_run_streaming_ns(
684        &self,
685        handle: i16,
686        sample_interval: u32,
687        time_units: PS2000_TIME_UNITS,
688        max_samples: u32,
689        auto_stop: i16,
690        noOfSamplesPerAggregate: u32,
691        overview_buffer_size: u32,
692    ) -> i16 {
693        let sym = self
694            .ps2000_run_streaming_ns
695            .as_ref()
696            .expect("Expected function, got error.");
697        (sym)(
698            handle,
699            sample_interval,
700            time_units,
701            max_samples,
702            auto_stop,
703            noOfSamplesPerAggregate,
704            overview_buffer_size,
705        )
706    }
707    pub unsafe fn ps2000_ready(&self, handle: i16) -> i16 {
708        let sym = self
709            .ps2000_ready
710            .as_ref()
711            .expect("Expected function, got error.");
712        (sym)(handle)
713    }
714    pub unsafe fn ps2000_stop(&self, handle: i16) -> i16 {
715        let sym = self
716            .ps2000_stop
717            .as_ref()
718            .expect("Expected function, got error.");
719        (sym)(handle)
720    }
721    pub unsafe fn ps2000_get_values(
722        &self,
723        handle: i16,
724        buffer_a: *mut i16,
725        buffer_b: *mut i16,
726        buffer_c: *mut i16,
727        buffer_d: *mut i16,
728        overflow: *mut i16,
729        no_of_values: i32,
730    ) -> i32 {
731        let sym = self
732            .ps2000_get_values
733            .as_ref()
734            .expect("Expected function, got error.");
735        (sym)(
736            handle,
737            buffer_a,
738            buffer_b,
739            buffer_c,
740            buffer_d,
741            overflow,
742            no_of_values,
743        )
744    }
745    pub unsafe fn ps2000_get_times_and_values(
746        &self,
747        handle: i16,
748        times: *mut i32,
749        buffer_a: *mut i16,
750        buffer_b: *mut i16,
751        buffer_c: *mut i16,
752        buffer_d: *mut i16,
753        overflow: *mut i16,
754        time_units: i16,
755        no_of_values: i32,
756    ) -> i32 {
757        let sym = self
758            .ps2000_get_times_and_values
759            .as_ref()
760            .expect("Expected function, got error.");
761        (sym)(
762            handle,
763            times,
764            buffer_a,
765            buffer_b,
766            buffer_c,
767            buffer_d,
768            overflow,
769            time_units,
770            no_of_values,
771        )
772    }
773    pub unsafe fn ps2000_last_button_press(&self, handle: i16) -> i16 {
774        let sym = self
775            .ps2000_last_button_press
776            .as_ref()
777            .expect("Expected function, got error.");
778        (sym)(handle)
779    }
780    pub unsafe fn ps2000_set_ets(
781        &self,
782        handle: i16,
783        mode: i16,
784        ets_cycles: i16,
785        ets_interleave: i16,
786    ) -> i32 {
787        let sym = self
788            .ps2000_set_ets
789            .as_ref()
790            .expect("Expected function, got error.");
791        (sym)(handle, mode, ets_cycles, ets_interleave)
792    }
793    pub unsafe fn ps2000_set_led(&self, handle: i16, state: i16) -> i16 {
794        let sym = self
795            .ps2000_set_led
796            .as_ref()
797            .expect("Expected function, got error.");
798        (sym)(handle, state)
799    }
800    pub unsafe fn ps2000_open_unit_async(&self) -> i16 {
801        let sym = self
802            .ps2000_open_unit_async
803            .as_ref()
804            .expect("Expected function, got error.");
805        (sym)()
806    }
807    pub unsafe fn ps2000_open_unit_progress(
808        &self,
809        handle: *mut i16,
810        progress_percent: *mut i16,
811    ) -> i16 {
812        let sym = self
813            .ps2000_open_unit_progress
814            .as_ref()
815            .expect("Expected function, got error.");
816        (sym)(handle, progress_percent)
817    }
818    pub unsafe fn ps2000_get_streaming_last_values(
819        &self,
820        handle: i16,
821        arg1: GetOverviewBuffersMaxMin,
822    ) -> i16 {
823        let sym = self
824            .ps2000_get_streaming_last_values
825            .as_ref()
826            .expect("Expected function, got error.");
827        (sym)(handle, arg1)
828    }
829    pub unsafe fn ps2000_overview_buffer_status(
830        &self,
831        handle: i16,
832        previous_buffer_overrun: *mut i16,
833    ) -> i16 {
834        let sym = self
835            .ps2000_overview_buffer_status
836            .as_ref()
837            .expect("Expected function, got error.");
838        (sym)(handle, previous_buffer_overrun)
839    }
840    pub unsafe fn ps2000_get_streaming_values(
841        &self,
842        handle: i16,
843        start_time: *mut f64,
844        pbuffer_a_max: *mut i16,
845        pbuffer_a_min: *mut i16,
846        pbuffer_b_max: *mut i16,
847        pbuffer_b_min: *mut i16,
848        pbuffer_c_max: *mut i16,
849        pbuffer_c_min: *mut i16,
850        pbuffer_d_max: *mut i16,
851        pbuffer_d_min: *mut i16,
852        overflow: *mut i16,
853        triggerAt: *mut u32,
854        triggered: *mut i16,
855        no_of_values: u32,
856        noOfSamplesPerAggregate: u32,
857    ) -> u32 {
858        let sym = self
859            .ps2000_get_streaming_values
860            .as_ref()
861            .expect("Expected function, got error.");
862        (sym)(
863            handle,
864            start_time,
865            pbuffer_a_max,
866            pbuffer_a_min,
867            pbuffer_b_max,
868            pbuffer_b_min,
869            pbuffer_c_max,
870            pbuffer_c_min,
871            pbuffer_d_max,
872            pbuffer_d_min,
873            overflow,
874            triggerAt,
875            triggered,
876            no_of_values,
877            noOfSamplesPerAggregate,
878        )
879    }
880    pub unsafe fn ps2000_get_streaming_values_no_aggregation(
881        &self,
882        handle: i16,
883        start_time: *mut f64,
884        pbuffer_a: *mut i16,
885        pbuffer_b: *mut i16,
886        pbuffer_c: *mut i16,
887        pbuffer_d: *mut i16,
888        overflow: *mut i16,
889        triggerAt: *mut u32,
890        trigger: *mut i16,
891        no_of_values: u32,
892    ) -> u32 {
893        let sym = self
894            .ps2000_get_streaming_values_no_aggregation
895            .as_ref()
896            .expect("Expected function, got error.");
897        (sym)(
898            handle,
899            start_time,
900            pbuffer_a,
901            pbuffer_b,
902            pbuffer_c,
903            pbuffer_d,
904            overflow,
905            triggerAt,
906            trigger,
907            no_of_values,
908        )
909    }
910    pub unsafe fn ps2000_set_light(&self, handle: i16, state: i16) -> i16 {
911        let sym = self
912            .ps2000_set_light
913            .as_ref()
914            .expect("Expected function, got error.");
915        (sym)(handle, state)
916    }
917    pub unsafe fn ps2000_set_sig_gen_arbitrary(
918        &self,
919        handle: i16,
920        offsetVoltage: i32,
921        pkToPk: u32,
922        startDeltaPhase: u32,
923        stopDeltaPhase: u32,
924        deltaPhaseIncrement: u32,
925        dwellCount: u32,
926        arbitraryWaveform: *mut u8,
927        arbitraryWaveformSize: i32,
928        sweepType: PS2000_SWEEP_TYPE,
929        sweeps: u32,
930    ) -> i16 {
931        let sym = self
932            .ps2000_set_sig_gen_arbitrary
933            .as_ref()
934            .expect("Expected function, got error.");
935        (sym)(
936            handle,
937            offsetVoltage,
938            pkToPk,
939            startDeltaPhase,
940            stopDeltaPhase,
941            deltaPhaseIncrement,
942            dwellCount,
943            arbitraryWaveform,
944            arbitraryWaveformSize,
945            sweepType,
946            sweeps,
947        )
948    }
949    pub unsafe fn ps2000_set_sig_gen_built_in(
950        &self,
951        handle: i16,
952        offsetVoltage: i32,
953        pkToPk: u32,
954        waveType: PS2000_WAVE_TYPE,
955        startFrequency: f32,
956        stopFrequency: f32,
957        increment: f32,
958        dwellTime: f32,
959        sweepType: PS2000_SWEEP_TYPE,
960        sweeps: u32,
961    ) -> i16 {
962        let sym = self
963            .ps2000_set_sig_gen_built_in
964            .as_ref()
965            .expect("Expected function, got error.");
966        (sym)(
967            handle,
968            offsetVoltage,
969            pkToPk,
970            waveType,
971            startFrequency,
972            stopFrequency,
973            increment,
974            dwellTime,
975            sweepType,
976            sweeps,
977        )
978    }
979    pub unsafe fn ps2000SetAdvTriggerChannelProperties(
980        &self,
981        handle: i16,
982        channelProperties: *mut PS2000_TRIGGER_CHANNEL_PROPERTIES,
983        nChannelProperties: i16,
984        autoTriggerMilliseconds: i32,
985    ) -> i16 {
986        let sym = self
987            .ps2000SetAdvTriggerChannelProperties
988            .as_ref()
989            .expect("Expected function, got error.");
990        (sym)(
991            handle,
992            channelProperties,
993            nChannelProperties,
994            autoTriggerMilliseconds,
995        )
996    }
997    pub unsafe fn ps2000SetAdvTriggerChannelConditions(
998        &self,
999        handle: i16,
1000        conditions: *mut PS2000_TRIGGER_CONDITIONS,
1001        nConditions: i16,
1002    ) -> i16 {
1003        let sym = self
1004            .ps2000SetAdvTriggerChannelConditions
1005            .as_ref()
1006            .expect("Expected function, got error.");
1007        (sym)(handle, conditions, nConditions)
1008    }
1009    pub unsafe fn ps2000SetAdvTriggerChannelDirections(
1010        &self,
1011        handle: i16,
1012        channelA: PS2000_THRESHOLD_DIRECTION,
1013        channelB: PS2000_THRESHOLD_DIRECTION,
1014        channelC: PS2000_THRESHOLD_DIRECTION,
1015        channelD: PS2000_THRESHOLD_DIRECTION,
1016        ext: PS2000_THRESHOLD_DIRECTION,
1017    ) -> i16 {
1018        let sym = self
1019            .ps2000SetAdvTriggerChannelDirections
1020            .as_ref()
1021            .expect("Expected function, got error.");
1022        (sym)(handle, channelA, channelB, channelC, channelD, ext)
1023    }
1024    pub unsafe fn ps2000SetPulseWidthQualifier(
1025        &self,
1026        handle: i16,
1027        conditions: *mut PS2000_PWQ_CONDITIONS,
1028        nConditions: i16,
1029        direction: PS2000_THRESHOLD_DIRECTION,
1030        lower: u32,
1031        upper: u32,
1032        type_: PS2000_PULSE_WIDTH_TYPE,
1033    ) -> i16 {
1034        let sym = self
1035            .ps2000SetPulseWidthQualifier
1036            .as_ref()
1037            .expect("Expected function, got error.");
1038        (sym)(
1039            handle,
1040            conditions,
1041            nConditions,
1042            direction,
1043            lower,
1044            upper,
1045            type_,
1046        )
1047    }
1048    pub unsafe fn ps2000SetAdvTriggerDelay(
1049        &self,
1050        handle: i16,
1051        delay: u32,
1052        preTriggerDelay: f32,
1053    ) -> i16 {
1054        let sym = self
1055            .ps2000SetAdvTriggerDelay
1056            .as_ref()
1057            .expect("Expected function, got error.");
1058        (sym)(handle, delay, preTriggerDelay)
1059    }
1060    pub unsafe fn ps2000PingUnit(&self, handle: i16) -> i16 {
1061        let sym = self
1062            .ps2000PingUnit
1063            .as_ref()
1064            .expect("Expected function, got error.");
1065        (sym)(handle)
1066    }
1067}