/*
  pout.c - Change PIO output state
*/

#include "board.h"

//static const Pin pins = {1 << 30, AT91C_BASE_PIOA, AT91C_ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT};
static const Pin pins = {1 << 15, AT91C_BASE_PIOC, AT91C_ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT};

int main(int argc, char **argv)
{
  if (argc != 2) {
    printf("Usage: %s value\n", argv[0]);
  }
  else {
    /* Configure peripherals used by the application */
    PIO_Configure(&pins, 1); /* Set LED pin as output and clear it */

    if (atoi(argv[1]) != 0) {
      PIO_Set(&pins);
      printf("pout - Set pin\n");
    }
    else {
      PIO_Clear(&pins);
      printf("pout - Clear pin\n");
    }
  }

  return 0;
}

