"""
Functions defined in the Pico Technology SDK v10.6.10.24
"""
from ctypes import (c_int8, c_int16, c_uint16, c_int32, c_uint32, c_int64,
                    c_uint64, c_float, c_double, c_void_p, POINTER)
from numpy.ctypeslib import ndpointer

from ...picotech import c_enum
from ..errors import PICO_STATUS, PICO_INFO

from .callbacks import (
    GetOverviewBuffersMaxMin,
    BlockReady,
    ps2000aDataReady,
    ps2000aStreamingReady,
    PS3000_CALLBACK_FUNC,
    ps3000aDataReady,
    ps3000aStreamingReady,
    ps4000DataReady,
    ps4000StreamingReady,
    ps4000aDataReady,
    ps4000aStreamingReady,
    ps5000DataReady,
    ps5000StreamingReady,
    ps5000aDataReady,
    ps5000aStreamingReady,
    ps6000DataReady,
    ps6000StreamingReady,
)

from .structs import (
    PS2000ADigitalChannelDirections,
    PS2000APwqConditions,
    PS2000ATriggerChannelProperties,
    PS2000ATriggerConditions,
    PS2000PwqConditions,
    PS2000TriggerChannelProperties,
    PS2000TriggerConditions,
    PS3000ADigitalChannelDirections,
    PS3000APwqConditions,
    PS3000APwqConditionsV2,
    PS3000ATriggerChannelProperties,
    PS3000ATriggerConditions,
    PS3000ATriggerConditionsV2,
    PS3000ATriggerInfo,
    PS3000PwqConditions,
    PS3000TriggerChannelProperties,
    PS3000TriggerConditions,
    PS4000AChannelLedSetting,
    PS4000ACondition,
    PS4000AConnectDetect,
    PS4000ADirection,
    PS4000ATriggerChannelProperties,
    PS4000PwqConditions,
    PS4000TriggerChannelProperties,
    PS4000TriggerConditions,
    PS5000APwqConditions,
    PS5000ATriggerChannelProperties,
    PS5000ATriggerConditions,
    PS5000ATriggerInfo,
    PS5000PwqConditions,
    PS5000TriggerChannelProperties,
    PS5000TriggerConditions,
    PS6000PwqConditions,
    PS6000TriggerChannelProperties,
    PS6000TriggerConditions
)

# The structure for each item in a *_funcptrs list is:
#
# (SDK_function_name, an_alias_for_the_function_name, return_data_type, errcheck_callable,
#    (ctype, SDK_type, SDK_argument_name),


# ************************ SDK functions for ps2000 ************************


ps2000_funcptrs = [
    ('ps2000PingUnit', 'PingUnit', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps2000SetAdvTriggerChannelConditions', 'SetAdvTriggerChannelConditions', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS2000TriggerConditions), 'PS2000_TRIGGER_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions')]
     ),
    ('ps2000SetAdvTriggerChannelDirections', 'SetAdvTriggerChannelDirections', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS2000_THRESHOLD_DIRECTION', 'channelA'),
      (c_enum, 'PS2000_THRESHOLD_DIRECTION', 'channelB'),
      (c_enum, 'PS2000_THRESHOLD_DIRECTION', 'channelC'),
      (c_enum, 'PS2000_THRESHOLD_DIRECTION', 'channelD'),
      (c_enum, 'PS2000_THRESHOLD_DIRECTION', 'ext')]
     ),
    ('ps2000SetAdvTriggerChannelProperties', 'SetAdvTriggerChannelProperties', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS2000TriggerChannelProperties), 'PS2000_TRIGGER_CHANNEL_PROPERTIES*', 'channelProperties'),
      (c_int16, 'int16_t', 'nChannelProperties'),
      (c_int32, 'int32_t', 'autoTriggerMilliseconds')]
     ),
    ('ps2000SetAdvTriggerDelay', 'SetAdvTriggerDelay', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'delay'),
      (c_float, 'float', 'preTriggerDelay')]
     ),
    ('ps2000SetPulseWidthQualifier', 'SetPulseWidthQualifier', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS2000PwqConditions), 'PS2000_PWQ_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'PS2000_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PS2000_PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps2000_close_unit', 'CloseUnit', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps2000_flash_led', 'FlashLed', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps2000_get_streaming_last_values', 'GetStreamingLastValues', c_int16, None, # removed 'errcheck_zero': Accoring to the manual, this method may return 0 or 1
     [(c_int16, 'int16_t', 'handle'),
      (GetOverviewBuffersMaxMin, 'GetOverviewBuffersMaxMin', 'lpGetOverviewBuffersMaxMin')]
     ),
    ('ps2000_get_streaming_values', 'GetStreamingValues', c_uint32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_double), 'double*', 'start_time'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_a_max'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_a_min'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_b_max'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_b_min'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_c_max'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_c_min'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_d_max'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_d_min'),
      (POINTER(c_int16), 'int16_t*', 'overflow'),
      (POINTER(c_uint32), 'uint32_t*', 'triggerAt'),
      (POINTER(c_int16), 'int16_t*', 'triggered'),
      (c_uint32, 'uint32_t', 'no_of_values'),
      (c_uint32, 'uint32_t', 'noOfSamplesPerAggregate')]
     ),
    ('ps2000_get_streaming_values_no_aggregation', 'GetStreamingValuesNoAggregation', c_uint32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_double), 'double*', 'start_time'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_a'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_b'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_c'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_d'),
      (POINTER(c_int16), 'int16_t*', 'overflow'),
      (POINTER(c_uint32), 'uint32_t*', 'triggerAt'),
      (POINTER(c_int16), 'int16_t*', 'trigger'),
      (c_uint32, 'uint32_t', 'no_of_values')]
     ),
    ('ps2000_get_timebase', 'GetTimebase', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'timebase'),
      (c_int32, 'int32_t', 'no_of_samples'),
      (POINTER(c_int32), 'int32_t*', 'time_interval'),
      (POINTER(c_int16), 'int16_t*', 'time_units'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'max_samples')]
     ),
    ('ps2000_get_times_and_values', 'GetTimesAndValues', c_int32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int32), 'int32_t*', 'times'),
      (POINTER(c_int16), 'int16_t*', 'buffer_a'),
      (POINTER(c_int16), 'int16_t*', 'buffer_b'),
      (POINTER(c_int16), 'int16_t*', 'buffer_c'),
      (POINTER(c_int16), 'int16_t*', 'buffer_d'),
      (POINTER(c_int16), 'int16_t*', 'overflow'),
      (c_int16, 'int16_t', 'time_units'),
      (c_int32, 'int32_t', 'no_of_values')]
     ),
    ('ps2000_get_unit_info', 'GetUnitInfo', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (c_int16, 'int16_t', 'string_length'),
      (c_int16, 'int16_t', 'line')]
     ),
    ('ps2000_get_values', 'GetValues', c_int32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'buffer_a'),
      (POINTER(c_int16), 'int16_t*', 'buffer_b'),
      (POINTER(c_int16), 'int16_t*', 'buffer_c'),
      (POINTER(c_int16), 'int16_t*', 'buffer_d'),
      (POINTER(c_int16), 'int16_t*', 'overflow'),
      (c_int32, 'int32_t', 'no_of_values')]
     ),
    ('ps2000_last_button_press', 'LastButtonPress', c_int16, None,
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps2000_open_unit', 'OpenUnit', c_int16, None,
     []
     ),
    ('ps2000_open_unit_async', 'OpenUnitAsync', c_int16, None,
     []
     ),
    ('ps2000_open_unit_progress', 'OpenUnitProgress', c_int16, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'progress_percent')]
     ),
    ('ps2000_overview_buffer_status', 'OverviewBufferStatus', c_int16, 'errcheck_one',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'previous_buffer_overrun')]
     ),
    ('ps2000_ready', 'Ready', c_int16, 'errcheck_negative_one',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps2000_run_block', 'RunBlock', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'no_of_values'),
      (c_int16, 'int16_t', 'timebase'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'time_indisposed_ms')]
     ),
    ('ps2000_run_streaming', 'RunStreaming', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'sample_interval_ms'),
      (c_int32, 'int32_t', 'max_samples'),
      (c_int16, 'int16_t', 'windowed')]
     ),
    ('ps2000_run_streaming_ns', 'RunStreamingNs', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'sample_interval'),
      (c_enum, 'PS2000_TIME_UNITS', 'time_units'),
      (c_uint32, 'uint32_t', 'max_samples'),
      (c_int16, 'int16_t', 'auto_stop'),
      (c_uint32, 'uint32_t', 'noOfSamplesPerAggregate'),
      (c_uint32, 'uint32_t', 'overview_buffer_size')]
     ),
    ('ps2000_set_channel', 'SetChannel', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_int16, 'int16_t', 'dc'),
      (c_int16, 'int16_t', 'range')]
     ),
    ('ps2000_set_ets', 'SetEts', c_int32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'mode'),
      (c_int16, 'int16_t', 'ets_cycles'),
      (c_int16, 'int16_t', 'ets_interleave')]
     ),
    ('ps2000_set_led', 'SetLed', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
    ('ps2000_set_light', 'SetLight', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
    ('ps2000_set_sig_gen_arbitrary', 'SetSigGenArbitrary', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (ndpointer(dtype=c_int8, ndim=1, flags='C_CONTIGUOUS'), 'uint8_t*', 'arbitraryWaveform'),
      (c_int32, 'int32_t', 'arbitraryWaveformSize'),
      (c_enum, 'PS2000_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'sweeps')]
     ),
    ('ps2000_set_sig_gen_built_in', 'SetSigGenBuiltIn', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_enum, 'PS2000_WAVE_TYPE', 'waveType'),
      (c_float, 'float', 'startFrequency'),
      (c_float, 'float', 'stopFrequency'),
      (c_float, 'float', 'increment'),
      (c_float, 'float', 'dwellTime'),
      (c_enum, 'PS2000_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'sweeps')]
     ),
    ('ps2000_set_trigger', 'SetTrigger', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_int16, 'int16_t', 'direction'),
      (c_int16, 'int16_t', 'delay'),
      (c_int16, 'int16_t', 'auto_trigger_ms')]
     ),
    ('ps2000_set_trigger2', 'SetTrigger2', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_int16, 'int16_t', 'direction'),
      (c_float, 'float', 'delay'),
      (c_int16, 'int16_t', 'auto_trigger_ms')]
     ),
    ('ps2000_stop', 'Stop', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle')]
     ),
]


# ************************ SDK functions for ps2000aApi ************************


