sub_gpio_config

Top  Previous  Next
Got to SUB-20 page

Synopsis

int   sub_gpio_config( sub_handle hndl, int set, int* get, int mask )

 

Configure GPIO state (direction) as input or output.

Parameters

set - Bits 0..31 of set parameter correspond to GPIO0..GPIO31 configuration bits. If GPIOn configuration bit is "1" then GPIOn direction is output, otherwise it is input.

*get - Pointer to store current GPIO configuration read from SUB-20.

mask - Bit in set parameter will take effect only if corresponding mask bit is "1". With mask=0 function will only read current GPIO configuration.

Return value

On success function returns 0. Otherwise error code.

Example

/* gpio0..6 - input, gpio7 - output */

rc = sub_gpio_config( hndl, 0x00000080, &config, 0x000000FF );

 

/* read gpio configuration */

rc = sub_gpio_config( hndl, 0, &config, 0 );

See also

Error Codes