/*
  v 1.0 By Winson 2019.1.9
  This demo for LX-2031 PAC only.
  Control three led once a time.
*/


#include <stdio.h>
#include <getopt.h>
#include "msw.h"

void usage();
char* const short_options = "hvs";
struct option long_options[] = {
        {"help", 0, NULL, 'h'},
        {"version", 0, NULL, 'v'},
        {"support", 0, NULL, 's'},
        {0, 0, 0, 0},
};


int main(int argc, char *argv[])
{
	unsigned int option;
	int c;

	while((c = getopt_long (argc, argv, short_options, long_options, NULL)) != -1)
        {
                switch (c)
                {
                        case 'h':
                                usage();
                                return 0;
                        case 'v':
                                printf("SDK version = %s \n",GetSDKversion());
                                return 0;
                        case 's':
                                printf("Support LX-2031\n");
                                return 0;
                        default:
                                printf("Try `led -h' for more information.\n");
                                return 0;
                        break;
                }
        }

	printf("Select one led status.\n");
	printf("1.L1.\n");
	printf("2.L2.\n");
	printf("3.L3.\n");
	printf("4.L1 & L2.\n");
	printf("5.L1 & L3.\n");
	printf("6.L2  & L3.\n");
	printf("7.All led on.\n");
	printf("8.All led off.\n");
	printf("(Default value is all led on.)\n");

	scanf("%d",&option);
	SetLED(option);
	
	return 0;
}

void usage()
{
	printf("Control 3 led.\n");
	printf("-h,     display this help and exit\n");
	printf("-v,     output SDK version and exit\n");
	printf("-s,     support LinPAC platform\n");
}
