/*
  v 1.0.0  By Winson 2018.10.2

  This demo for LX-2031 PAC only.
  In this demo, GetRotaryID() parameter "slot" is not necessary, but in order to be compatible with other platforms, we reserved this parameter.
*/

#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[])
{
	int c;
	unsigned char rsw; 

	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 `rotary_sw -h' for more information.\n");
				return 0;
			break;
		}
	}

	rsw = GetRotaryID(9);	//parameter slot did no use in LX-2031

	printf("Read Rotary switch ID : %d \n", rsw);

	return 0;
}

void usage()
{
        printf("Read Rotary switch ID.\n");
        printf("-h,     display this help and exit\n");
        printf("-v,     output version information and exit\n");
        printf("-s,     support LinPAC platform\n");
}