ps2000aApi_funcptrs = [
    ('ps2000aCloseUnit', 'CloseUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps2000aEnumerateUnits', 'EnumerateUnits', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'count'),
      (POINTER(c_int8), 'int8_t*', 'serials'),
      (POINTER(c_int16), 'int16_t*', 'serialLth')]
     ),
    ('ps2000aFlashLed', 'FlashLed', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'start')]
     ),
    ('ps2000aGetAnalogueOffset', 'GetAnalogueOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS2000A_RANGE', 'range'),
      (c_enum, 'PS2000A_COUPLING', 'coupling'),
      (POINTER(c_float), 'float*', 'maximumVoltage'),
      (POINTER(c_float), 'float*', 'minimumVoltage')]
     ),
    ('ps2000aGetChannelInformation', 'GetChannelInformation', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS2000A_CHANNEL_INFO', 'info'),
      (c_int32, 'int32_t', 'probe'),
      (POINTER(c_int32), 'int32_t*', 'ranges'),
      (POINTER(c_int32), 'int32_t*', 'length'),
      (c_int32, 'int32_t', 'channels')]
     ),
    ('ps2000aGetMaxDownSampleRatio', 'GetMaxDownSampleRatio', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'noOfUnaggreatedSamples'),
      (POINTER(c_uint32), 'uint32_t*', 'maxDownSampleRatio'),
      (c_enum, 'PS2000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps2000aGetMaxSegments', 'GetMaxSegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint16), 'uint16_t*', 'maxSegments')]
     ),
    ('ps2000aGetNoOfCaptures', 'GetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nCaptures')]
     ),
    ('ps2000aGetNoOfProcessedCaptures', 'GetNoOfProcessedCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nProcessedCaptures')]
     ),
    ('ps2000aGetStreamingLatestValues', 'GetStreamingLatestValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (ps2000aStreamingReady, 'ps2000aStreamingReady', 'lpPs'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps2000aGetTimebase', 'GetTimebase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_int32), 'int32_t*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps2000aGetTimebase2', 'GetTimebase2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_float), 'float*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps2000aGetTriggerTimeOffset', 'GetTriggerTimeOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (POINTER(c_enum), 'PS2000A_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps2000aGetTriggerTimeOffset64', 'GetTriggerTimeOffset64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'time'),
      (POINTER(c_enum), 'PS2000A_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps2000aGetUnitInfo', 'GetUnitInfo', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (c_int16, 'int16_t', 'stringLength'),
      (POINTER(c_int16), 'int16_t*', 'requiredSize'),
      (PICO_INFO, 'PICO_INFO', 'info')]
     ),
    ('ps2000aGetValues', 'GetValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS2000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps2000aGetValuesAsync', 'GetValuesAsync', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (c_uint32, 'uint32_t', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_int16, 'int16_t', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (ps2000aDataReady, 'void*', 'lpDataReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps2000aGetValuesBulk', 'GetValuesBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS2000A_RATIO_MODE', 'downSampleRatioMode'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps2000aGetValuesOverlapped', 'GetValuesOverlapped', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS2000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps2000aGetValuesOverlappedBulk', 'GetValuesOverlappedBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS2000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps2000aGetValuesTriggerTimeOffsetBulk', 'GetValuesTriggerTimeOffsetBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timesUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timesLower'),
      (POINTER(c_enum), 'PS2000A_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex')]
     ),
    ('ps2000aGetValuesTriggerTimeOffsetBulk64', 'GetValuesTriggerTimeOffsetBulk64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'times'),
      (POINTER(c_enum), 'PS2000A_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex')]
     ),
    ('ps2000aHoldOff', 'HoldOff', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint64, 'uint64_t', 'holdoff'),
      (c_enum, 'PS2000A_HOLDOFF_TYPE', 'type')]
     ),
    ('ps2000aIsReady', 'IsReady', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'ready')]
     ),
    ('ps2000aIsTriggerOrPulseWidthQualifierEnabled', 'IsTriggerOrPulseWidthQualifierEnabled', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'triggerEnabled'),
      (POINTER(c_int16), 'int16_t*', 'pulseWidthQualifierEnabled')]
     ),
    ('ps2000aMaximumValue', 'MaximumValue', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'value')]
     ),
    ('ps2000aMemorySegments', 'MemorySegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint16, 'uint16_t', 'nSegments'),
      (POINTER(c_int32), 'int32_t*', 'nMaxSamples')]
     ),
    ('ps2000aMinimumValue', 'MinimumValue', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'value')]
     ),
    ('ps2000aNoOfStreamingValues', 'NoOfStreamingValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfValues')]
     ),
    ('ps2000aOpenUnit', 'OpenUnit', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps2000aOpenUnitAsync', 'OpenUnitAsync', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'status'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps2000aOpenUnitProgress', 'OpenUnitProgress', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'progressPercent'),
      (POINTER(c_int16), 'int16_t*', 'complete')]
     ),
    ('ps2000aPingUnit', 'PingUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps2000aRunBlock', 'RunBlock', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'noOfPreTriggerSamples'),
      (c_int32, 'int32_t', 'noOfPostTriggerSamples'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'timeIndisposedMs'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (BlockReady, 'ps2000aBlockReady', 'lpReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps2000aRunStreaming', 'RunStreaming', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'sampleInterval'),
      (c_enum, 'PS2000A_TIME_UNITS', 'sampleIntervalTimeUnits'),
      (c_uint32, 'uint32_t', 'maxPreTriggerSamples'),
      (c_uint32, 'uint32_t', 'maxPostPreTriggerSamples'),
      (c_int16, 'int16_t', 'autoStop'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS2000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'overviewBufferSize')]
     ),
    ('ps2000aSetChannel', 'SetChannel', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS2000A_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_enum, 'PS2000A_COUPLING', 'type'),
      (c_enum, 'PS2000A_RANGE', 'range'),
      (c_float, 'float', 'analogOffset')]
     ),
    ('ps2000aSetDataBuffer', 'SetDataBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'channelOrPort'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (c_enum, 'PS2000A_RATIO_MODE', 'mode')]
     ),
    ('ps2000aSetDataBuffers', 'SetDataBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'channelOrPort'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (c_enum, 'PS2000A_RATIO_MODE', 'mode')]
     ),
    ('ps2000aSetDigitalAnalogTriggerOperand', 'SetDigitalAnalogTriggerOperand', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS2000A_TRIGGER_OPERAND', 'operand')]
     ),
    ('ps2000aSetDigitalPort', 'SetDigitalPort', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS2000A_DIGITAL_PORT', 'port'),
      (c_int16, 'int16_t', 'enabled'),
      (c_int16, 'int16_t', 'logicLevel')]
     ),
    ('ps2000aSetEts', 'SetEts', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS2000A_ETS_MODE', 'mode'),
      (c_int16, 'int16_t', 'etsCycles'),
      (c_int16, 'int16_t', 'etsInterleave'),
      (POINTER(c_int32), 'int32_t*', 'sampleTimePicoseconds')]
     ),
    ('ps2000aSetEtsTimeBuffer', 'SetEtsTimeBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps2000aSetEtsTimeBuffers', 'SetEtsTimeBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps2000aSetNoOfCaptures', 'SetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint16, 'uint16_t', 'nCaptures')]
     ),
    ('ps2000aSetPulseWidthQualifier', 'SetPulseWidthQualifier', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS2000APwqConditions), 'PS2000A_PWQ_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'PS2000A_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PS2000A_PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps2000aSetSigGenArbitrary', 'SetSigGenArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (ndpointer(dtype=c_int16, ndim=1, flags='C_CONTIGUOUS'), 'int16_t*', 'arbitraryWaveform'),
      (c_int32, 'int32_t', 'arbitraryWaveformSize'),
      (c_enum, 'PS2000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS2000A_EXTRA_OPERATIONS', 'operation'),
      (c_enum, 'PS2000A_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps2000aSetSigGenBuiltIn', 'SetSigGenBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_int16, 'int16_t', 'waveType'),
      (c_float, 'float', 'startFrequency'),
      (c_float, 'float', 'stopFrequency'),
      (c_float, 'float', 'increment'),
      (c_float, 'float', 'dwellTime'),
      (c_enum, 'PS2000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS2000A_EXTRA_OPERATIONS', 'operation'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps2000aSetSigGenBuiltInV2', 'SetSigGenBuiltInV2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_int16, 'int16_t', 'waveType'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS2000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS2000A_EXTRA_OPERATIONS', 'operation'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps2000aSetSigGenPropertiesArbitrary', 'SetSigGenPropertiesArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (c_enum, 'PS2000A_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps2000aSetSigGenPropertiesBuiltIn', 'SetSigGenPropertiesBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS2000A_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS2000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps2000aSetSimpleTrigger', 'SetSimpleTrigger', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'enable'),
      (c_enum, 'PS2000A_CHANNEL', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_enum, 'PS2000A_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'delay'),
      (c_int16, 'int16_t', 'autoTrigger_ms')]
     ),
    ('ps2000aSetTriggerChannelConditions', 'SetTriggerChannelConditions', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS2000ATriggerConditions), 'PS2000A_TRIGGER_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions')]
     ),
    ('ps2000aSetTriggerChannelDirections', 'SetTriggerChannelDirections', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS2000A_THRESHOLD_DIRECTION', 'channelA'),
      (c_enum, 'PS2000A_THRESHOLD_DIRECTION', 'channelB'),
      (c_enum, 'PS2000A_THRESHOLD_DIRECTION', 'channelC'),
      (c_enum, 'PS2000A_THRESHOLD_DIRECTION', 'channelD'),
      (c_enum, 'PS2000A_THRESHOLD_DIRECTION', 'ext'),
      (c_enum, 'PS2000A_THRESHOLD_DIRECTION', 'aux')]
     ),
    ('ps2000aSetTriggerChannelProperties', 'SetTriggerChannelProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS2000ATriggerChannelProperties), 'PS2000A_TRIGGER_CHANNEL_PROPERTIES*', 'channelProperties'),
      (c_int16, 'int16_t', 'nChannelProperties'),
      (c_int16, 'int16_t', 'auxOutputEnable'),
      (c_int32, 'int32_t', 'autoTriggerMilliseconds')]
     ),
    ('ps2000aSetTriggerDelay', 'SetTriggerDelay', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'delay')]
     ),
    ('ps2000aSetTriggerDigitalPortProperties', 'SetTriggerDigitalPortProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS2000ADigitalChannelDirections), 'PS2000A_DIGITAL_CHANNEL_DIRECTIONS*', 'directions'),
      (c_int16, 'int16_t', 'nDirections')]
     ),
    ('ps2000aSigGenArbitraryMinMaxValues', 'SigGenArbitraryMinMaxValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'minArbitraryWaveformValue'),
      (POINTER(c_int16), 'int16_t*', 'maxArbitraryWaveformValue'),
      (POINTER(c_uint32), 'uint32_t*', 'minArbitraryWaveformSize'),
      (POINTER(c_uint32), 'uint32_t*', 'maxArbitraryWaveformSize')]
     ),
    ('ps2000aSigGenFrequencyToPhase', 'SigGenFrequencyToPhase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'frequency'),
      (c_enum, 'PS2000A_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'bufferLength'),
      (POINTER(c_uint32), 'uint32_t*', 'phase')]
     ),
    ('ps2000aSigGenSoftwareControl', 'SigGenSoftwareControl', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
    ('ps2000aStop', 'Stop', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
]


# ************************ SDK functions for ps3000 ************************


ps3000_funcptrs = [
    ('ps3000PingUnit', 'PingUnit', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps3000SetAdvTriggerChannelConditions', 'SetAdvTriggerChannelConditions', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000TriggerConditions), 'TRIGGER_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions')]
     ),
    ('ps3000SetAdvTriggerChannelDirections', 'SetAdvTriggerChannelDirections', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelA'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelB'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelC'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelD'),
      (c_enum, 'THRESHOLD_DIRECTION', 'ext')]
     ),
    ('ps3000SetAdvTriggerChannelProperties', 'SetAdvTriggerChannelProperties', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000TriggerChannelProperties), 'TRIGGER_CHANNEL_PROPERTIES*', 'channelProperties'),
      (c_int16, 'int16_t', 'nChannelProperties'),
      (c_int32, 'int32_t', 'autoTriggerMilliseconds')]
     ),
    ('ps3000SetAdvTriggerDelay', 'SetAdvTriggerDelay', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'delay'),
      (c_float, 'float', 'preTriggerDelay')]
     ),
    ('ps3000SetPulseWidthQualifier', 'SetPulseWidthQualifier', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000PwqConditions), 'PWQ_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps3000_close_unit', 'CloseUnit', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps3000_flash_led', 'FlashLed', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps3000_get_streaming_last_values', 'GetStreamingLastValues', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (GetOverviewBuffersMaxMin, 'GetOverviewBuffersMaxMin', 'lpGetOverviewBuffersMaxMin')]
     ),
    ('ps3000_get_streaming_values', 'GetStreamingValues', c_uint32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_double), 'double*', 'start_time'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_a_max'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_a_min'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_b_max'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_b_min'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_c_max'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_c_min'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_d_max'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_d_min'),
      (POINTER(c_int16), 'int16_t*', 'overflow'),
      (POINTER(c_uint32), 'uint32_t*', 'triggerAt'),
      (POINTER(c_int16), 'int16_t*', 'triggered'),
      (c_uint32, 'uint32_t', 'no_of_values'),
      (c_uint32, 'uint32_t', 'noOfSamplesPerAggregate')]
     ),
    ('ps3000_get_streaming_values_no_aggregation', 'GetStreamingValuesNoAggregation', c_uint32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_double), 'double*', 'start_time'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_a'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_b'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_c'),
      (POINTER(c_int16), 'int16_t*', 'pbuffer_d'),
      (POINTER(c_int16), 'int16_t*', 'overflow'),
      (POINTER(c_uint32), 'uint32_t*', 'triggerAt'),
      (POINTER(c_int16), 'int16_t*', 'trigger'),
      (c_uint32, 'uint32_t', 'no_of_values')]
     ),
    ('ps3000_get_timebase', 'GetTimebase', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'timebase'),
      (c_int32, 'int32_t', 'no_of_samples'),
      (POINTER(c_int32), 'int32_t*', 'time_interval'),
      (POINTER(c_int16), 'int16_t*', 'time_units'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'max_samples')]
     ),
    ('ps3000_get_times_and_values', 'GetTimesAndValues', c_int32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int32), 'int32_t*', 'times'),
      (POINTER(c_int16), 'int16_t*', 'buffer_a'),
      (POINTER(c_int16), 'int16_t*', 'buffer_b'),
      (POINTER(c_int16), 'int16_t*', 'buffer_c'),
      (POINTER(c_int16), 'int16_t*', 'buffer_d'),
      (POINTER(c_int16), 'int16_t*', 'overflow'),
      (c_int16, 'int16_t', 'time_units'),
      (c_int32, 'int32_t', 'no_of_values')]
     ),
    ('ps3000_get_unit_info', 'GetUnitInfo', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (c_int16, 'int16_t', 'string_length'),
      (c_int16, 'int16_t', 'line')]
     ),
    ('ps3000_get_values', 'GetValues', c_int32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'buffer_a'),
      (POINTER(c_int16), 'int16_t*', 'buffer_b'),
      (POINTER(c_int16), 'int16_t*', 'buffer_c'),
      (POINTER(c_int16), 'int16_t*', 'buffer_d'),
      (POINTER(c_int16), 'int16_t*', 'overflow'),
      (c_int32, 'int32_t', 'no_of_values')]
     ),
    ('ps3000_open_unit', 'OpenUnit', c_int16, None,
     []
     ),
    ('ps3000_open_unit_async', 'OpenUnitAsync', c_int16, None,
     []
     ),
    ('ps3000_open_unit_progress', 'OpenUnitProgress', c_int16, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'progress_percent')]
     ),
    ('ps3000_overview_buffer_status', 'OverviewBufferStatus', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'previous_buffer_overrun')]
     ),
    ('ps3000_ready', 'Ready', c_int16, 'errcheck_negative_one',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps3000_release_stream_buffer', 'ReleaseStreamBuffer', c_void_p, None,
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps3000_run_block', 'RunBlock', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'no_of_values'),
      (c_int16, 'int16_t', 'timebase'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'time_indisposed_ms')]
     ),
    ('ps3000_run_streaming', 'RunStreaming', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'sample_interval_ms'),
      (c_int32, 'int32_t', 'max_samples'),
      (c_int16, 'int16_t', 'windowed')]
     ),
    ('ps3000_run_streaming_ns', 'RunStreamingNs', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'sample_interval'),
      (c_enum, 'PS3000_TIME_UNITS', 'time_units'),
      (c_uint32, 'uint32_t', 'max_samples'),
      (c_int16, 'int16_t', 'auto_stop'),
      (c_uint32, 'uint32_t', 'noOfSamplesPerAggregate'),
      (c_uint32, 'uint32_t', 'overview_buffer_size')]
     ),
    ('ps3000_save_streaming_data', 'SaveStreamingData', c_int16, None,
     [(c_int16, 'int16_t', 'handle'),
      (PS3000_CALLBACK_FUNC, 'PS3000_CALLBACK_FUNC', 'lpCallbackFunc'),
      (POINTER(c_int16), 'int16_t*', 'dataBuffers'),
      (c_int16, 'int16_t', 'dataBufferSize')]
     ),
    ('ps3000_set_channel', 'SetChannel', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_int16, 'int16_t', 'dc'),
      (c_int16, 'int16_t', 'range')]
     ),
    ('ps3000_set_ets', 'SetEts', c_int32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'mode'),
      (c_int16, 'int16_t', 'ets_cycles'),
      (c_int16, 'int16_t', 'ets_interleave')]
     ),
    ('ps3000_set_siggen', 'SetSiggen', c_int32, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'wave_type'),
      (c_int32, 'int32_t', 'start_frequency'),
      (c_int32, 'int32_t', 'stop_frequency'),
      (c_float, 'float', 'increment'),
      (c_int16, 'int16_t', 'dwell_time'),
      (c_int16, 'int16_t', 'repeat'),
      (c_int16, 'int16_t', 'dual_slope')]
     ),
    ('ps3000_set_trigger', 'SetTrigger', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_int16, 'int16_t', 'direction'),
      (c_int16, 'int16_t', 'delay'),
      (c_int16, 'int16_t', 'auto_trigger_ms')]
     ),
    ('ps3000_set_trigger2', 'SetTrigger2', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_int16, 'int16_t', 'direction'),
      (c_float, 'float', 'delay'),
      (c_int16, 'int16_t', 'auto_trigger_ms')]
     ),
    ('ps3000_stop', 'Stop', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps3000_streaming_ns_get_interval_stateless', 'StreamingNsGetIntervalStateless', c_int16, 'errcheck_zero',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'nChannels'),
      (POINTER(c_uint32), 'uint32_t*', 'sample_interval')]
     ),
]


