U2C-11 USB-I2C/SPI/GPIO Interface Adapter

 
Main Page   Modules   Compound List   File List   Compound Members   File Members  

GPIO routines


Functions

U2C_RESULT U2C_SetIoDirection (HANDLE hDevice, ULONG Value, ULONG Mask)
 Configure GPIO direction. More...

U2C_RESULT U2C_GetIoDirection (HANDLE hDevice, ULONG *pValue,)
 Get GPIO direction. More...

U2C_RESULT U2C_IoWrite (HANDLE hDevice, ULONG Value, ULONG Mask)
 Set GPIO output state. More...

U2C_RESULT U2C_IoRead (HANDLE hDevice, ULONG *pValue,)
 Get GPIO state. More...

U2C_RESULT U2C_SetSingleIoDirection (HANDLE hDevice, ULONG IoNumber, BOOL bOutput)
 Set pin direction. More...

U2C_RESULT U2C_GetSingleIoDirection (HANDLE hDevice, ULONG IoNumber, BOOL *pbOutput)
 Get pin direction. More...

U2C_RESULT U2C_SingleIoWrite (HANDLE hDevice, ULONG IoNumber, BOOL Value)
 Set pin output value. More...

U2C_RESULT U2C_SingleIoRead (HANDLE hDevice, ULONG IoNumber, BOOL *pValue)
 Get pin input value. More...


Function Documentation

U2C_RESULT _stdcall U2C_GetIoDirection ( HANDLE hDevice,
ULONG * pValue )
 

Get GPIO direction.

The U2C_GetIoDirection function obtains current input/output direction of the GPIO port pins.

Parameters:
hDevice   Handle to the I2CBridge device
pValue   A pointer to unsigned long to be filled with the direction of the GPIO pins. pValue is treated as unsigned long 0xXXCCBBAA, where CC, BB and AA correspond to the C, B and A port pins:
  • AA bits 7..0 correspond to Port A pins 7..0
  • BB bits 7..0 correspond to Port B pins 7..0
  • CC bits 7..0 correspond to Port C pins 7..0
  • XX bits 7..0 reserved Bit set to 1 indicates configuration of the corresponding pin as output Bit set to 0 indicates configuration of the corresponding pin as input
