3.3.2.5 Switchable GPIO Direction Getting

int IndoorTouch.GPIOGetDirection(int pin);

Pin is the PIN index, refer to 3.3.2.1 GPIO Pin Reading. GPIO_PIN_IO1 and GPIO_PIN_IO2 can be I/O switched. This command helps you get the currently set direction. GPIO_DIRECTION_IN is set by default.

The return value is as follows:

  • IndoorTouch.GPIO_DIRECTION_IN = 1;
  • IndoorTouch.GPIO_DIRECTION_OUT = 2;
  • IndoorTouch.RC_ERR_CONN = -1; API daemon connection error
  • IndoorTouch.RC_ERR_SYS = -6; system error (the value cannot be read, etc.)
  • IndoorTouch.RC_ERR_DENIED = -7; GPIO does not exist or is unswitchable