/*
 *  rsw.c
 *
 *  v 0.0 2021.5.31
 *    read the rotary switch ID for LP-2841/9x81(i.MX8).
 */

#include "msw.h"
#include "armplat.h"
#include "am335x.h"
 
#define VERSION "1.2(20220614)"

int main(int argc,char **argv)
{
	int c;
	int result = 0;
	unsigned int value = 0;
        unsigned int pac_id ;

        while((c=getopt(argc, argv, "v")) != -1)
	{
		switch(c)
		{
			case 'v':
				printf("rsw version : %s\n", VERSION);
				return NOERROR;
                        default:
				return NOERROR;
		}
	}
	result=rotary_switch_read(&value);
	if(result)
	{
		printf("rsw(%d) : rotary switch read error\n",result);
		return FAILURE;
	}
	else
	{
		printf("%d\n", value);
	}

	return NOERROR;
}