Returns:
  • U2C_SUCCESS - The GPIO pins direction was successfully read
  • U2C_HARDWARE_NOT_FOUND - I2CBridge device referenced by hDevice handle was not found
  • U2C_RESULT _stdcall U2C_GetSingleIoDirection ( HANDLE hDevice,
    ULONG IoNumber,
    BOOL * pbOutput )
     

    Get pin direction.

    The U2C_GetSingleIoDirection function obtains input/output direction of the specified GPIO port pin.

    Parameters:
    hDevice   Handle to the I2CBridge device
    IoNumber   The number of the GPIO pin to obtain direction
    • Numbers 0..7 correspond to Port A pins 0..7
    • Numbers 8..15 correspond to Port B pins 0..7
    • Number 16..23 correspond to Port C pins 0..7
    pbOutput   A pointer to the boolean to be filled with the direction of the pin.
  • *pbOutput = TRUE indicates that the pin is configured for output
  • *pbOutput = FALSE indicates that the pin is configured for input
  • Returns:
    • U2C_SUCCESS - The GPIO pin direction was successfully read
    • U2C_HARDWARE_NOT_FOUND - I2CBridge device referenced by hDevice handle was not found
    • U2C_BAD_PARAMETER - IoNumber is out of range

    U2C_RESULT _stdcall U2C_IoRead ( HANDLE hDevice,
    ULONG * pValue )
     

    Get GPIO state.

    The U2C_IoRead function obtains the value of the GPIO port pins.

    Parameters:
    hDevice   Handle to the I2CBridge device
    pValue   A pointer to unsigned long to be filled with the value of the GPIO pins. pValue is treated as unsigned long 0xXXCCBBAA, where CC, BB and AA correspond to the C, B and A port pins:
    • AA bits 7..0 correspond to Port A pins 7..0
    • BB bits 7..0 correspond to Port B pins 7..0
    • CC bits 7..0 correspond to Port C pins 7..0
    • XX bits 7..0 reserved
    Returns:
    • U2C_SUCCESS - The GPIO pins state was successfully read
    • U2C_HARDWARE_NOT_FOUND - I2CBridge device referenced by hDevice handle was not found

    U2C_RESULT _stdcall U2C_IoWrite ( HANDLE hDevice,
    ULONG Value,
    ULONG Mask )
     

    Set GPIO output state.

    The U2C_IoWrite sets the output value of the GPIO port pins. Pins have to be configured as output using U2C_SetIoDirection function first.

    Parameters:
    hDevice   Handle to the I2CBridge device
    Value   An unsigned long value specifying the value to be set to the GPIO pins Value is treated as unsigned long 0xXXCCBBAA, where CC, BB and AA correspond to the C, B and A port pins:
    • AA bits 7..0 correspond to Port A pins 7..0
    • BB bits 7..0 correspond to Port B pins 7..0
    • CC bits 7..0 correspond to Port C pins 7..0
    • XX bits 7..0 reserved
    Mask   An unsigned long value specifying the data mask to use when modifying the GPIO pins output value. The mask value allows modification of the desired pins only, leaving rest of the pins unchanged. The bit mapping for Mask parameter is exactly the same as for Value parameter. Only value of the pins with mask bit set to 1 will be changed
    Returns:
  • U2C_SUCCESS - The GPIO pins output value was successfully modified
  • U2C_HARDWARE_NOT_FOUND - I2CBridge device referenced by hDevice handle was not found
  • U2C_RESULT _stdcall U2C_SetIoDirection ( HANDLE hDevice,
    ULONG Value,
    ULONG Mask )
     

    Configure GPIO direction.

    The U2C_SetIoDirection function configures input/output direction of the GPIO port pins.

    Parameters:
    hDevice   Handle to the I2CBridge device
    Value   An unsigned long value specifying the direction of the GPIO Value is treated as unsigned long 0xXXCCBBAA, where CC, BB and AA correspond to the C, B and A port pins:
    • AA bits 7..0 correspond to Port A pins 7..0
    • BB bits 7..0 correspond to Port B pins 7..0
    • CC bits 7..0 correspond to Port C pins 7..0
    • XX bits 7..0 reserved Bit set to 1 indicates configuration of the corresponding pin as output Bit set to 0 indicates configuration of the corresponding pin as input
    Mask   An unsigned long value specifying the data mask to use when modifying the GPIO pins direction. The mask value allows modification of the desired pins only, living rest of the pins unchanged. The bit mapping for Mask parameter is exactly the same as for Value parameter. Only direction of the pins with the mask bit set to 1 will be changed
    Returns:
  • U2C_SUCCESS - The GPIO pins direction was successfully modified
  • U2C_HARDWARE_NOT_FOUND - I2CBridge device referenced by hDevice handle was not found
  • U2C_RESULT _stdcall U2C_SetSingleIoDirection ( HANDLE hDevice,
    ULONG IoNumber,
    BOOL bOutput )
     

    Set pin direction.

    The U2C_SetSingleIoDirection function configures i nput/output direction of the specified GPIO port pin.

    Parameters:
    hDevice   Handle to the I2CBridge device
    IoNumber   The number of the GPIO pin to change direction
    • Numbers 0..7 correspond to Port A pins 0..7
    • Numbers 8..15 correspond to Port B pins 0..7
    • Number 16..23 correspond to Port C pins 0..7
    bOutput   The direction of the pin.
  • bOutput = TRUE configures the pin for output
  • bOutput = FALSE configures the pin for input
  • Returns:
    • U2C_SUCCESS - The GPIO pin direction was successfully modified
    • U2C_HARDWARE_NOT_FOUND - I2CBridge device referenced by hDevice handle was not found
    • U2C_BAD_PARAMETER - IoNumber is out of range

    U2C_RESULT _stdcall U2C_SingleIoRead ( HANDLE hDevice,
    ULONG IoNumber,
    BOOL * pValue )
     

    Get pin input value.

    The U2C_SingleIoRead function obtains the value of the specified GPIO port pin.

    Parameters:
    hDevice   Handle to the I2CBridge device
    IoNumber   The number of the GPIO pin to obtain value from
    • Numbers 0..7 correspond to Port A pins 0..7
    • Numbers 8..15 correspond to Port B pins 0..7
    • Number 16..23 correspond to Port C pins 0..7
    pValue   A pointer to boolean to be filled with the GPIO pin state.
    Returns:
  • U2C_SUCCESS - The GPIO pin state was successfully read
  • U2C_HARDWARE_NOT_FOUND - I2CBridge device referenced by hDevice handle was not found U2C_BAD_PARAMETER IoNumber is out of range
  • U2C_RESULT _stdcall U2C_SingleIoWrite ( HANDLE hDevice,
    ULONG IoNumber,
    BOOL Value )
     

    Set pin output value.

    The U2C_SingleIoWrite function sets the output value of the specified GPIO port pin. Pin must be configured as output using U2C_SetIoDirection or U2C_SetSingleIoDirection functions first

    Parameters:
    hDevice   Handle to the I2CBridge device
    IoNumber   The number of the GPIO pin to set output value to
    • Numbers 0..7 correspond to Port A pins 0..7
    • Numbers 8..15 correspond to Port B pins 0..7
    • Number 16..23 correspond to Port C pins 0..7
    Value   The GPIO pin new output value
    Returns:
  • U2C_SUCCESS - The GPIO pin output value was successfully modified
  • U2C_HARDWARE_NOT_FOUND - I2CBridge device referenced by hDevice handle was not found
  • U2C_BAD_PARAMETER - IoNumber is out of range
  • Copyright DiMAX 2002-2004