12.07.2015 Views

SUB-20 User Manual - Dimax

SUB-20 User Manual - Dimax

SUB-20 User Manual - Dimax

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

37<strong>SUB</strong>-<strong>20</strong><strong>SUB</strong>-<strong>20</strong> APIsub_gpiob_readsub_gpiob_write3.7.1 sub_gpio_configSynopsisint 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 <strong>SUB</strong>-<strong>20</strong>.· mask - Bit in set parameter will take effect only if corresponding mask bit is "1". With mask=0 function willonly read current GPIO configuration.Return valueOn 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 alsoError Codes3.7.2 sub_gpio_readSynopsisint sub_gpio_read( sub_handle hndl, int* get )Read GPIO input status. Function reads logic value "1"-high, "0"-low directly from GPIO pin.Parameters· *get - Pointer to store received GPIO input status. Bits 0..31 of *get correspond to GPIO0..GPIO31 inputstatuses.Return valueOn success function returns 0. Otherwise error code.See alsoError Codes3.7.3 sub_gpio_writeSynopsisint sub_gpio_write( sub_handle hndl, int set, int* get, int mask )Set GPIO output status. For GPIO in output state function will set output driver to drive "1"-high, "0"-low. For© <strong>20</strong>13 xdimax.com rev 2.17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!