Using GPIO

uEye Camera Manual Version 4.92


Using GPIO

Windows_Logo
Linux_Logo

USB 2.0

USB 3.0

GigE

USB 2.0

USB 3.0

GigE

Syntax

INT is_IO(HIDS hCam, UINT nCommand, void* pParam, UINT cbSizeOfParam)

Description

With the is_IO() function you control the additional digital outputs (GPIOs) of some uEye models. The GPIOs are not provided with optocouplers. For information on GPIO wiring, please refer to the D: Specifications chapter.

The nCommand input parameter is used to select the function mode. The pParam input parameter depends on the selected function mode. If you select functions for setting or returning a value, pParam contains a pointer to a variable of the UINT type. The size of the memory area to which pParam refers is specified in the cbSizeOfParam input parameter.

Input parameters

hCam

Camera handle

pParam

Pointer to a function parameter, whose function depends on nCommand.

cbSizeOfParam

Size (in bytes) of the memory area to which pParam refers.

Contents of the IO_GPIO_CONFIGURATION structure

UINT

u32Gpio

Sets the GPIO whose configuration is to be read or set (IO_GPIO_1, IO_GPIO_2). So this value must be initialized before the GPIO configuration is read or set.

UINT

u32Caps

When reading the configuration: ORed bitmask of the supported GPIO modes (IS_GPIO_INPUT | IS_GPIO_OUTPUT…).

UINT

u32Configuration

When reading the configuration: returns the current set configuration.

When setting the configuration: sets the configuration.

The following settings are possible:

•IS_GPIO_INPUT
GPIO is used as input

•IS_GPIO_OUTPUT
GPIO is used as output

•IS_GPIO_FLASH
GPIO is used for flash

•IS_GPIO_PWM
GPIO is used for pulse width modulation

•IS_GPIO_COMPORT_RX
Windows only: GPIO is used as serial interface (Example 3)

•IS_GPIO_COMPORT_TX
Windows only: GPIO is used as serial interface (Example 3)

•IS_GPIO_MULTI_INTEGRATION_MODE
GPIO is used for multi integration mode

•IS_GPIO_TRIGGER
USB 3 uEye CP/ML/LE and GigE uEye LE/RE PoE only: GPIO is used for trigger (Example 4)

UINT

u32State

•When reading the configuration: returns the current state of the GPIO (0 = Low, 1 = High).

•When setting the configuration: sets the state of the GPIO (0 = Low, 1 = High).

UINT

u32Reserved[12]

Reserved

Obsolete parameters

The following parameters for nCommand are obsolete and should no longer be used.

IS_IO_CMD_GPIOS_GET_SUPPORTED

Returns the supported GPIO ports:

•IO_FLASH_GPIO_PORT_MASK (IO_FLASH_MODE_GPIO_1 | IO_FLASH_MODE_GPIO_2)

IS_IO_CMD_GPIOS_GET_SUPPORTED_INPUTS

Returns the supported GPIO inputs.

IS_IO_CMD_GPIOS_GET_SUPPORTED_OUTPUTS

Returns the supported GPIO outputs.

IS_IO_CMD_GPIOS_GET_DIRECTION

Returns the input/output mask of the GPIOs.

IS_IO_CMD_GPIOS_SET_DIRECTION

Set the GPIO on input/output:

•IO_FLASH_MODE_GPIO_1: Sets GPIO 1 as outout.

•IO_FLASH_MODE_GPIO_2: Sets GPIO 2 as output.

IS_IO_CMD_GPIOS_GET_STATE

Returns the state of the GPIO (High, Low).

IS_IO_CMD_GPIOS_SET_STATE

Sets the state of the GPIOs if they are defined as output (High, Low).

Example 1

INT nRet = IS_SUCCESS;

 

IO_GPIO_CONFIGURATION gpioConfiguration;

 

// Read information about GPIO1

gpioConfiguration.u32Gpio = IO_GPIO_1;

 

nRet = is_IO(hCam, IS_IO_CMD_GPIOS_GET_CONFIGURATION, (void*)&gpioConfiguration,

            sizeof(gpioConfiguration) );

 

if (nRet == IS_SUCCESS)

{

if ((gpioConfiguration.u32Caps & IS_GPIO_PWM) != 0)

{

  // GPIO1 supports PWM

}

if ((gpioConfiguration.u32Caps & IS_GPIO_FLASH) != 0)

{

  // GPIO1 supports Flash

}

if (gpioConfiguration.u32Configuration == IS_GPIO_OUTPUT)

{

  // GPIO1 is currently configured as output

  if (gpioConfiguration.u32State == 1)

  {

    // GPIO1 is currently output HIGH

  }

}

}

Example 2

INT nRet = IS_SUCCESS;

 

IO_GPIO_CONFIGURATION gpioConfiguration;

 

// Set configuration of GPIO1 (OUTPUT LOW)

gpioConfiguration.u32Gpio = IO_GPIO_1;

gpioConfiguration.u32Configuration = IS_GPIO_OUTPUT;

gpioConfiguration.u32State = 0;

 

nRet = is_IO(hCam, IS_IO_CMD_GPIOS_SET_CONFIGURATION, (void*)&gpioConfiguration,

            sizeof(gpioConfiguration));

Example 3

INT nRet = IS_SUCCESS;

 

IO_GPIO_CONFIGURATION gpioConfiguration;

 

// Set configuration of GPIO1 (COM-port TX)

// GPIO1 configured as RX is not supported!

gpioConfiguration.u32Gpio = IO_GPIO_1;

gpioConfiguration.u32Configuration = IS_GPIO_COMPORT_TX;

 

// GPIO2 will be configured as IS_GPIO_COMPORT_RX automatically!

nRet = is_IO(hCam, IS_IO_CMD_GPIOS_SET_CONFIGURATION, (void*)&gpioConfiguration,
            sizeof(gpioConfiguration));

 

// The following code leads to the same setting

// Set configuration of GPIO2 (COM-port RX)

gpioConfiguration.u32Gpio = IO_GPIO_2;

gpioConfiguration.u32Configuration = IS_GPIO_COMPORT_RX;

 

// GPIO1 will be configured as IS_GPIO_COMPORT_TX automatically!

nRet = is_IO(hCam, IS_IO_CMD_GPIOS_SET_CONFIGURATION, (void*)&gpioConfiguration,
            sizeof(gpioConfiguration));

Example 4

INT nRet = IS_SUCCESS;
 
IO_GPIO_CONFIGURATION gpioConfiguration;
 
// Set configuration of GPIO1
gpioConfiguration.u32Gpio = IO_GPIO_1;
gpioConfiguration.u32Configuration = IS_GPIO_TRIGGER;
gpioConfiguration.u32State = 0;
 
nRet = is_IO(hCam, IS_IO_CMD_GPIOS_SET_CONFIGURATION, (void*)&gpioConfiguration,
            sizeof(gpioConfiguration));

Suggestion for improvement? Send us your short Feedback on this chapter. Thank you very much!
For technical questions please contact your local distributor or use the support form on our website.


© 2019 IDS Imaging Development Systems GmbH
https://en.ids-imaging.com