#ifndef USBLISMPI26_H
#define USBLISMPI26_H

/*
 * USB LISM-PI26xx V2 public C/C++ API.
 * Supports Windows (DLL) and Linux/ARM (shared library).
 * Legacy single-device functions and handle-based *_ex multi-device
 * functions are declared in one header.
 */

#include <stdint.h>

#ifdef _WIN32
#  define LS_CALL __stdcall
#  if defined(USBLISMPI26_STATIC)
#    define LS_API
#  elif defined(USBLISMPI26_EXPORTS)
#    define LS_API __declspec(dllexport)
#  else
#    define LS_API __declspec(dllimport)
#  endif
#else
#  define LS_CALL
#  define LS_API
#endif

#ifdef __cplusplus
extern "C" {
#endif

#define LS_RET_OK UINT32_C(0)
#define LS_LISM_ADDR UINT8_C(0xFE)

typedef void* ls_handle_t;
#ifdef _WIN32
typedef uint32_t ls_result_t;
#else
typedef int32_t ls_result_t;
#endif

#define LS_THREAD_PRIORITY_NORMAL       INT32_C(0)
#define LS_THREAD_PRIORITY_ABOVE_NORMAL INT32_C(1)
#define LS_THREAD_PRIORITY_HIGH         INT32_C(2)

/* BEGIN GENERATED LS ERROR CODES */
#if defined(_WIN32)
#define LS_OK                                  ((ls_result_t)0)
#define LS_ERR_NO_DEVICES_ATTACHED             ((ls_result_t)0x20000001)
#define LS_ERR_DEVICE_INDEX_OUT_OF_RANGE       ((ls_result_t)0x20000002)
#define LS_ERR_SERIAL_NUM_NOT_FOUND            ((ls_result_t)0x20000003)
#define LS_ERR_INVALID_HANDLE                  ((ls_result_t)6)
#define LS_ERR_DEVICE_ACTIVE                   ((ls_result_t)0x20000011)
#define LS_ERR_CONTROL_TRANSFER                ((ls_result_t)0x20000015)
#define LS_ERR_TIMEOUT                         ((ls_result_t)1460)
#define LS_ERR_DEVICE_ALREADY_OPEN             ((ls_result_t)0x20000013)
#define LS_ERR_NOT_IMPLEMENTED                 ((ls_result_t)0x20000014)
#define LS_ERR_ALLOCATE_THREADPARAM_MEM        ((ls_result_t)0x20000004)
#define LS_ERR_PATH_INVALID_HANDLE             ((ls_result_t)0x20000006)
#define LS_ERR_INVALID_DATALEN                 ((ls_result_t)0x21000001)
#define LS_ERR_I2C_NACK                        ((ls_result_t)0x21000004)
#define LS_ERR_I2C_ERROR                       ((ls_result_t)0x21000005)
#define LS_ERR_I2C_UNKNOWN                     ((ls_result_t)0x21000006)
#define LS_ERR_I2C_MUX_DISABLED                ((ls_result_t)0x21000007)
#define LS_ERR_INVALID_PACKETLENGTH            ((ls_result_t)0x21000002)
#define LS_ERR_CMD_NOT_SUPPORTED               ((ls_result_t)0x21000003)
#define LS_ERR_PIPE_CANCELLED                  ((ls_result_t)109)
#define LS_ERR_INVALID_TIMEOUT                 ((ls_result_t)0x21000008)
#define LS_ERR_INVALID_THREAD_PRIORITY         ((ls_result_t)0x21000009)
#define LS_ERR_THREAD_PRIORITY_FAILED          ((ls_result_t)0x2100000A)
#else
#define LS_OK                                  ((ls_result_t)0)
#define LS_ERR_NO_DEVICES_ATTACHED             ((ls_result_t)-10001)
#define LS_ERR_DEVICE_INDEX_OUT_OF_RANGE       ((ls_result_t)-10002)
#define LS_ERR_SERIAL_NUM_NOT_FOUND            ((ls_result_t)-10003)
#define LS_ERR_INVALID_HANDLE                  ((ls_result_t)-10004)
#define LS_ERR_DEVICE_ACTIVE                   ((ls_result_t)-10005)
#define LS_ERR_CONTROL_TRANSFER                ((ls_result_t)-10006)
#define LS_ERR_TIMEOUT                         ((ls_result_t)-10007)
#define LS_ERR_DEVICE_ALREADY_OPEN             ((ls_result_t)-10008)
#define LS_ERR_NOT_IMPLEMENTED                 ((ls_result_t)-10009)
#define LS_ERR_ALLOCATE_THREADPARAM_MEM        ((ls_result_t)-10010)
#define LS_ERR_PATH_INVALID_HANDLE             ((ls_result_t)-10012)
#define LS_ERR_INVALID_DATALEN                 ((ls_result_t)-10051)
#define LS_ERR_I2C_NACK                        ((ls_result_t)-10052)
#define LS_ERR_I2C_ERROR                       ((ls_result_t)-10053)
#define LS_ERR_I2C_UNKNOWN                     ((ls_result_t)-10054)
#define LS_ERR_I2C_MUX_DISABLED                ((ls_result_t)-10055)
#define LS_ERR_INVALID_PACKETLENGTH            ((ls_result_t)-10056)
#define LS_ERR_CMD_NOT_SUPPORTED               ((ls_result_t)-10057)
#define LS_ERR_PIPE_CANCELLED                  ((ls_result_t)-10058)
#define LS_ERR_INVALID_TIMEOUT                 ((ls_result_t)-10059)
#define LS_ERR_INVALID_THREAD_PRIORITY         ((ls_result_t)-10060)
#define LS_ERR_THREAD_PRIORITY_FAILED          ((ls_result_t)-10061)
#endif
/* END GENERATED LS ERROR CODES */

#ifdef _WIN32
uint16_t LS_CALL ls_libversion(void);
uint32_t LS_CALL ls_initialize(uint32_t pipe_size, uint32_t packet_length,
  uint32_t thread_class, int32_t thread_priority, const char* message_id);
int32_t LS_CALL ls_enumdevices(void);
uint16_t LS_CALL ls_getfwversion(int32_t index);
const char* LS_CALL ls_getvendorname(int32_t index);
const char* LS_CALL ls_getproductname(int32_t index);
const char* LS_CALL ls_getserialnumber(int32_t index);
uint8_t LS_CALL ls_devicecount(void);
int32_t LS_CALL ls_currentdeviceindex(void);
uint32_t LS_CALL ls_opendevicebyindex(int32_t index);
uint32_t LS_CALL ls_opendevicebyserial(const char* serial_num);
uint32_t LS_CALL ls_closedevice(void);

uint32_t LS_CALL ls_waitforpipe(uint32_t timeout_ms);
uint32_t LS_CALL ls_waitforpipecount(int32_t count, int32_t* available, uint32_t timeout_ms);
uint32_t LS_CALL ls_getpipe(void* buffer, uint32_t to_read, uint32_t* read_count);
uint32_t LS_CALL ls_setpacketlength(uint32_t packet_length);
uint32_t LS_CALL ls_seteptimeout(uint32_t timeout_ms);
uint32_t LS_CALL ls_geteptimeout(void);
uint32_t LS_CALL ls_getfps(void);
const char* LS_CALL ls_geterrorstring(uint32_t error_code);
uint32_t LS_CALL ls_customfirmware(uint32_t* custom_firmware);
uint32_t LS_CALL ls_setcfg1(uint8_t cfg1);
uint32_t LS_CALL ls_getcfg1(uint8_t* cfg1);
uint32_t LS_CALL ls_getpacketlength(uint32_t* packet_length);

uint32_t LS_CALL ls_setmuxchannel(uint8_t mux);
uint32_t LS_CALL ls_getmuxchannel(int8_t* mux);
uint32_t LS_CALL ls_readi2c_ext(uint8_t i2c_address, void* buffer, uint16_t* length);
uint32_t LS_CALL ls_writei2c_ext(uint8_t i2c_address, const void* buffer, uint16_t length);
uint32_t LS_CALL ls_readi2c(uint8_t i2c_address, void* buffer, uint16_t* length);
uint32_t LS_CALL ls_writei2c(uint8_t i2c_address, const void* buffer, uint16_t length);
uint32_t LS_CALL ls_i2cread1byte(uint8_t i2c_address, uint8_t i2c_register, uint8_t* value);
uint32_t LS_CALL ls_i2cread2bytes(uint8_t i2c_address, uint8_t i2c_register, uint16_t* value);
uint32_t LS_CALL ls_i2cread4bytes(uint8_t i2c_address, uint8_t i2c_register, uint32_t* value);
uint32_t LS_CALL ls_i2cwrite1byte(uint8_t i2c_address, uint8_t i2c_register, uint8_t value);
uint32_t LS_CALL ls_i2cwrite2bytes(uint8_t i2c_address, uint8_t i2c_register, uint16_t value);
uint32_t LS_CALL ls_i2cwrite4bytes(uint8_t i2c_address, uint8_t i2c_register, uint32_t value);
uint32_t LS_CALL ls_i2cwritecmd(uint8_t i2c_address, uint8_t i2c_command);

uint32_t LS_CALL ls_hw_reset(uint8_t address);
uint32_t LS_CALL ls_suspend(uint8_t address);
uint32_t LS_CALL ls_resume(uint8_t address);
uint32_t LS_CALL ls_updateparam(uint8_t address);
uint32_t LS_CALL ls_setstate(uint8_t address, uint8_t state);
uint32_t LS_CALL ls_setmodeconfig(uint8_t address, uint8_t mode);
uint32_t LS_CALL ls_setifconfig(uint8_t address, uint8_t config);
uint32_t LS_CALL ls_setstpulse(uint8_t address, uint32_t high_value, uint32_t low_value);
uint32_t LS_CALL ls_setsthigh(uint8_t address, uint32_t high_value);
uint32_t LS_CALL ls_setstlow(uint8_t address, uint32_t low_value);
uint32_t LS_CALL ls_setlinesperframe(uint8_t address, uint16_t lines);
uint32_t LS_CALL ls_setquadcount(uint8_t address, uint32_t count);
uint32_t LS_CALL ls_setsofttriggertime(uint8_t address, uint32_t time_value);
uint32_t LS_CALL ls_settriggerdelay(uint8_t address, uint32_t delay_value);
uint32_t LS_CALL ls_settriggerwidth(uint8_t address, uint32_t width_value);
uint32_t LS_CALL ls_setpixelcount(uint8_t address, uint16_t pixel_count);
uint32_t LS_CALL ls_setedgedelay(uint8_t address, uint8_t edge_delay);
uint32_t LS_CALL ls_setadcvref(uint8_t address, uint8_t vref);
uint32_t LS_CALL ls_setadcgain(uint8_t address, uint8_t gain);
uint32_t LS_CALL ls_setadcoffset(uint8_t address, uint16_t offset);
uint32_t LS_CALL ls_setadcbias(uint8_t address, uint16_t bias);
uint32_t LS_CALL ls_setslaveaddress(uint8_t address, uint8_t new_address);
uint32_t LS_CALL ls_saveslaveaddress(uint8_t address);
uint32_t LS_CALL ls_savesettings(uint8_t address);
uint32_t LS_CALL ls_reloadsettings(uint8_t address);
uint32_t LS_CALL ls_resetsettings(uint8_t address);

uint32_t LS_CALL ls_getmcuversion(uint8_t address, uint16_t* version);
uint32_t LS_CALL ls_getctgversion(uint8_t address, uint16_t* version);
uint32_t LS_CALL ls_getctgstate(uint8_t address, uint8_t* state);
uint32_t LS_CALL ls_getstate(uint8_t address, uint8_t* state);
uint32_t LS_CALL ls_getmodeconfig(uint8_t address, uint8_t* mode);
uint32_t LS_CALL ls_getifconfig(uint8_t address, uint8_t* config);
uint32_t LS_CALL ls_getstpulse(uint8_t address, uint32_t* high_value, uint32_t* low_value);
uint32_t LS_CALL ls_getsthigh(uint8_t address, uint32_t* high_value);
uint32_t LS_CALL ls_getstlow(uint8_t address, uint32_t* low_value);
uint32_t LS_CALL ls_getlinesperframe(uint8_t address, uint16_t* lines);
uint32_t LS_CALL ls_getquadcount(uint8_t address, uint32_t* count);
uint32_t LS_CALL ls_getsofttriggertime(uint8_t address, uint32_t* time_value);
uint32_t LS_CALL ls_gettriggerdelay(uint8_t address, uint32_t* delay_value);
uint32_t LS_CALL ls_gettriggerwidth(uint8_t address, uint32_t* width_value);
uint32_t LS_CALL ls_getpixelcount(uint8_t address, uint16_t* pixel_count);
uint32_t LS_CALL ls_getedgedelay(uint8_t address, uint8_t* edge_delay);
uint32_t LS_CALL ls_getadcvref(uint8_t address, uint8_t* vref);
uint32_t LS_CALL ls_getadcgain(uint8_t address, uint8_t* gain);
uint32_t LS_CALL ls_getadcoffset(uint8_t address, uint16_t* offset);
uint32_t LS_CALL ls_getadcbias(uint8_t address, uint16_t* bias);
uint32_t LS_CALL ls_getslaveaddress(uint8_t address, uint8_t* new_address);
uint32_t LS_CALL ls_gethw1id(uint8_t address, uint16_t* hardware_id);
uint32_t LS_CALL ls_gethw1version(uint8_t address, uint16_t* version);
uint32_t LS_CALL ls_gethw2version(uint8_t address, uint16_t* version);
uint32_t LS_CALL ls_getgainmult(uint8_t address, uint16_t* multiplier);
uint32_t LS_CALL ls_getgaindiv(uint8_t address, uint16_t* divisor);
uint32_t LS_CALL ls_getinitstatus(uint8_t address, uint8_t* status);
uint32_t LS_CALL ls_getcomresult(uint8_t address, uint8_t* result_value);

uint32_t LS_CALL ls_shutdown(void);
#else
/*
 * Linux/ARM V1.0 legacy-style API.
 * Established function names and timeout_ms-aware I2C/CTG calls are retained.
 * Platform-dependent types are normalized to fixed-width C types wherever
 * possible. C++ reference parameters are expressed as pointers so the header
 * can be used from both C and C++.
 */

uint16_t ls_libversion(void);
void ls_initialize(int32_t pipe_size, int32_t packet_length);
int32_t ls_enumdevices(void);
uint16_t ls_getfwversion(int32_t index);
const char* ls_getvendorname(int32_t index);
const char* ls_getproductname(int32_t index);
const char* ls_getserialnumber(int32_t index);
uint8_t ls_devicecount(void);
int32_t ls_currentdeviceindex(void);
int32_t ls_closedevice(void);
int32_t ls_opendevicebyindex(int32_t index);
int32_t ls_opendevicebyserial(const char* serial_num);
/*
 * Historical Linux legacy contract:
 * - blocks until exactly to_read bytes can be copied
 * - never performs a partial copy
 * - returns a negative error code on failure
 * - returns the exact byte count read on success
 */
int32_t ls_getpipe(void* buffer, uint32_t to_read);
int32_t ls_waitforpipe(uint32_t timeout_ms);
int32_t ls_waitforpipecount(int32_t count, int32_t* available, uint32_t timeout_ms);
int32_t ls_setpacketlength(int32_t packet_length);
int32_t ls_seteptimeout(uint32_t timeout_ms);
uint32_t ls_geteptimeout(void);
uint32_t ls_getfps(void);
const char* ls_geterrorstring(int32_t error_code);
int32_t ls_customfirmware(uint32_t* custom_firmware, uint32_t timeout_ms);
int32_t ls_setmuxchannel(uint8_t mux, uint32_t timeout_ms);
int32_t ls_getmuxchannel(int8_t* mux, uint32_t timeout_ms);
int32_t ls_readi2c_ext(uint8_t i2c_address, void* buffer, uint16_t* length, uint32_t timeout_ms);
int32_t ls_writei2c_ext(uint8_t i2c_address, const void* buffer, uint16_t length, uint32_t timeout_ms);
int32_t ls_readi2c(uint8_t i2c_address, void* buffer, uint16_t* length, uint32_t timeout_ms);
int32_t ls_writei2c(uint8_t i2c_address, const void* buffer, uint16_t length, uint32_t timeout_ms);
int32_t ls_i2cread1byte(uint8_t i2c_address, uint8_t i2c_register, uint8_t* value, uint32_t timeout_ms);
int32_t ls_i2cread2bytes(uint8_t i2c_address, uint8_t i2c_register, uint16_t* value, uint32_t timeout_ms);
int32_t ls_i2cread4bytes(uint8_t i2c_address, uint8_t i2c_register, uint32_t* value, uint32_t timeout_ms);
int32_t ls_i2cwrite1byte(uint8_t i2c_address, uint8_t i2c_register, uint8_t value, uint32_t timeout_ms);
int32_t ls_i2cwrite2bytes(uint8_t i2c_address, uint8_t i2c_register, uint16_t value, uint32_t timeout_ms);
int32_t ls_i2cwrite4bytes(uint8_t i2c_address, uint8_t i2c_register, uint32_t value, uint32_t timeout_ms);
int32_t ls_i2cwritecmd(uint8_t i2c_address, uint8_t i2c_command, uint32_t timeout_ms);
int32_t ls_setadcbias(uint8_t address, uint16_t bias, uint32_t timeout_ms);
int32_t ls_getadcbias(uint8_t address, uint16_t* bias, uint32_t timeout_ms);
int32_t ls_getadcvref(uint8_t address, uint8_t* vref, uint32_t timeout_ms);
int32_t ls_getadcgain(uint8_t address, uint8_t* gain, uint32_t timeout_ms);
int32_t ls_getadcoffset(uint8_t address, uint16_t* offset, uint32_t timeout_ms);
int32_t ls_setadcvref(uint8_t address, uint8_t vref, uint32_t timeout_ms);
int32_t ls_setadcgain(uint8_t address, uint8_t gain, uint32_t timeout_ms);
int32_t ls_setadcoffset(uint8_t address, uint16_t offset, uint32_t timeout_ms);
int32_t ls_gethw1id(uint8_t address, uint16_t* hardware_id, uint32_t timeout_ms);
int32_t ls_gethw1version(uint8_t address, uint16_t* version, uint32_t timeout_ms);
int32_t ls_gethw2version(uint8_t address, uint16_t* version, uint32_t timeout_ms);
int32_t ls_getgainmult(uint8_t address, uint16_t* multiplier, uint32_t timeout_ms);
int32_t ls_getgaindiv(uint8_t address,uint16_t* divisor, uint32_t timeout_ms);
int32_t ls_hw_reset(uint8_t address, uint32_t timeout_ms);
int32_t ls_suspend(uint8_t address, uint32_t timeout_ms);
int32_t ls_resume(uint8_t address, uint32_t timeout_ms);
int32_t ls_updateparam(uint8_t address, uint32_t timeout_ms);
int32_t ls_setstate(uint8_t address, uint8_t state, uint32_t timeout_ms);
int32_t ls_setmodeconfig(uint8_t address, uint8_t mode, uint32_t timeout_ms);
int32_t ls_setifconfig(uint8_t address, uint8_t config, uint32_t timeout_ms);
int32_t ls_setstpulse(uint8_t address, uint32_t high_value, uint32_t low_value, uint32_t timeout_ms);
int32_t ls_setsthigh(uint8_t address, uint32_t high_value, uint32_t timeout_ms);
int32_t ls_setstlow(uint8_t address, uint32_t low_value, uint32_t timeout_ms);
int32_t ls_setlinesperframe(uint8_t address, uint16_t lines, uint32_t timeout_ms);
int32_t ls_setquadcount(uint8_t address, uint32_t count, uint32_t timeout_ms);
int32_t ls_setsofttriggertime(uint8_t address, uint32_t time_value, uint32_t timeout_ms);
int32_t ls_settriggerdelay(uint8_t address, uint32_t delay_value, uint32_t timeout_ms);
int32_t ls_settriggerwidth(uint8_t address, uint32_t width_value, uint32_t timeout_ms);
int32_t ls_setpixelcount(uint8_t address, uint16_t pixel_count, uint32_t timeout_ms);
int32_t ls_setedgedelay(uint8_t address, uint8_t edge_delay, uint32_t timeout_ms);
int32_t ls_setslaveaddress(uint8_t address, uint8_t new_address, uint32_t timeout_ms);
int32_t ls_saveslaveaddress(uint8_t address, uint32_t timeout_ms);
int32_t ls_savesettings(uint8_t address, uint32_t timeout_ms);
int32_t ls_reloadsettings(uint8_t address, uint32_t timeout_ms);
int32_t ls_resetsettings(uint8_t address, uint32_t timeout_ms);
int32_t ls_getctgversion(uint8_t address, uint16_t* version, uint32_t timeout_ms);
int32_t ls_getmcuversion(uint8_t address, uint16_t* version, uint32_t timeout_ms);
int32_t ls_getctgstate(uint8_t address, uint8_t* state, uint32_t timeout_ms);
int32_t ls_getstate(uint8_t address, uint8_t* state, uint32_t timeout_ms);
int32_t ls_getmodeconfig(uint8_t address, uint8_t* mode, uint32_t timeout_ms);
int32_t ls_getifconfig(uint8_t address, uint8_t* config, uint32_t timeout_ms);
int32_t ls_getstpulse(uint8_t address, uint32_t* high_value, uint32_t* low_value, uint32_t timeout_ms);
int32_t ls_getsthigh(uint8_t address, uint32_t* high_value, uint32_t timeout_ms);
int32_t ls_getstlow(uint8_t address, uint32_t* low_value, uint32_t timeout_ms);
int32_t ls_getlinesperframe(uint8_t address, uint16_t* lines, uint32_t timeout_ms);
int32_t ls_getquadcount(uint8_t address, uint32_t* count, uint32_t timeout_ms);
int32_t ls_getsofttriggertime(uint8_t address, uint32_t* time_value, uint32_t timeout_ms);
int32_t ls_gettriggerdelay(uint8_t address, uint32_t* delay_value, uint32_t timeout_ms);
int32_t ls_gettriggerwidth(uint8_t address, uint32_t* width_value, uint32_t timeout_ms);
int32_t ls_getpixelcount(uint8_t address, uint16_t* pixel_count, uint32_t timeout_ms);
int32_t ls_getedgedelay(uint8_t address, uint8_t* edge_delay, uint32_t timeout_ms);
int32_t ls_getslaveaddress(uint8_t address, uint8_t* new_address, uint32_t timeout_ms);
int32_t ls_getinitstatus(uint8_t address, uint8_t* status, uint32_t timeout_ms);
int32_t ls_getcomresult(uint8_t address, uint8_t* result_value, uint32_t timeout_ms);
int32_t ls_setcfg1(uint8_t cfg1, uint32_t timeout_ms);
int32_t ls_getcfg1(uint8_t* cfg1, uint32_t timeout_ms);
int32_t ls_getpacketlength(int32_t* packet_length, uint32_t timeout_ms);

/* Common additions available in the new portable library. */
int32_t ls_shutdown(void);

#endif /* _WIN32 */

/* Handle-based multi-device API */

ls_result_t LS_CALL ls_seteptimeout_ex(ls_handle_t handle, uint32_t timeout_ms);
ls_result_t LS_CALL ls_geteptimeout_ex(ls_handle_t handle, uint32_t* timeout_ms);
ls_result_t LS_CALL ls_setthreadpriority_ex(ls_handle_t handle, int32_t priority);
ls_result_t LS_CALL ls_getthreadpriority_ex(ls_handle_t handle, int32_t* priority);

ls_result_t LS_CALL ls_opendevicebyindex_ex(int32_t index, uint32_t pipe_size, uint32_t packet_length, ls_handle_t* handle);
ls_result_t LS_CALL ls_opendevicebyserial_ex(const char* serial_num, uint32_t pipe_size, uint32_t packet_length, ls_handle_t* handle);
ls_result_t LS_CALL ls_closedevice_ex(ls_handle_t handle);

ls_result_t LS_CALL ls_getpipe_ex(ls_handle_t handle, void* buffer, uint32_t to_read, uint32_t* read_count);
ls_result_t LS_CALL ls_waitforpipe_ex(ls_handle_t handle, uint32_t timeout_ms);
ls_result_t LS_CALL ls_waitforpipecount_ex(ls_handle_t handle, int32_t count, int32_t* available, uint32_t timeout_ms);
uint32_t LS_CALL ls_getfps_ex(ls_handle_t handle);

ls_result_t LS_CALL ls_getpacketlength_ex(ls_handle_t handle, uint32_t* packet_length, uint32_t timeout_ms);
ls_result_t LS_CALL ls_customfirmware_ex(ls_handle_t handle, uint32_t* custom_firmware, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setcfg1_ex(ls_handle_t handle, uint8_t cfg1, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getcfg1_ex(ls_handle_t handle, uint8_t* cfg1, uint32_t timeout_ms);

ls_result_t LS_CALL ls_setslaveaddress_ex(ls_handle_t handle, uint8_t address, uint8_t new_address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getslaveaddress_ex(ls_handle_t handle, uint8_t address, uint8_t* new_address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_saveslaveaddress_ex(ls_handle_t handle, uint8_t address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setmuxchannel_ex(ls_handle_t handle, uint8_t mux, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getmuxchannel_ex(ls_handle_t handle, int8_t* mux, uint32_t timeout_ms);

ls_result_t LS_CALL ls_readi2c_ex(ls_handle_t handle, uint8_t i2c_address, void* buffer, uint16_t* length, uint32_t timeout_ms);
ls_result_t LS_CALL ls_writei2c_ex(ls_handle_t handle, uint8_t i2c_address, const void* buffer, uint16_t length, uint32_t timeout_ms);
ls_result_t LS_CALL ls_readi2c_ext_ex(ls_handle_t handle, uint8_t i2c_address, void* buffer, uint16_t* length, uint32_t timeout_ms);
ls_result_t LS_CALL ls_writei2c_ext_ex(ls_handle_t handle, uint8_t i2c_address, const void* buffer, uint16_t length, uint32_t timeout_ms);

ls_result_t LS_CALL ls_i2cread1byte_ex(ls_handle_t handle, uint8_t i2c_address, uint8_t i2c_register, uint8_t* value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_i2cread2bytes_ex(ls_handle_t handle, uint8_t i2c_address, uint8_t i2c_register, uint16_t* value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_i2cread4bytes_ex(ls_handle_t handle, uint8_t i2c_address, uint8_t i2c_register, uint32_t* value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_i2cwrite1byte_ex(ls_handle_t handle, uint8_t i2c_address, uint8_t i2c_register, uint8_t value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_i2cwrite2bytes_ex(ls_handle_t handle, uint8_t i2c_address, uint8_t i2c_register, uint16_t value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_i2cwrite4bytes_ex(ls_handle_t handle, uint8_t i2c_address, uint8_t i2c_register, uint32_t value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_i2cwritecmd_ex(ls_handle_t handle, uint8_t i2c_address, uint8_t i2c_command, uint32_t timeout_ms);

ls_result_t LS_CALL ls_hw_reset_ex(ls_handle_t handle, uint8_t address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_resume_ex(ls_handle_t handle, uint8_t address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_suspend_ex(ls_handle_t handle, uint8_t address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_updateparam_ex(ls_handle_t handle, uint8_t address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setstate_ex(ls_handle_t handle, uint8_t address, uint8_t state, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setmodeconfig_ex(ls_handle_t handle, uint8_t address, uint8_t mode, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setifconfig_ex(ls_handle_t handle, uint8_t address, uint8_t config, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setsthigh_ex(ls_handle_t handle, uint8_t address, uint32_t high_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setstlow_ex(ls_handle_t handle, uint8_t address, uint32_t low_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setstpulse_ex(ls_handle_t handle, uint8_t address, uint32_t high_value, uint32_t low_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setlinesperframe_ex(ls_handle_t handle, uint8_t address, uint16_t lines, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setquadcount_ex(ls_handle_t handle, uint8_t address, uint32_t count, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setsofttriggertime_ex(ls_handle_t handle, uint8_t address, uint32_t time_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_settriggerdelay_ex(ls_handle_t handle, uint8_t address, uint32_t delay_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_settriggerwidth_ex(ls_handle_t handle, uint8_t address, uint32_t width_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setpixelcount_ex(ls_handle_t handle, uint8_t address, uint16_t pixel_count, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setedgedelay_ex(ls_handle_t handle, uint8_t address, uint8_t edge_delay, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setadcvref_ex(ls_handle_t handle, uint8_t address, uint8_t vref, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setadcgain_ex(ls_handle_t handle, uint8_t address, uint8_t gain, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setadcoffset_ex(ls_handle_t handle, uint8_t address, uint16_t offset, uint32_t timeout_ms);
ls_result_t LS_CALL ls_setadcbias_ex(ls_handle_t handle, uint8_t address, uint16_t bias, uint32_t timeout_ms);

ls_result_t LS_CALL ls_getctgstate_ex(ls_handle_t handle, uint8_t address, uint8_t* state, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getstate_ex(ls_handle_t handle, uint8_t address, uint8_t* state, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getmodeconfig_ex(ls_handle_t handle, uint8_t address, uint8_t* mode, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getifconfig_ex(ls_handle_t handle, uint8_t address, uint8_t* config, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getsthigh_ex(ls_handle_t handle, uint8_t address, uint32_t* high_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getstlow_ex(ls_handle_t handle, uint8_t address, uint32_t* low_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getstpulse_ex(ls_handle_t handle, uint8_t address, uint32_t* high_value, uint32_t* low_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getlinesperframe_ex(ls_handle_t handle, uint8_t address, uint16_t* lines, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getquadcount_ex(ls_handle_t handle, uint8_t address, uint32_t* count, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getsofttriggertime_ex(ls_handle_t handle, uint8_t address, uint32_t* time_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_gettriggerdelay_ex(ls_handle_t handle, uint8_t address, uint32_t* delay_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_gettriggerwidth_ex(ls_handle_t handle, uint8_t address, uint32_t* width_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getpixelcount_ex(ls_handle_t handle, uint8_t address, uint16_t* pixel_count, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getedgedelay_ex(ls_handle_t handle, uint8_t address, uint8_t* edge_delay, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getadcvref_ex(ls_handle_t handle, uint8_t address, uint8_t* vref, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getadcgain_ex(ls_handle_t handle, uint8_t address, uint8_t* gain, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getgainmult_ex(ls_handle_t handle, uint8_t address, uint16_t* multiplier, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getgaindiv_ex(ls_handle_t handle, uint8_t address, uint16_t* divisor, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getadcoffset_ex(ls_handle_t handle, uint8_t address, uint16_t* offset, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getadcbias_ex(ls_handle_t handle, uint8_t address, uint16_t* bias, uint32_t timeout_ms);

ls_result_t LS_CALL ls_savesettings_ex(ls_handle_t handle, uint8_t address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_reloadsettings_ex(ls_handle_t handle, uint8_t address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_resetsettings_ex(ls_handle_t handle, uint8_t address, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getinitstatus_ex(ls_handle_t handle, uint8_t address, uint8_t* status, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getcomresult_ex(ls_handle_t handle, uint8_t address, uint8_t* result_value, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getmcuversion_ex(ls_handle_t handle, uint8_t address, uint16_t* version, uint32_t timeout_ms);
ls_result_t LS_CALL ls_getctgversion_ex(ls_handle_t handle, uint8_t address, uint16_t* version, uint32_t timeout_ms);
ls_result_t LS_CALL ls_gethw1id_ex(ls_handle_t handle, uint8_t address, uint16_t* hardware_id, uint32_t timeout_ms);
ls_result_t LS_CALL ls_gethw1version_ex(ls_handle_t handle, uint8_t address, uint16_t* version, uint32_t timeout_ms);
ls_result_t LS_CALL ls_gethw2version_ex(ls_handle_t handle, uint8_t address, uint16_t* version, uint32_t timeout_ms);


#ifdef __cplusplus
}
#endif

#endif /* USBLISMPI26_H */
