diff -r 3345048104fc -r fc24e3b47731 me8100_test_dio/rtest.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/me8100_test_dio/rtest.c Wed Jan 16 15:54:58 2002 +0100 @@ -0,0 +1,56 @@ +/* + * Source File : me8100_test_dio.c + * Destination : me8100_test_dio + * Author : GG (Guenter Gebhardt) + * + * + * File History: Version Date Editor Action + *--------------------------------------------------------------------- + * 1.00.00 01.07.12 GG first release + * + *--------------------------------------------------------------------- + * + * Description: + * This program shows the use of the driver and the digital inputs + * and outputs. First the outputs are tested in sink and source mode. + * Then the inputs are tested. + */ +#include +#include +#include +#include +#include + +#include "me8100.h" + +int main(void){ + int err = 0; + static int file_handle = -1; + + unsigned short value_a; + + printf("Read test, PID: %d\n", getpid()); + file_handle = open("/dev/me8100_0", O_RDWR, 0); + + if(file_handle < 0){ + printf("Cannot open path !\n"); + return 1; + } + + for (;;) { + ioctl(file_handle, ME8100_READ_DI_A, &value_a); + printf("Read %04x\n", value_a); + sleep(1); + } + + err = close(file_handle); + if(err){ + printf("Kann Pfad nicht schliessen\n"); + return 1; + } + + return 0; +} +/* + vim:sts=2 sw=2 aw ai sm: +*/