# ************************ SDK functions for ps3000aApi ************************


ps3000aApi_funcptrs = [
    ('ps3000aChangePowerSource', 'ChangePowerSource', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (PICO_STATUS, 'PICO_STATUS', 'powerState')]
     ),
    ('ps3000aCloseUnit', 'CloseUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps3000aCurrentPowerSource', 'CurrentPowerSource', PICO_STATUS, None,
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps3000aEnumerateUnits', 'EnumerateUnits', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'count'),
      (POINTER(c_int8), 'int8_t*', 'serials'),
      (POINTER(c_int16), 'int16_t*', 'serialLth')]
     ),
    ('ps3000aFlashLed', 'FlashLed', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'start')]
     ),
    ('ps3000aGetAnalogueOffset', 'GetAnalogueOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS3000A_RANGE', 'range'),
      (c_enum, 'PS3000A_COUPLING', 'coupling'),
      (POINTER(c_float), 'float*', 'maximumVoltage'),
      (POINTER(c_float), 'float*', 'minimumVoltage')]
     ),
    ('ps3000aGetChannelInformation', 'GetChannelInformation', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS3000A_CHANNEL_INFO', 'info'),
      (c_int32, 'int32_t', 'probe'),
      (POINTER(c_int32), 'int32_t*', 'ranges'),
      (POINTER(c_int32), 'int32_t*', 'length'),
      (c_int32, 'int32_t', 'channels')]
     ),
    ('ps3000aGetMaxDownSampleRatio', 'GetMaxDownSampleRatio', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'noOfUnaggreatedSamples'),
      (POINTER(c_uint32), 'uint32_t*', 'maxDownSampleRatio'),
      (c_enum, 'PS3000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps3000aGetMaxEtsValues', 'GetMaxEtsValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'etsCycles'),
      (POINTER(c_int16), 'int16_t*', 'etsInterleave')]
     ),
    ('ps3000aGetMaxSegments', 'GetMaxSegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'maxSegments')]
     ),
    ('ps3000aGetNoOfCaptures', 'GetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nCaptures')]
     ),
    ('ps3000aGetNoOfProcessedCaptures', 'GetNoOfProcessedCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nProcessedCaptures')]
     ),
    ('ps3000aGetStreamingLatestValues', 'GetStreamingLatestValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (ps3000aStreamingReady, 'ps3000aStreamingReady', 'lpPs'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps3000aGetTimebase', 'GetTimebase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_int32), 'int32_t*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps3000aGetTimebase2', 'GetTimebase2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_float), 'float*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps3000aGetTriggerInfoBulk', 'GetTriggerInfoBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000ATriggerInfo), 'PS3000A_TRIGGER_INFO*', 'triggerInfo'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps3000aGetTriggerTimeOffset', 'GetTriggerTimeOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (POINTER(c_enum), 'PS3000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps3000aGetTriggerTimeOffset64', 'GetTriggerTimeOffset64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'time'),
      (POINTER(c_enum), 'PS3000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps3000aGetUnitInfo', 'GetUnitInfo', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (c_int16, 'int16_t', 'stringLength'),
      (POINTER(c_int16), 'int16_t*', 'requiredSize'),
      (PICO_INFO, 'PICO_INFO', 'info')]
     ),
    ('ps3000aGetValues', 'GetValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS3000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps3000aGetValuesAsync', 'GetValuesAsync', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (c_uint32, 'uint32_t', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_int16, 'int16_t', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (ps3000aDataReady, 'void*', 'lpDataReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps3000aGetValuesBulk', 'GetValuesBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS3000A_RATIO_MODE', 'downSampleRatioMode'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps3000aGetValuesOverlapped', 'GetValuesOverlapped', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS3000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps3000aGetValuesOverlappedBulk', 'GetValuesOverlappedBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS3000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps3000aGetValuesTriggerTimeOffsetBulk', 'GetValuesTriggerTimeOffsetBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timesUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timesLower'),
      (POINTER(c_enum), 'PS3000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps3000aGetValuesTriggerTimeOffsetBulk64', 'GetValuesTriggerTimeOffsetBulk64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'times'),
      (POINTER(c_enum), 'PS3000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps3000aHoldOff', 'HoldOff', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint64, 'uint64_t', 'holdoff'),
      (c_enum, 'PS3000A_HOLDOFF_TYPE', 'type')]
     ),
    ('ps3000aIsReady', 'IsReady', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'ready')]
     ),
    ('ps3000aIsTriggerOrPulseWidthQualifierEnabled', 'IsTriggerOrPulseWidthQualifierEnabled', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'triggerEnabled'),
      (POINTER(c_int16), 'int16_t*', 'pulseWidthQualifierEnabled')]
     ),
    ('ps3000aMaximumValue', 'MaximumValue', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'value')]
     ),
    ('ps3000aMemorySegments', 'MemorySegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'nSegments'),
      (POINTER(c_int32), 'int32_t*', 'nMaxSamples')]
     ),
    ('ps3000aMinimumValue', 'MinimumValue', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'value')]
     ),
    ('ps3000aNoOfStreamingValues', 'NoOfStreamingValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfValues')]
     ),
    ('ps3000aOpenUnit', 'OpenUnit', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps3000aOpenUnitAsync', 'OpenUnitAsync', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'status'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps3000aOpenUnitProgress', 'OpenUnitProgress', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'progressPercent'),
      (POINTER(c_int16), 'int16_t*', 'complete')]
     ),
    ('ps3000aPingUnit', 'PingUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps3000aRunBlock', 'RunBlock', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'noOfPreTriggerSamples'),
      (c_int32, 'int32_t', 'noOfPostTriggerSamples'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'timeIndisposedMs'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (BlockReady, 'ps3000aBlockReady', 'lpReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps3000aRunStreaming', 'RunStreaming', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'sampleInterval'),
      (c_enum, 'PS3000A_TIME_UNITS', 'sampleIntervalTimeUnits'),
      (c_uint32, 'uint32_t', 'maxPreTriggerSamples'),
      (c_uint32, 'uint32_t', 'maxPostPreTriggerSamples'),
      (c_int16, 'int16_t', 'autoStop'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS3000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'overviewBufferSize')]
     ),
    ('ps3000aSetBandwidthFilter', 'SetBandwidthFilter', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS3000A_CHANNEL', 'channel'),
      (c_enum, 'PS3000A_BANDWIDTH_LIMITER', 'bandwidth')]
     ),
    ('ps3000aSetChannel', 'SetChannel', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS3000A_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_enum, 'PS3000A_COUPLING', 'type'),
      (c_enum, 'PS3000A_RANGE', 'range'),
      (c_float, 'float', 'analogOffset')]
     ),
    ('ps3000aSetDataBuffer', 'SetDataBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS3000A_CHANNEL', 'channelOrPort'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (c_enum, 'PS3000A_RATIO_MODE', 'mode')]
     ),
    ('ps3000aSetDataBuffers', 'SetDataBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS3000A_CHANNEL', 'channelOrPort'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (c_enum, 'PS3000A_RATIO_MODE', 'mode')]
     ),
    ('ps3000aSetDigitalPort', 'SetDigitalPort', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS3000A_DIGITAL_PORT', 'port'),
      (c_int16, 'int16_t', 'enabled'),
      (c_int16, 'int16_t', 'logicLevel')]
     ),
    ('ps3000aSetEts', 'SetEts', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS3000A_ETS_MODE', 'mode'),
      (c_int16, 'int16_t', 'etsCycles'),
      (c_int16, 'int16_t', 'etsInterleave'),
      (POINTER(c_int32), 'int32_t*', 'sampleTimePicoseconds')]
     ),
    ('ps3000aSetEtsTimeBuffer', 'SetEtsTimeBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps3000aSetEtsTimeBuffers', 'SetEtsTimeBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps3000aSetNoOfCaptures', 'SetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'nCaptures')]
     ),
    ('ps3000aSetPulseWidthDigitalPortProperties', 'SetPulseWidthDigitalPortProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000ADigitalChannelDirections), 'PS3000A_DIGITAL_CHANNEL_DIRECTIONS*', 'directions'),
      (c_int16, 'int16_t', 'nDirections')]
     ),
    ('ps3000aSetPulseWidthQualifier', 'SetPulseWidthQualifier', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000APwqConditions), 'PS3000A_PWQ_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'PS3000A_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PS3000A_PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps3000aSetPulseWidthQualifierV2', 'SetPulseWidthQualifierV2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000APwqConditionsV2), 'PS3000A_PWQ_CONDITIONS_V2*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'PS3000A_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PS3000A_PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps3000aSetSigGenArbitrary', 'SetSigGenArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (ndpointer(dtype=c_int16, ndim=1, flags='C_CONTIGUOUS'), 'int16_t*', 'arbitraryWaveform'),
      (c_int32, 'int32_t', 'arbitraryWaveformSize'),
      (c_enum, 'PS3000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS3000A_EXTRA_OPERATIONS', 'operation'),
      (c_enum, 'PS3000A_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps3000aSetSigGenBuiltIn', 'SetSigGenBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_int16, 'int16_t', 'waveType'),
      (c_float, 'float', 'startFrequency'),
      (c_float, 'float', 'stopFrequency'),
      (c_float, 'float', 'increment'),
      (c_float, 'float', 'dwellTime'),
      (c_enum, 'PS3000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS3000A_EXTRA_OPERATIONS', 'operation'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps3000aSetSigGenBuiltInV2', 'SetSigGenBuiltInV2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_int16, 'int16_t', 'waveType'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS3000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS3000A_EXTRA_OPERATIONS', 'operation'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps3000aSetSigGenPropertiesArbitrary', 'SetSigGenPropertiesArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (c_enum, 'PS3000A_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps3000aSetSigGenPropertiesBuiltIn', 'SetSigGenPropertiesBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS3000A_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS3000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps3000aSetSimpleTrigger', 'SetSimpleTrigger', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'enable'),
      (c_enum, 'PS3000A_CHANNEL', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_enum, 'PS3000A_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'delay'),
      (c_int16, 'int16_t', 'autoTrigger_ms')]
     ),
    ('ps3000aSetTriggerChannelConditions', 'SetTriggerChannelConditions', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000ATriggerConditions), 'PS3000A_TRIGGER_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions')]
     ),
    ('ps3000aSetTriggerChannelConditionsV2', 'SetTriggerChannelConditionsV2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000ATriggerConditionsV2), 'PS3000A_TRIGGER_CONDITIONS_V2*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions')]
     ),
    ('ps3000aSetTriggerChannelDirections', 'SetTriggerChannelDirections', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS3000A_THRESHOLD_DIRECTION', 'channelA'),
      (c_enum, 'PS3000A_THRESHOLD_DIRECTION', 'channelB'),
      (c_enum, 'PS3000A_THRESHOLD_DIRECTION', 'channelC'),
      (c_enum, 'PS3000A_THRESHOLD_DIRECTION', 'channelD'),
      (c_enum, 'PS3000A_THRESHOLD_DIRECTION', 'ext'),
      (c_enum, 'PS3000A_THRESHOLD_DIRECTION', 'aux')]
     ),
    ('ps3000aSetTriggerChannelProperties', 'SetTriggerChannelProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000ATriggerChannelProperties), 'PS3000A_TRIGGER_CHANNEL_PROPERTIES*', 'channelProperties'),
      (c_int16, 'int16_t', 'nChannelProperties'),
      (c_int16, 'int16_t', 'auxOutputEnable'),
      (c_int32, 'int32_t', 'autoTriggerMilliseconds')]
     ),
    ('ps3000aSetTriggerDelay', 'SetTriggerDelay', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'delay')]
     ),
    ('ps3000aSetTriggerDigitalPortProperties', 'SetTriggerDigitalPortProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS3000ADigitalChannelDirections), 'PS3000A_DIGITAL_CHANNEL_DIRECTIONS*', 'directions'),
      (c_int16, 'int16_t', 'nDirections')]
     ),
    ('ps3000aSigGenArbitraryMinMaxValues', 'SigGenArbitraryMinMaxValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'minArbitraryWaveformValue'),
      (POINTER(c_int16), 'int16_t*', 'maxArbitraryWaveformValue'),
      (POINTER(c_uint32), 'uint32_t*', 'minArbitraryWaveformSize'),
      (POINTER(c_uint32), 'uint32_t*', 'maxArbitraryWaveformSize')]
     ),
    ('ps3000aSigGenFrequencyToPhase', 'SigGenFrequencyToPhase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'frequency'),
      (c_enum, 'PS3000A_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'bufferLength'),
      (POINTER(c_uint32), 'uint32_t*', 'phase')]
     ),
    ('ps3000aSigGenSoftwareControl', 'SigGenSoftwareControl', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
    ('ps3000aStop', 'Stop', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
]


# ************************ SDK functions for ps4000Api ************************


ps4000Api_funcptrs = [
    ('ps4000CloseUnit', 'CloseUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps4000EnumerateUnits', 'EnumerateUnits', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'count'),
      (POINTER(c_int8), 'int8_t*', 'serials'),
      (POINTER(c_int16), 'int16_t*', 'serialLth')]
     ),
    ('ps4000FlashLed', 'FlashLed', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'start')]
     ),
    ('ps4000GetChannelInformation', 'GetChannelInformation', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_CHANNEL_INFO', 'info'),
      (c_int32, 'int32_t', 'probe'),
      (POINTER(c_int32), 'int32_t*', 'ranges'),
      (POINTER(c_int32), 'int32_t*', 'length'),
      (c_int32, 'int32_t', 'channels')]
     ),
    ('ps4000GetMaxDownSampleRatio', 'GetMaxDownSampleRatio', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'noOfUnaggreatedSamples'),
      (POINTER(c_uint32), 'uint32_t*', 'maxDownSampleRatio'),
      (c_int16, 'int16_t', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps4000GetNoOfCaptures', 'GetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint16), 'uint16_t*', 'nCaptures')]
     ),
    ('ps4000GetProbe', 'GetProbe', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_enum), 'PS4000_PROBE*', 'probe')]
     ),
    ('ps4000GetStreamingLatestValues', 'GetStreamingLatestValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (ps4000StreamingReady, 'ps4000StreamingReady', 'lpPs'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps4000GetTimebase', 'GetTimebase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_int32), 'int32_t*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps4000GetTimebase2', 'GetTimebase2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_float), 'float*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps4000GetTriggerChannelTimeOffset', 'GetTriggerChannelTimeOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (POINTER(c_enum), 'PS4000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (c_enum, 'PS4000_CHANNEL', 'channel')]
     ),
    ('ps4000GetTriggerChannelTimeOffset64', 'GetTriggerChannelTimeOffset64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'time'),
      (POINTER(c_enum), 'PS4000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (c_enum, 'PS4000_CHANNEL', 'channel')]
     ),
    ('ps4000GetTriggerTimeOffset', 'GetTriggerTimeOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (POINTER(c_enum), 'PS4000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps4000GetTriggerTimeOffset64', 'GetTriggerTimeOffset64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'time'),
      (POINTER(c_enum), 'PS4000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps4000GetUnitInfo', 'GetUnitInfo', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (c_int16, 'int16_t', 'stringLength'),
      (POINTER(c_int16), 'int16_t*', 'requiredSize'),
      (PICO_INFO, 'PICO_INFO', 'info')]
     ),
    ('ps4000GetValues', 'GetValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_int16, 'int16_t', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps4000GetValuesAsync', 'GetValuesAsync', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (c_uint32, 'uint32_t', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_int16, 'int16_t', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (ps4000DataReady, 'void*', 'lpDataReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps4000GetValuesBulk', 'GetValuesBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps4000GetValuesTriggerChannelTimeOffsetBulk', 'GetValuesTriggerChannelTimeOffsetBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timesUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timesLower'),
      (POINTER(c_enum), 'PS4000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex'),
      (c_enum, 'PS4000_CHANNEL', 'channel')]
     ),
    ('ps4000GetValuesTriggerChannelTimeOffsetBulk64', 'GetValuesTriggerChannelTimeOffsetBulk64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'times'),
      (POINTER(c_enum), 'PS4000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex'),
      (c_enum, 'PS4000_CHANNEL', 'channel')]
     ),
    ('ps4000GetValuesTriggerTimeOffsetBulk', 'GetValuesTriggerTimeOffsetBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timesUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timesLower'),
      (POINTER(c_enum), 'PS4000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex')]
     ),
    ('ps4000GetValuesTriggerTimeOffsetBulk64', 'GetValuesTriggerTimeOffsetBulk64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'times'),
      (POINTER(c_enum), 'PS4000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex')]
     ),
    ('ps4000HoldOff', 'HoldOff', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint64, 'uint64_t', 'holdoff'),
      (c_enum, 'PS4000_HOLDOFF_TYPE', 'type')]
     ),
    ('ps4000IsLedFlashing', 'IsLedFlashing', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'status')]
     ),
    ('ps4000IsReady', 'IsReady', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'ready')]
     ),
    ('ps4000IsTriggerOrPulseWidthQualifierEnabled', 'IsTriggerOrPulseWidthQualifierEnabled', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'triggerEnabled'),
      (POINTER(c_int16), 'int16_t*', 'pulseWidthQualifierEnabled')]
     ),
    ('ps4000MemorySegments', 'MemorySegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint16, 'uint16_t', 'nSegments'),
      (POINTER(c_int32), 'int32_t*', 'nMaxSamples')]
     ),
    ('ps4000NoOfStreamingValues', 'NoOfStreamingValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfValues')]
     ),
    ('ps4000OpenUnit', 'OpenUnit', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle')]
     ),
    ('ps4000OpenUnitAsync', 'OpenUnitAsync', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'status')]
     ),
    ('ps4000OpenUnitAsyncEx', 'OpenUnitAsyncEx', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'status'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps4000OpenUnitEx', 'OpenUnitEx', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps4000OpenUnitProgress', 'OpenUnitProgress', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'progressPercent'),
      (POINTER(c_int16), 'int16_t*', 'complete')]
     ),
    ('ps4000PingUnit', 'PingUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps4000RunBlock', 'RunBlock', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'noOfPreTriggerSamples'),
      (c_int32, 'int32_t', 'noOfPostTriggerSamples'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'timeIndisposedMs'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (BlockReady, 'ps4000BlockReady', 'lpReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps4000RunStreaming', 'RunStreaming', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'sampleInterval'),
      (c_enum, 'PS4000_TIME_UNITS', 'sampleIntervalTimeUnits'),
      (c_uint32, 'uint32_t', 'maxPreTriggerSamples'),
      (c_uint32, 'uint32_t', 'maxPostPreTriggerSamples'),
      (c_int16, 'int16_t', 'autoStop'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_uint32, 'uint32_t', 'overviewBufferSize')]
     ),
    ('ps4000RunStreamingEx', 'RunStreamingEx', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'sampleInterval'),
      (c_enum, 'PS4000_TIME_UNITS', 'sampleIntervalTimeUnits'),
      (c_uint32, 'uint32_t', 'maxPreTriggerSamples'),
      (c_uint32, 'uint32_t', 'maxPostPreTriggerSamples'),
      (c_int16, 'int16_t', 'autoStop'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_int16, 'int16_t', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'overviewBufferSize')]
     ),
    ('ps4000SetBwFilter', 'SetBwFilter', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enable')]
     ),
    ('ps4000SetChannel', 'SetChannel', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_int16, 'int16_t', 'dc'),
      (c_enum, 'PS4000_RANGE', 'range')]
     ),
    ('ps4000SetDataBuffer', 'SetDataBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps4000SetDataBufferBulk', 'SetDataBufferBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint16, 'uint16_t', 'waveform')]
     ),
    ('ps4000SetDataBufferWithMode', 'SetDataBufferWithMode', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_enum, 'RATIO_MODE', 'mode')]
     ),
    ('ps4000SetDataBuffers', 'SetDataBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps4000SetDataBuffersWithMode', 'SetDataBuffersWithMode', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_enum, 'RATIO_MODE', 'mode')]
     ),
    ('ps4000SetEts', 'SetEts', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_ETS_MODE', 'mode'),
      (c_int16, 'int16_t', 'etsCycles'),
      (c_int16, 'int16_t', 'etsInterleave'),
      (POINTER(c_int32), 'int32_t*', 'sampleTimePicoseconds')]
     ),
    ('ps4000SetEtsTimeBuffer', 'SetEtsTimeBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps4000SetEtsTimeBuffers', 'SetEtsTimeBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps4000SetExtTriggerRange', 'SetExtTriggerRange', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_RANGE', 'extRange')]
     ),
    ('ps4000SetFrequencyCounter', 'SetFrequencyCounter', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_enum, 'PS4000_FREQUENCY_COUNTER_RANGE', 'range'),
      (c_int16, 'int16_t', 'thresholdMajor'),
      (c_int16, 'int16_t', 'thresholdMinor')]
     ),
    ('ps4000SetNoOfCaptures', 'SetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint16, 'uint16_t', 'nCaptures')]
     ),
    ('ps4000SetProbe', 'SetProbe', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000_PROBE', 'probe'),
      (c_enum, 'PS4000_RANGE', 'range')]
     ),
    ('ps4000SetPulseWidthQualifier', 'SetPulseWidthQualifier', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS4000PwqConditions), 'PWQ_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps4000SetSigGenArbitrary', 'SetSigGenArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (ndpointer(dtype=c_int16, ndim=1, flags='C_CONTIGUOUS'), 'int16_t*', 'arbitraryWaveform'),
      (c_int32, 'int32_t', 'arbitraryWaveformSize'),
      (c_enum, 'SWEEP_TYPE', 'sweepType'),
      (c_int16, 'int16_t', 'operationType'),
      (c_enum, 'INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps4000SetSigGenBuiltIn', 'SetSigGenBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_int16, 'int16_t', 'waveType'),
      (c_float, 'float', 'startFrequency'),
      (c_float, 'float', 'stopFrequency'),
      (c_float, 'float', 'increment'),
      (c_float, 'float', 'dwellTime'),
      (c_enum, 'SWEEP_TYPE', 'sweepType'),
      (c_int16, 'int16_t', 'operationType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps4000SetSimpleTrigger', 'SetSimpleTrigger', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'enable'),
      (c_enum, 'PS4000_CHANNEL', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_enum, 'THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'delay'),
      (c_int16, 'int16_t', 'autoTrigger_ms')]
     ),
    ('ps4000SetTriggerChannelConditions', 'SetTriggerChannelConditions', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS4000TriggerConditions), 'TRIGGER_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions')]
     ),
    ('ps4000SetTriggerChannelDirections', 'SetTriggerChannelDirections', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelA'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelB'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelC'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelD'),
      (c_enum, 'THRESHOLD_DIRECTION', 'ext'),
      (c_enum, 'THRESHOLD_DIRECTION', 'aux')]
     ),
    ('ps4000SetTriggerChannelProperties', 'SetTriggerChannelProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS4000TriggerChannelProperties), 'TRIGGER_CHANNEL_PROPERTIES*', 'channelProperties'),
      (c_int16, 'int16_t', 'nChannelProperties'),
      (c_int16, 'int16_t', 'auxOutputEnable'),
      (c_int32, 'int32_t', 'autoTriggerMilliseconds')]
     ),
    ('ps4000SetTriggerDelay', 'SetTriggerDelay', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'delay')]
     ),
    ('ps4000SigGenArbitraryMinMaxValues', 'SigGenArbitraryMinMaxValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'minArbitraryWaveformValue'),
      (POINTER(c_int16), 'int16_t*', 'maxArbitraryWaveformValue'),
      (POINTER(c_uint32), 'uint32_t*', 'minArbitraryWaveformSize'),
      (POINTER(c_uint32), 'uint32_t*', 'maxArbitraryWaveformSize')]
     ),
    ('ps4000SigGenFrequencyToPhase', 'SigGenFrequencyToPhase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'frequency'),
      (c_enum, 'INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'bufferLength'),
      (POINTER(c_uint32), 'uint32_t*', 'phase')]
     ),
    ('ps4000SigGenOff', 'SigGenOff', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps4000SigGenSoftwareControl', 'SigGenSoftwareControl', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
    ('ps4000Stop', 'Stop', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps4000TriggerWithinPreTriggerSamples', 'TriggerWithinPreTriggerSamples', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
]


# ************************ SDK functions for ps4000aApi ************************


ps4000aApi_funcptrs = [
    ('ps4000aApplyResistanceScaling', 'ApplyResistanceScaling', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_CHANNEL', 'channel'),
      (c_enum, 'PS4000A_RANGE', 'range'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_uint32, 'uint32_t', 'buffertLth'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps4000aChangePowerSource', 'ChangePowerSource', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (PICO_STATUS, 'PICO_STATUS', 'powerState')]
     ),
    ('ps4000aCloseUnit', 'CloseUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps4000aConnectDetect', 'ConnectDetect', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS4000AConnectDetect), 'PS4000A_CONNECT_DETECT*', 'sensor'),
      (c_int16, 'int16_t', 'nSensors')]
     ),
    ('ps4000aCurrentPowerSource', 'CurrentPowerSource', PICO_STATUS, None,
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps4000aDeviceMetaData', 'DeviceMetaData', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'settings'),
      (POINTER(c_int32), 'int32_t*', 'nSettingsLength'),
      (c_enum, 'PS4000A_META_TYPE', 'type'),
      (c_enum, 'PS4000A_META_OPERATION', 'operation'),
      (c_enum, 'PS4000A_META_FORMAT', 'format')]
     ),
    ('ps4000aEnumerateUnits', 'EnumerateUnits', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'count'),
      (POINTER(c_int8), 'int8_t*', 'serials'),
      (POINTER(c_int16), 'int16_t*', 'serialLth')]
     ),
    ('ps4000aFlashLed', 'FlashLed', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'start')]
     ),
    ('ps4000aGetAnalogueOffset', 'GetAnalogueOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_RANGE', 'range'),
      (c_enum, 'PS4000A_COUPLING', 'coupling'),
      (POINTER(c_float), 'float*', 'maximumVoltage'),
      (POINTER(c_float), 'float*', 'minimumVoltage')]
     ),
    ('ps4000aGetChannelInformation', 'GetChannelInformation', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_CHANNEL_INFO', 'info'),
      (c_int32, 'int32_t', 'probe'),
      (POINTER(c_int32), 'int32_t*', 'ranges'),
      (POINTER(c_int32), 'int32_t*', 'length'),
      (c_int32, 'int32_t', 'channels')]
     ),
    ('ps4000aGetCommonModeOverflow', 'GetCommonModeOverflow', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint16), 'uint16_t*', 'overflow')]
     ),
    ('ps4000aGetMaxDownSampleRatio', 'GetMaxDownSampleRatio', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'noOfUnaggreatedSamples'),
      (POINTER(c_uint32), 'uint32_t*', 'maxDownSampleRatio'),
      (c_enum, 'PS4000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps4000aGetMaxSegments', 'GetMaxSegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'maxSegments')]
     ),
    ('ps4000aGetNoOfCaptures', 'GetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nCaptures')]
     ),
    ('ps4000aGetNoOfProcessedCaptures', 'GetNoOfProcessedCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nProcessedCaptures')]
     ),
    ('ps4000aGetStreamingLatestValues', 'GetStreamingLatestValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (ps4000aStreamingReady, 'ps4000aStreamingReady', 'lpPs'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps4000aGetString', 'GetString', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PICO_STRING_VALUE', 'stringValue'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (POINTER(c_int32), 'int32_t*', 'stringLength')]
     ),
    ('ps4000aGetTimebase', 'GetTimebase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_int32), 'int32_t*', 'timeIntervalNanoseconds'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps4000aGetTimebase2', 'GetTimebase2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_float), 'float*', 'timeIntervalNanoseconds'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps4000aGetTriggerTimeOffset', 'GetTriggerTimeOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (POINTER(c_enum), 'PS4000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps4000aGetTriggerTimeOffset64', 'GetTriggerTimeOffset64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'time'),
      (POINTER(c_enum), 'PS4000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps4000aGetUnitInfo', 'GetUnitInfo', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (c_int16, 'int16_t', 'stringLength'),
      (POINTER(c_int16), 'int16_t*', 'requiredSize'),
      (PICO_INFO, 'PICO_INFO', 'info')]
     ),
    ('ps4000aGetValues', 'GetValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS4000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps4000aGetValuesAsync', 'GetValuesAsync', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (c_uint32, 'uint32_t', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS4000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (ps4000aDataReady, 'void*', 'lpDataReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps4000aGetValuesBulk', 'GetValuesBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS4000A_RATIO_MODE', 'downSampleRatioMode'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps4000aGetValuesOverlapped', 'GetValuesOverlapped', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS4000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps4000aGetValuesOverlappedBulk', 'GetValuesOverlappedBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS4000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps4000aGetValuesTriggerTimeOffsetBulk', 'GetValuesTriggerTimeOffsetBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timesUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timesLower'),
      (POINTER(c_enum), 'PS4000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps4000aGetValuesTriggerTimeOffsetBulk64', 'GetValuesTriggerTimeOffsetBulk64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'times'),
      (POINTER(c_enum), 'PS4000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps4000aIsLedFlashing', 'IsLedFlashing', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'status')]
     ),
    ('ps4000aIsReady', 'IsReady', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'ready')]
     ),
    ('ps4000aIsTriggerOrPulseWidthQualifierEnabled', 'IsTriggerOrPulseWidthQualifierEnabled', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'triggerEnabled'),
      (POINTER(c_int16), 'int16_t*', 'pulseWidthQualifierEnabled')]
     ),
    ('ps4000aMaximumValue', 'MaximumValue', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'value')]
     ),
    ('ps4000aMemorySegments', 'MemorySegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'nSegments'),
      (POINTER(c_int32), 'int32_t*', 'nMaxSamples')]
     ),
    ('ps4000aMinimumValue', 'MinimumValue', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'value')]
     ),
    ('ps4000aNoOfStreamingValues', 'NoOfStreamingValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfValues')]
     ),
    ('ps4000aOpenUnit', 'OpenUnit', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps4000aOpenUnitAsync', 'OpenUnitAsync', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'status'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps4000aOpenUnitProgress', 'OpenUnitProgress', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'progressPercent'),
      (POINTER(c_int16), 'int16_t*', 'complete')]
     ),
    ('ps4000aPingUnit', 'PingUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps4000aRunBlock', 'RunBlock', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'noOfPreTriggerSamples'),
      (c_int32, 'int32_t', 'noOfPostTriggerSamples'),
      (c_uint32, 'uint32_t', 'timebase'),
      (POINTER(c_int32), 'int32_t*', 'timeIndisposedMs'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (BlockReady, 'ps4000aBlockReady', 'lpReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps4000aRunStreaming', 'RunStreaming', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'sampleInterval'),
      (c_enum, 'PS4000A_TIME_UNITS', 'sampleIntervalTimeUnits'),
      (c_uint32, 'uint32_t', 'maxPreTriggerSamples'),
      (c_uint32, 'uint32_t', 'maxPostTriggerSamples'),
      (c_int16, 'int16_t', 'autoStop'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS4000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'overviewBufferSize')]
     ),
    ('ps4000aSetBandwidthFilter', 'SetBandwidthFilter', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_CHANNEL', 'channel'),
      (c_enum, 'PS4000A_BANDWIDTH_LIMITER', 'bandwidth')]
     ),
    ('ps4000aSetChannel', 'SetChannel', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_enum, 'PS4000A_COUPLING', 'type'),
      (c_enum, 'PS4000A_RANGE', 'range'),
      (c_float, 'float', 'analogOffset')]
     ),
    ('ps4000aSetChannelLed', 'SetChannelLed', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS4000AChannelLedSetting), 'PS4000A_CHANNEL_LED_SETTING*', 'ledStates'),
      (c_uint16, 'uint16_t', 'nLedStates')]
     ),
    ('ps4000aSetDataBuffer', 'SetDataBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (c_enum, 'PS4000A_RATIO_MODE', 'mode')]
     ),
    ('ps4000aSetDataBuffers', 'SetDataBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (c_enum, 'PS4000A_RATIO_MODE', 'mode')]
     ),
    ('ps4000aSetEts', 'SetEts', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_ETS_MODE', 'mode'),
      (c_int16, 'int16_t', 'etsCycles'),
      (c_int16, 'int16_t', 'etsInterleave'),
      (POINTER(c_int32), 'int32_t*', 'sampleTimePicoseconds')]
     ),
    ('ps4000aSetEtsTimeBuffer', 'SetEtsTimeBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps4000aSetEtsTimeBuffers', 'SetEtsTimeBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps4000aSetFrequencyCounter', 'SetFrequencyCounter', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_enum, 'PS4000A_FREQUENCY_COUNTER_RANGE', 'range'),
      (c_int16, 'int16_t', 'thresholdMajor'),
      (c_int16, 'int16_t', 'thresholdMinor')]
     ),
    ('ps4000aSetNoOfCaptures', 'SetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'nCaptures')]
     ),
    ('ps4000aSetPulseWidthQualifierConditions', 'SetPulseWidthQualifierConditions', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS4000ACondition), 'PS4000A_CONDITION*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'PS4000A_CONDITIONS_INFO', 'info')]
     ),
    ('ps4000aSetPulseWidthQualifierProperties', 'SetPulseWidthQualifierProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS4000A_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PS4000A_PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps4000aSetSigGenArbitrary', 'SetSigGenArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (ndpointer(dtype=c_int16, ndim=1, flags='C_CONTIGUOUS'), 'int16_t*', 'arbitraryWaveform'),
      (c_int32, 'int32_t', 'arbitraryWaveformSize'),
      (c_enum, 'PS4000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS4000A_EXTRA_OPERATIONS', 'operation'),
      (c_enum, 'PS4000A_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS4000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS4000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps4000aSetSigGenBuiltIn', 'SetSigGenBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_enum, 'PS4000A_WAVE_TYPE', 'waveType'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS4000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS4000A_EXTRA_OPERATIONS', 'operation'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS4000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS4000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps4000aSetSigGenPropertiesArbitrary', 'SetSigGenPropertiesArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (c_enum, 'PS4000A_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS4000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS4000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps4000aSetSigGenPropertiesBuiltIn', 'SetSigGenPropertiesBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS4000A_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS4000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS4000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps4000aSetSimpleTrigger', 'SetSimpleTrigger', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'enable'),
      (c_enum, 'PS4000A_CHANNEL', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_enum, 'PS4000A_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'delay'),
      (c_int16, 'int16_t', 'autoTrigger_ms')]
     ),
    ('ps4000aSetTriggerChannelConditions', 'SetTriggerChannelConditions', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS4000ACondition), 'PS4000A_CONDITION*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'PS4000A_CONDITIONS_INFO', 'info')]
     ),
    ('ps4000aSetTriggerChannelDirections', 'SetTriggerChannelDirections', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS4000ADirection), 'PS4000A_DIRECTION*', 'directions'),
      (c_int16, 'int16_t', 'nDirections')]
     ),
    ('ps4000aSetTriggerChannelProperties', 'SetTriggerChannelProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS4000ATriggerChannelProperties), 'PS4000A_TRIGGER_CHANNEL_PROPERTIES*', 'channelProperties'),
      (c_int16, 'int16_t', 'nChannelProperties'),
      (c_int16, 'int16_t', 'auxOutputEnable'),
      (c_int32, 'int32_t', 'autoTriggerMilliseconds')]
     ),
    ('ps4000aSetTriggerDelay', 'SetTriggerDelay', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'delay')]
     ),
    ('ps4000aSigGenArbitraryMinMaxValues', 'SigGenArbitraryMinMaxValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'minArbitraryWaveformValue'),
      (POINTER(c_int16), 'int16_t*', 'maxArbitraryWaveformValue'),
      (POINTER(c_uint32), 'uint32_t*', 'minArbitraryWaveformSize'),
      (POINTER(c_uint32), 'uint32_t*', 'maxArbitraryWaveformSize')]
     ),
    ('ps4000aSigGenFrequencyToPhase', 'SigGenFrequencyToPhase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'frequency'),
      (c_enum, 'PS4000A_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'bufferLength'),
      (POINTER(c_uint32), 'uint32_t*', 'phase')]
     ),
    ('ps4000aSigGenSoftwareControl', 'SigGenSoftwareControl', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
    ('ps4000aStop', 'Stop', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
]


# ************************ SDK functions for ps5000Api ************************


ps5000Api_funcptrs = [
    ('ps5000CloseUnit', 'CloseUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps5000FlashLed', 'FlashLed', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'start')]
     ),
    ('ps5000GetMaxDownSampleRatio', 'GetMaxDownSampleRatio', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'noOfUnaggreatedSamples'),
      (POINTER(c_uint32), 'uint32_t*', 'maxDownSampleRatio'),
      (c_int16, 'int16_t', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps5000GetStreamingLatestValues', 'GetStreamingLatestValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (ps5000StreamingReady, 'ps5000StreamingReady', 'lpPs'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps5000GetTimebase', 'GetTimebase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_int32), 'int32_t*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps5000GetTimebase2', 'GetTimebase2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_float), 'float*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps5000GetTriggerTimeOffset', 'GetTriggerTimeOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (POINTER(c_enum), 'PS5000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps5000GetTriggerTimeOffset64', 'GetTriggerTimeOffset64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'time'),
      (POINTER(c_enum), 'PS5000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'segmentIndex')]
     ),
    ('ps5000GetUnitInfo', 'GetUnitInfo', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (c_int16, 'int16_t', 'stringLength'),
      (POINTER(c_int16), 'int16_t*', 'requiredSize'),
      (PICO_INFO, 'PICO_INFO', 'info')]
     ),
    ('ps5000GetValues', 'GetValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_int16, 'int16_t', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps5000GetValuesAsync', 'GetValuesAsync', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (c_uint32, 'uint32_t', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_int16, 'int16_t', 'downSampleRatioMode'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (ps5000DataReady, 'void*', 'lpDataReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps5000GetValuesBulk', 'GetValuesBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps5000GetValuesTriggerTimeOffsetBulk', 'GetValuesTriggerTimeOffsetBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timesUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timesLower'),
      (POINTER(c_enum), 'PS5000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex')]
     ),
    ('ps5000GetValuesTriggerTimeOffsetBulk64', 'GetValuesTriggerTimeOffsetBulk64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'times'),
      (POINTER(c_enum), 'PS5000_TIME_UNITS*', 'timeUnits'),
      (c_uint16, 'uint16_t', 'fromSegmentIndex'),
      (c_uint16, 'uint16_t', 'toSegmentIndex')]
     ),
    ('ps5000IsLedFlashing', 'IsLedFlashing', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'status')]
     ),
    ('ps5000IsReady', 'IsReady', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'ready')]
     ),
    ('ps5000IsTriggerOrPulseWidthQualifierEnabled', 'IsTriggerOrPulseWidthQualifierEnabled', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'triggerEnabled'),
      (POINTER(c_int16), 'int16_t*', 'pulseWidthQualifierEnabled')]
     ),
    ('ps5000MemorySegments', 'MemorySegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint16, 'uint16_t', 'nSegments'),
      (POINTER(c_int32), 'int32_t*', 'nMaxSamples')]
     ),
    ('ps5000NoOfStreamingValues', 'NoOfStreamingValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfValues')]
     ),
    ('ps5000OpenUnit', 'OpenUnit', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle')]
     ),
    ('ps5000OpenUnitAsync', 'OpenUnitAsync', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'status')]
     ),
    ('ps5000OpenUnitProgress', 'OpenUnitProgress', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'progressPercent'),
      (POINTER(c_int16), 'int16_t*', 'complete')]
     ),
    ('ps5000PingUnit', 'PingUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps5000RunBlock', 'RunBlock', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'noOfPreTriggerSamples'),
      (c_int32, 'int32_t', 'noOfPostTriggerSamples'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'timeIndisposedMs'),
      (c_uint16, 'uint16_t', 'segmentIndex'),
      (BlockReady, 'ps5000BlockReady', 'lpReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps5000RunStreaming', 'RunStreaming', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'sampleInterval'),
      (c_enum, 'PS5000_TIME_UNITS', 'sampleIntervalTimeUnits'),
      (c_uint32, 'uint32_t', 'maxPreTriggerSamples'),
      (c_uint32, 'uint32_t', 'maxPostPreTriggerSamples'),
      (c_int16, 'int16_t', 'autoStop'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_uint32, 'uint32_t', 'overviewBufferSize')]
     ),
    ('ps5000SetChannel', 'SetChannel', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_int16, 'int16_t', 'dc'),
      (c_enum, 'PS5000_RANGE', 'range')]
     ),
    ('ps5000SetDataBuffer', 'SetDataBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps5000SetDataBufferBulk', 'SetDataBufferBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint16, 'uint16_t', 'waveform')]
     ),
    ('ps5000SetDataBuffers', 'SetDataBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps5000SetEts', 'SetEts', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000_ETS_MODE', 'mode'),
      (c_int16, 'int16_t', 'etsCycles'),
      (c_int16, 'int16_t', 'etsInterleave'),
      (POINTER(c_int32), 'int32_t*', 'sampleTimePicoseconds')]
     ),
    ('ps5000SetEtsTimeBuffer', 'SetEtsTimeBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps5000SetEtsTimeBuffers', 'SetEtsTimeBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps5000SetNoOfCaptures', 'SetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint16, 'uint16_t', 'nCaptures')]
     ),
    ('ps5000SetPulseWidthQualifier', 'SetPulseWidthQualifier', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS5000PwqConditions), 'PWQ_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps5000SetSigGenArbitrary', 'SetSigGenArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (ndpointer(dtype=c_int16, ndim=1, flags='C_CONTIGUOUS'), 'int16_t*', 'arbitraryWaveform'),
      (c_int32, 'int32_t', 'arbitraryWaveformSize'),
      (c_enum, 'SWEEP_TYPE', 'sweepType'),
      (c_int16, 'int16_t', 'whiteNoise'),
      (c_enum, 'INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps5000SetSigGenBuiltIn', 'SetSigGenBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_int16, 'int16_t', 'waveType'),
      (c_float, 'float', 'startFrequency'),
      (c_float, 'float', 'stopFrequency'),
      (c_float, 'float', 'increment'),
      (c_float, 'float', 'dwellTime'),
      (c_enum, 'SWEEP_TYPE', 'sweepType'),
      (c_int16, 'int16_t', 'whiteNoise'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps5000SetSigGenBuiltInV2', 'SetSigGenBuiltInV2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_int16, 'int16_t', 'waveType'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'SWEEP_TYPE', 'sweepType'),
      (c_int16, 'int16_t', 'whiteNoise'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps5000SetSimpleTrigger', 'SetSimpleTrigger', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'enable'),
      (c_enum, 'PS5000_CHANNEL', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_enum, 'THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'delay'),
      (c_int16, 'int16_t', 'autoTrigger_ms')]
     ),
    ('ps5000SetTriggerChannelConditions', 'SetTriggerChannelConditions', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS5000TriggerConditions), 'TRIGGER_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions')]
     ),
    ('ps5000SetTriggerChannelDirections', 'SetTriggerChannelDirections', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelA'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelB'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelC'),
      (c_enum, 'THRESHOLD_DIRECTION', 'channelD'),
      (c_enum, 'THRESHOLD_DIRECTION', 'ext'),
      (c_enum, 'THRESHOLD_DIRECTION', 'aux')]
     ),
    ('ps5000SetTriggerChannelProperties', 'SetTriggerChannelProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS5000TriggerChannelProperties), 'TRIGGER_CHANNEL_PROPERTIES*', 'channelProperties'),
      (c_int16, 'int16_t', 'nChannelProperties'),
      (c_int16, 'int16_t', 'auxOutputEnable'),
      (c_int32, 'int32_t', 'autoTriggerMilliseconds')]
     ),
    ('ps5000SetTriggerDelay', 'SetTriggerDelay', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'delay')]
     ),
    ('ps5000SigGenArbitraryMinMaxValues', 'SigGenArbitraryMinMaxValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'minArbitraryWaveformValue'),
      (POINTER(c_int16), 'int16_t*', 'maxArbitraryWaveformValue'),
      (POINTER(c_uint32), 'uint32_t*', 'minArbitraryWaveformSize'),
      (POINTER(c_uint32), 'uint32_t*', 'maxArbitraryWaveformSize')]
     ),
    ('ps5000SigGenFrequencyToPhase', 'SigGenFrequencyToPhase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'frequency'),
      (c_enum, 'INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'bufferLength'),
      (POINTER(c_uint32), 'uint32_t*', 'phase')]
     ),
    ('ps5000SigGenSoftwareControl', 'SigGenSoftwareControl', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
    ('ps5000Stop', 'Stop', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
]


# ************************ SDK functions for ps5000aApi ************************


ps5000aApi_funcptrs = [
    ('ps5000aChangePowerSource', 'ChangePowerSource', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (PICO_STATUS, 'PICO_STATUS', 'powerState')]
     ),
    ('ps5000aCloseUnit', 'CloseUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps5000aCurrentPowerSource', 'CurrentPowerSource', PICO_STATUS, None,
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps5000aEnumerateUnits', 'EnumerateUnits', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'count'),
      (POINTER(c_int8), 'int8_t*', 'serials'),
      (POINTER(c_int16), 'int16_t*', 'serialLth')]
     ),
    ('ps5000aFlashLed', 'FlashLed', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'start')]
     ),
    ('ps5000aGetAnalogueOffset', 'GetAnalogueOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_RANGE', 'range'),
      (c_enum, 'PS5000A_COUPLING', 'coupling'),
      (POINTER(c_float), 'float*', 'maximumVoltage'),
      (POINTER(c_float), 'float*', 'minimumVoltage')]
     ),
    ('ps5000aGetChannelInformation', 'GetChannelInformation', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_CHANNEL_INFO', 'info'),
      (c_int32, 'int32_t', 'probe'),
      (POINTER(c_int32), 'int32_t*', 'ranges'),
      (POINTER(c_int32), 'int32_t*', 'length'),
      (c_int32, 'int32_t', 'channels')]
     ),
    ('ps5000aGetDeviceResolution', 'GetDeviceResolution', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_enum), 'PS5000A_DEVICE_RESOLUTION*', 'resolution')]
     ),
    ('ps5000aGetMaxDownSampleRatio', 'GetMaxDownSampleRatio', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'noOfUnaggreatedSamples'),
      (POINTER(c_uint32), 'uint32_t*', 'maxDownSampleRatio'),
      (c_enum, 'PS5000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps5000aGetMaxSegments', 'GetMaxSegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'maxSegments')]
     ),
    ('ps5000aGetNoOfCaptures', 'GetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nCaptures')]
     ),
    ('ps5000aGetNoOfProcessedCaptures', 'GetNoOfProcessedCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nProcessedCaptures')]
     ),
    ('ps5000aGetStreamingLatestValues', 'GetStreamingLatestValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (ps5000aStreamingReady, 'ps5000aStreamingReady', 'lpPs'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps5000aGetTimebase', 'GetTimebase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_int32), 'int32_t*', 'timeIntervalNanoseconds'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps5000aGetTimebase2', 'GetTimebase2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int32, 'int32_t', 'noSamples'),
      (POINTER(c_float), 'float*', 'timeIntervalNanoseconds'),
      (POINTER(c_int32), 'int32_t*', 'maxSamples'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps5000aGetMinimumTimebaseStateless', 'GetMinimumTimebaseStateless', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_CHANNEL', 'channel'),
      (POINTER(c_uint32), 'uint32_t*', 'timebase'),
      (POINTER(c_double), 'double*', 'timeIntervalNanoseconds'),
      (c_enum, 'PS5000A_DEVICE_RESOLUTION', 'resolution')]
     ),
    ('ps5000aGetTriggerInfoBulk', 'GetTriggerInfoBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS5000ATriggerInfo), 'PS5000A_TRIGGER_INFO*', 'triggerInfo'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps5000aGetTriggerTimeOffset', 'GetTriggerTimeOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (POINTER(c_enum), 'PS5000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps5000aGetTriggerTimeOffset64', 'GetTriggerTimeOffset64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'time'),
      (POINTER(c_enum), 'PS5000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps5000aGetUnitInfo', 'GetUnitInfo', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (c_int16, 'int16_t', 'stringLength'),
      (POINTER(c_int16), 'int16_t*', 'requiredSize'),
      (PICO_INFO, 'PICO_INFO', 'info')]
     ),
    ('ps5000aGetValues', 'GetValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS5000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps5000aGetValuesAsync', 'GetValuesAsync', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (c_uint32, 'uint32_t', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS5000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (ps5000aDataReady, 'void*', 'lpDataReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps5000aGetValuesBulk', 'GetValuesBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS5000A_RATIO_MODE', 'downSampleRatioMode'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps5000aGetValuesOverlapped', 'GetValuesOverlapped', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS5000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps5000aGetValuesOverlappedBulk', 'GetValuesOverlappedBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS5000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps5000aGetValuesTriggerTimeOffsetBulk', 'GetValuesTriggerTimeOffsetBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timesUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timesLower'),
      (POINTER(c_enum), 'PS5000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps5000aGetValuesTriggerTimeOffsetBulk64', 'GetValuesTriggerTimeOffsetBulk64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'times'),
      (POINTER(c_enum), 'PS5000A_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps5000aIsLedFlashing', 'IsLedFlashing', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'status')]
     ),
    ('ps5000aIsReady', 'IsReady', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'ready')]
     ),
    ('ps5000aIsTriggerOrPulseWidthQualifierEnabled', 'IsTriggerOrPulseWidthQualifierEnabled', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'triggerEnabled'),
      (POINTER(c_int16), 'int16_t*', 'pulseWidthQualifierEnabled')]
     ),
    ('ps5000aMaximumValue', 'MaximumValue', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'value')]
     ),
    ('ps5000aMemorySegments', 'MemorySegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'nSegments'),
      (POINTER(c_int32), 'int32_t*', 'nMaxSamples')]
     ),
    ('ps5000aMinimumValue', 'MinimumValue', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'value')]
     ),
    ('ps5000aNoOfStreamingValues', 'NoOfStreamingValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfValues')]
     ),
    ('ps5000aOpenUnit', 'OpenUnit', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'serial'),
      (c_enum, 'PS5000A_DEVICE_RESOLUTION', 'resolution')]
     ),
    ('ps5000aOpenUnitAsync', 'OpenUnitAsync', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'status'),
      (POINTER(c_int8), 'int8_t*', 'serial'),
      (c_enum, 'PS5000A_DEVICE_RESOLUTION', 'resolution')]
     ),
    ('ps5000aOpenUnitProgress', 'OpenUnitProgress', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'progressPercent'),
      (POINTER(c_int16), 'int16_t*', 'complete')]
     ),
    ('ps5000aPingUnit', 'PingUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps5000aRunBlock', 'RunBlock', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'noOfPreTriggerSamples'),
      (c_int32, 'int32_t', 'noOfPostTriggerSamples'),
      (c_uint32, 'uint32_t', 'timebase'),
      (POINTER(c_int32), 'int32_t*', 'timeIndisposedMs'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (BlockReady, 'ps5000aBlockReady', 'lpReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps5000aRunStreaming', 'RunStreaming', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'sampleInterval'),
      (c_enum, 'PS5000A_TIME_UNITS', 'sampleIntervalTimeUnits'),
      (c_uint32, 'uint32_t', 'maxPreTriggerSamples'),
      (c_uint32, 'uint32_t', 'maxPostTriggerSamples'),
      (c_int16, 'int16_t', 'autoStop'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS5000A_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'overviewBufferSize')]
     ),
    ('ps5000aSetBandwidthFilter', 'SetBandwidthFilter', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_CHANNEL', 'channel'),
      (c_enum, 'PS5000A_BANDWIDTH_LIMITER', 'bandwidth')]
     ),
    ('ps5000aSetChannel', 'SetChannel', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_enum, 'PS5000A_COUPLING', 'type'),
      (c_enum, 'PS5000A_RANGE', 'range'),
      (c_float, 'float', 'analogOffset')]
     ),
    ('ps5000aSetDataBuffer', 'SetDataBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_CHANNEL', 'channel'),
      (ndpointer(dtype=c_int16, flags='C_CONTIGUOUS'), 'int16_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (c_enum, 'PS5000A_RATIO_MODE', 'mode')]
     ),
    ('ps5000aSetDataBuffers', 'SetDataBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_int32, 'int32_t', 'bufferLth'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (c_enum, 'PS5000A_RATIO_MODE', 'mode')]
     ),
    ('ps5000aSetDeviceResolution', 'SetDeviceResolution', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_DEVICE_RESOLUTION', 'resolution')]
     ),
    ('ps5000aSetEts', 'SetEts', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_ETS_MODE', 'mode'),
      (c_int16, 'int16_t', 'etsCycles'),
      (c_int16, 'int16_t', 'etsInterleave'),
      (POINTER(c_int32), 'int32_t*', 'sampleTimePicoseconds')]
     ),
    ('ps5000aSetEtsTimeBuffer', 'SetEtsTimeBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'buffer'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps5000aSetEtsTimeBuffers', 'SetEtsTimeBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (c_int32, 'int32_t', 'bufferLth')]
     ),
    ('ps5000aSetNoOfCaptures', 'SetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'nCaptures')]
     ),
    ('ps5000aSetPulseWidthQualifier', 'SetPulseWidthQualifier', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS5000APwqConditions), 'PS5000A_PWQ_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'PS5000A_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PS5000A_PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps5000aSetSigGenArbitrary', 'SetSigGenArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (ndpointer(dtype=c_int16, ndim=1, flags='C_CONTIGUOUS'), 'int16_t*', 'arbitraryWaveform'),
      (c_int32, 'int32_t', 'arbitraryWaveformSize'),
      (c_enum, 'PS5000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS5000A_EXTRA_OPERATIONS', 'operation'),
      (c_enum, 'PS5000A_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps5000aSetSigGenBuiltIn', 'SetSigGenBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_enum, 'PS5000A_WAVE_TYPE', 'waveType'),
      (c_float, 'float', 'startFrequency'),
      (c_float, 'float', 'stopFrequency'),
      (c_float, 'float', 'increment'),
      (c_float, 'float', 'dwellTime'),
      (c_enum, 'PS5000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS5000A_EXTRA_OPERATIONS', 'operation'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps5000aSetSigGenBuiltInV2', 'SetSigGenBuiltInV2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_enum, 'PS5000A_WAVE_TYPE', 'waveType'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS5000A_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS5000A_EXTRA_OPERATIONS', 'operation'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps5000aSetSigGenPropertiesArbitrary', 'SetSigGenPropertiesArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (c_enum, 'PS5000A_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps5000aSetSigGenPropertiesBuiltIn', 'SetSigGenPropertiesBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS5000A_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS5000A_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps5000aSetSimpleTrigger', 'SetSimpleTrigger', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'enable'),
      (c_enum, 'PS5000A_CHANNEL', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_enum, 'PS5000A_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'delay'),
      (c_int16, 'int16_t', 'autoTrigger_ms')]
     ),
    ('ps5000aSetTriggerChannelConditions', 'SetTriggerChannelConditions', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS5000ATriggerConditions), 'PS5000A_TRIGGER_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions')]
     ),
    ('ps5000aSetTriggerChannelDirections', 'SetTriggerChannelDirections', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_THRESHOLD_DIRECTION', 'channelA'),
      (c_enum, 'PS5000A_THRESHOLD_DIRECTION', 'channelB'),
      (c_enum, 'PS5000A_THRESHOLD_DIRECTION', 'channelC'),
      (c_enum, 'PS5000A_THRESHOLD_DIRECTION', 'channelD'),
      (c_enum, 'PS5000A_THRESHOLD_DIRECTION', 'ext'),
      (c_enum, 'PS5000A_THRESHOLD_DIRECTION', 'aux')]
     ),
    ('ps5000aSetTriggerChannelProperties', 'SetTriggerChannelProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS5000ATriggerChannelProperties), 'PS5000A_TRIGGER_CHANNEL_PROPERTIES*', 'channelProperties'),
      (c_int16, 'int16_t', 'nChannelProperties'),
      (c_int16, 'int16_t', 'auxOutputEnable'),
      (c_int32, 'int32_t', 'autoTriggerMilliseconds')]
     ),
    ('ps5000aSetTriggerDelay', 'SetTriggerDelay', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'delay')]
     ),
    ('ps5000aSigGenArbitraryMinMaxValues', 'SigGenArbitraryMinMaxValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'minArbitraryWaveformValue'),
      (POINTER(c_int16), 'int16_t*', 'maxArbitraryWaveformValue'),
      (POINTER(c_uint32), 'uint32_t*', 'minArbitraryWaveformSize'),
      (POINTER(c_uint32), 'uint32_t*', 'maxArbitraryWaveformSize')]
     ),
    ('ps5000aSigGenFrequencyToPhase', 'SigGenFrequencyToPhase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'frequency'),
      (c_enum, 'PS5000A_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'bufferLength'),
      (POINTER(c_uint32), 'uint32_t*', 'phase')]
     ),
    ('ps5000aSigGenSoftwareControl', 'SigGenSoftwareControl', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
    ('ps5000aStop', 'Stop', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps5000aTriggerWithinPreTriggerSamples', 'TriggerWithinPreTriggerSamples', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS5000A_TRIGGER_WITHIN_PRE_TRIGGER', 'state')]
     ),
]


