C++ API: GPIO Example

This mini-project demonstrates GPIO line manipulation for line A of socket S1 of the LTPP3 board.

The source code:

#include "ltps/capi/gpio.h"
#include "ltps/capi/cpin.h" // some PIN constants, definitions

int main( int argc, char *argv[]) {
  Gpio gpio;
  // get PIN direction. Set to OUT if it's not already
  if ( gpio.getDirection( "S1A") == PIN_DIR_I) gpio.setDirection( "S1A", PIN_DIR_O);
  // get PIN value. Set to 1 if it's 0 now
  if ( gpio.getValue( 	  "S1A") == 0        ) gpio.setValue( "S1A", 1);