# ************************ SDK functions for ps6000Api ************************


ps6000Api_funcptrs = [
    ('ps6000CloseUnit', 'CloseUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps6000EnumerateUnits', 'EnumerateUnits', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'count'),
      (POINTER(c_int8), 'int8_t*', 'serials'),
      (POINTER(c_int16), 'int16_t*', 'serialLth')]
     ),
    ('ps6000FlashLed', 'FlashLed', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'start')]
     ),
    ('ps6000GetAnalogueOffset', 'GetAnalogueOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS6000_RANGE', 'range'),
      (c_enum, 'PS6000_COUPLING', 'coupling'),
      (POINTER(c_float), 'float*', 'maximumVoltage'),
      (POINTER(c_float), 'float*', 'minimumVoltage')]
     ),
    ('ps6000GetMaxDownSampleRatio', 'GetMaxDownSampleRatio', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'noOfUnaggreatedSamples'),
      (POINTER(c_uint32), 'uint32_t*', 'maxDownSampleRatio'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps6000GetNoOfCaptures', 'GetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nCaptures')]
     ),
    ('ps6000GetNoOfProcessedCaptures', 'GetNoOfProcessedCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'nProcessedCaptures')]
     ),
    ('ps6000GetStreamingLatestValues', 'GetStreamingLatestValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (ps6000StreamingReady, 'ps6000StreamingReady', 'lpPs'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps6000GetTimebase', 'GetTimebase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_uint32, 'uint32_t', 'noSamples'),
      (POINTER(c_int32), 'int32_t*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_uint32), 'uint32_t*', 'maxSamples'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps6000GetTimebase2', 'GetTimebase2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_uint32, 'uint32_t', 'noSamples'),
      (POINTER(c_float), 'float*', 'timeIntervalNanoseconds'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_uint32), 'uint32_t*', 'maxSamples'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps6000GetTriggerTimeOffset', 'GetTriggerTimeOffset', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (POINTER(c_enum), 'PS6000_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps6000GetTriggerTimeOffset64', 'GetTriggerTimeOffset64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'time'),
      (POINTER(c_enum), 'PS6000_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'segmentIndex')]
     ),
    ('ps6000GetUnitInfo', 'GetUnitInfo', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'string'),
      (c_int16, 'int16_t', 'stringLength'),
      (POINTER(c_int16), 'int16_t*', 'requiredSize'),
      (PICO_INFO, 'PICO_INFO', 'info')]
     ),
    ('ps6000GetValues', 'GetValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps6000GetValuesAsync', 'GetValuesAsync', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (c_uint32, 'uint32_t', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (ps6000DataReady, 'void*', 'lpDataReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps6000GetValuesBulk', 'GetValuesBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps6000GetValuesBulkAsyc', 'GetValuesBulkAsyc', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps6000GetValuesOverlapped', 'GetValuesOverlapped', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps6000GetValuesOverlappedBulk', 'GetValuesOverlappedBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'startIndex'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfSamples'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex'),
      (POINTER(c_int16), 'int16_t*', 'overflow')]
     ),
    ('ps6000GetValuesTriggerTimeOffsetBulk', 'GetValuesTriggerTimeOffsetBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timesUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timesLower'),
      (POINTER(c_enum), 'PS6000_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps6000GetValuesTriggerTimeOffsetBulk64', 'GetValuesTriggerTimeOffsetBulk64', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'times'),
      (POINTER(c_enum), 'PS6000_TIME_UNITS*', 'timeUnits'),
      (c_uint32, 'uint32_t', 'fromSegmentIndex'),
      (c_uint32, 'uint32_t', 'toSegmentIndex')]
     ),
    ('ps6000IsReady', 'IsReady', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'ready')]
     ),
    ('ps6000IsTriggerOrPulseWidthQualifierEnabled', 'IsTriggerOrPulseWidthQualifierEnabled', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'triggerEnabled'),
      (POINTER(c_int16), 'int16_t*', 'pulseWidthQualifierEnabled')]
     ),
    ('ps6000MemorySegments', 'MemorySegments', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'nSegments'),
      (POINTER(c_uint32), 'uint32_t*', 'nMaxSamples')]
     ),
    ('ps6000NoOfStreamingValues', 'NoOfStreamingValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'noOfValues')]
     ),
    ('ps6000OpenUnit', 'OpenUnit', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps6000OpenUnitAsync', 'OpenUnitAsync', PICO_STATUS, 'errcheck_api',
     [(POINTER(c_int16), 'int16_t*', 'status'),
      (POINTER(c_int8), 'int8_t*', 'serial')]
     ),
    ('ps6000OpenUnitProgress', 'OpenUnitProgress', PICO_STATUS, None,
     [(POINTER(c_int16), 'int16_t*', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'progressPercent'),
      (POINTER(c_int16), 'int16_t*', 'complete')]
     ),
    ('ps6000PingUnit', 'PingUnit', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
    ('ps6000RunBlock', 'RunBlock', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'noOfPreTriggerSamples'),
      (c_uint32, 'uint32_t', 'noOfPostTriggerSamples'),
      (c_uint32, 'uint32_t', 'timebase'),
      (c_int16, 'int16_t', 'oversample'),
      (POINTER(c_int32), 'int32_t*', 'timeIndisposedMs'),
      (c_uint32, 'uint32_t', 'segmentIndex'),
      (BlockReady, 'ps6000BlockReady', 'lpReady'),
      (POINTER(c_void_p), 'void*', 'pParameter')]
     ),
    ('ps6000RunStreaming', 'RunStreaming', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'sampleInterval'),
      (c_enum, 'PS6000_TIME_UNITS', 'sampleIntervalTimeUnits'),
      (c_uint32, 'uint32_t', 'maxPreTriggerSamples'),
      (c_uint32, 'uint32_t', 'maxPostPreTriggerSamples'),
      (c_int16, 'int16_t', 'autoStop'),
      (c_uint32, 'uint32_t', 'downSampleRatio'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode'),
      (c_uint32, 'uint32_t', 'overviewBufferSize')]
     ),
    ('ps6000SetChannel', 'SetChannel', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS6000_CHANNEL', 'channel'),
      (c_int16, 'int16_t', 'enabled'),
      (c_enum, 'PS6000_COUPLING', 'type'),
      (c_enum, 'PS6000_RANGE', 'range'),
      (c_float, 'float', 'analogueOffset'),
      (c_enum, 'PS6000_BANDWIDTH_LIMITER', 'bandwidth')]
     ),
    ('ps6000SetDataBuffer', 'SetDataBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS6000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_uint32, 'uint32_t', 'bufferLth'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode')]
     ),
    ('ps6000SetDataBufferBulk', 'SetDataBufferBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS6000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'buffer'),
      (c_uint32, 'uint32_t', 'bufferLth'),
      (c_uint32, 'uint32_t', 'waveform'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode')]
     ),
    ('ps6000SetDataBuffers', 'SetDataBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS6000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_uint32, 'uint32_t', 'bufferLth'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode')]
     ),
    ('ps6000SetDataBuffersBulk', 'SetDataBuffersBulk', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS6000_CHANNEL', 'channel'),
      (POINTER(c_int16), 'int16_t*', 'bufferMax'),
      (POINTER(c_int16), 'int16_t*', 'bufferMin'),
      (c_uint32, 'uint32_t', 'bufferLth'),
      (c_uint32, 'uint32_t', 'waveform'),
      (c_enum, 'PS6000_RATIO_MODE', 'downSampleRatioMode')]
     ),
    ('ps6000SetEts', 'SetEts', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS6000_ETS_MODE', 'mode'),
      (c_int16, 'int16_t', 'etsCycles'),
      (c_int16, 'int16_t', 'etsInterleave'),
      (POINTER(c_int32), 'int32_t*', 'sampleTimePicoseconds')]
     ),
    ('ps6000SetEtsTimeBuffer', 'SetEtsTimeBuffer', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int64), 'int64_t*', 'buffer'),
      (c_uint32, 'uint32_t', 'bufferLth')]
     ),
    ('ps6000SetEtsTimeBuffers', 'SetEtsTimeBuffers', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_uint32), 'uint32_t*', 'timeUpper'),
      (POINTER(c_uint32), 'uint32_t*', 'timeLower'),
      (c_uint32, 'uint32_t', 'bufferLth')]
     ),
    ('ps6000SetExternalClock', 'SetExternalClock', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS6000_EXTERNAL_FREQUENCY', 'frequency'),
      (c_int16, 'int16_t', 'threshold')]
     ),
    ('ps6000SetNoOfCaptures', 'SetNoOfCaptures', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'nCaptures')]
     ),
    ('ps6000SetPulseWidthQualifier', 'SetPulseWidthQualifier', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS6000PwqConditions), 'PS6000_PWQ_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions'),
      (c_enum, 'PS6000_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'lower'),
      (c_uint32, 'uint32_t', 'upper'),
      (c_enum, 'PS6000_PULSE_WIDTH_TYPE', 'type')]
     ),
    ('ps6000SetSigGenArbitrary', 'SetSigGenArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (ndpointer(dtype=c_int16, ndim=1, flags='C_CONTIGUOUS'), 'int16_t*', 'arbitraryWaveform'),
      (c_int32, 'int32_t', 'arbitraryWaveformSize'),
      (c_enum, 'PS6000_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS6000_EXTRA_OPERATIONS', 'operation'),
      (c_enum, 'PS6000_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS6000_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS6000_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps6000SetSigGenBuiltIn', 'SetSigGenBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_int16, 'int16_t', 'waveType'),
      (c_float, 'float', 'startFrequency'),
      (c_float, 'float', 'stopFrequency'),
      (c_float, 'float', 'increment'),
      (c_float, 'float', 'dwellTime'),
      (c_enum, 'PS6000_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS6000_EXTRA_OPERATIONS', 'operation'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS6000_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS6000_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps6000SetSigGenBuiltInV2', 'SetSigGenBuiltInV2', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_int16, 'int16_t', 'waveType'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS6000_SWEEP_TYPE', 'sweepType'),
      (c_enum, 'PS6000_EXTRA_OPERATIONS', 'operation'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS6000_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS6000_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps6000SetSigGenPropertiesArbitrary', 'SetSigGenPropertiesArbitrary', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_uint32, 'uint32_t', 'startDeltaPhase'),
      (c_uint32, 'uint32_t', 'stopDeltaPhase'),
      (c_uint32, 'uint32_t', 'deltaPhaseIncrement'),
      (c_uint32, 'uint32_t', 'dwellCount'),
      (c_enum, 'PS6000_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS6000_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS6000_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps6000SetSigGenPropertiesBuiltIn', 'SetSigGenPropertiesBuiltIn', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int32, 'int32_t', 'offsetVoltage'),
      (c_uint32, 'uint32_t', 'pkToPk'),
      (c_double, 'double', 'startFrequency'),
      (c_double, 'double', 'stopFrequency'),
      (c_double, 'double', 'increment'),
      (c_double, 'double', 'dwellTime'),
      (c_enum, 'PS6000_SWEEP_TYPE', 'sweepType'),
      (c_uint32, 'uint32_t', 'shots'),
      (c_uint32, 'uint32_t', 'sweeps'),
      (c_enum, 'PS6000_SIGGEN_TRIG_TYPE', 'triggerType'),
      (c_enum, 'PS6000_SIGGEN_TRIG_SOURCE', 'triggerSource'),
      (c_int16, 'int16_t', 'extInThreshold')]
     ),
    ('ps6000SetSimpleTrigger', 'SetSimpleTrigger', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'enable'),
      (c_enum, 'PS6000_CHANNEL', 'source'),
      (c_int16, 'int16_t', 'threshold'),
      (c_enum, 'PS6000_THRESHOLD_DIRECTION', 'direction'),
      (c_uint32, 'uint32_t', 'delay'),
      (c_int16, 'int16_t', 'autoTrigger_ms')]
     ),
    ('ps6000SetTriggerChannelConditions', 'SetTriggerChannelConditions', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS6000TriggerConditions), 'PS6000_TRIGGER_CONDITIONS*', 'conditions'),
      (c_int16, 'int16_t', 'nConditions')]
     ),
    ('ps6000SetTriggerChannelDirections', 'SetTriggerChannelDirections', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_enum, 'PS6000_THRESHOLD_DIRECTION', 'channelA'),
      (c_enum, 'PS6000_THRESHOLD_DIRECTION', 'channelB'),
      (c_enum, 'PS6000_THRESHOLD_DIRECTION', 'channelC'),
      (c_enum, 'PS6000_THRESHOLD_DIRECTION', 'channelD'),
      (c_enum, 'PS6000_THRESHOLD_DIRECTION', 'ext'),
      (c_enum, 'PS6000_THRESHOLD_DIRECTION', 'aux')]
     ),
    ('ps6000SetTriggerChannelProperties', 'SetTriggerChannelProperties', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(PS6000TriggerChannelProperties), 'PS6000_TRIGGER_CHANNEL_PROPERTIES*', 'channelProperties'),
      (c_int16, 'int16_t', 'nChannelProperties'),
      (c_int16, 'int16_t', 'auxOutputEnable'),
      (c_int32, 'int32_t', 'autoTriggerMilliseconds')]
     ),
    ('ps6000SetTriggerDelay', 'SetTriggerDelay', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'delay')]
     ),
    ('ps6000SetWaveformLimiter', 'SetWaveformLimiter', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_uint32, 'uint32_t', 'nWaveformsPerSecond')]
     ),
    ('ps6000SigGenArbitraryMinMaxValues', 'SigGenArbitraryMinMaxValues', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (POINTER(c_int16), 'int16_t*', 'minArbitraryWaveformValue'),
      (POINTER(c_int16), 'int16_t*', 'maxArbitraryWaveformValue'),
      (POINTER(c_uint32), 'uint32_t*', 'minArbitraryWaveformSize'),
      (POINTER(c_uint32), 'uint32_t*', 'maxArbitraryWaveformSize')]
     ),
    ('ps6000SigGenFrequencyToPhase', 'SigGenFrequencyToPhase', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_double, 'double', 'frequency'),
      (c_enum, 'PS6000_INDEX_MODE', 'indexMode'),
      (c_uint32, 'uint32_t', 'bufferLength'),
      (POINTER(c_uint32), 'uint32_t*', 'phase')]
     ),
    ('ps6000SigGenSoftwareControl', 'SigGenSoftwareControl', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle'),
      (c_int16, 'int16_t', 'state')]
     ),
    ('ps6000Stop', 'Stop', PICO_STATUS, 'errcheck_api',
     [(c_int16, 'int16_t', 'handle')]
     ),
]
