]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/commitdiff
init
authorJiří Matěják <jiri.matejak@fel.cvut.cz>
Tue, 17 Apr 2018 10:49:49 +0000 (12:49 +0200)
committerJiří Matěják <jiri.matejak@fel.cvut.cz>
Tue, 17 Apr 2018 10:49:49 +0000 (12:49 +0200)
Makefile [new file with mode: 0644]
main.c [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..9371b71
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,2 @@
+all: main.c
+       gcc -o mt-rfid main.c -luFCoder-armhf
diff --git a/main.c b/main.c
new file mode 100644 (file)
index 0000000..bdd5316
--- /dev/null
+++ b/main.c
@@ -0,0 +1,55 @@
+/*
+ ============================================================================
+ Name        : main.c
+ Author      : Digital Logic
+ Version     : 1.0
+ Copyright   :
+ Description : Very simple test of uFR library
+ ============================================================================
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "/usr/include/uFCoder.h"
+
+/**
+ * Calls ReaderOpenEx() and print status
+ */
+UFR_STATUS reader_open_ex(uint32_t reader_type, c_string port_name, uint32_t port_interface)
+{
+       UFR_STATUS status;
+
+       status = ReaderOpenEx(reader_type, port_name, port_interface, 0);
+       printf("ReaderOpenEx(%d, '%s', %d, 0):> %s\n", reader_type, port_name,
+                       port_interface, UFR_Status2String(status));
+
+       return status;
+}
+
+int main(void)
+{
+       UFR_STATUS status;
+
+       puts("Test ReaderOpen version 1.0\n");
+       //--------------------------------------------------------------
+       printf("* uFCoder library version: %s\n\n", GetDllVersionStr());
+       //--------------------------------------------------------------
+
+       puts("Test opening Digital Logic shield uFR RS232 on RPi:");
+       status = ReaderOpen();
+       printf("ReaderOpen():> %s\n", UFR_Status2String(status));
+
+       status = ReaderUISignal(3, 3);
+       printf("ReaderUISignal(3, 3):> %s\n", UFR_Status2String(status));
+
+       puts(GetReaderDescription());
+
+       status = ReaderClose();
+       printf("ReaderClose():> %s\n", UFR_Status2String(status));
+
+       puts(".");
+
+       return EXIT_SUCCESS;
+}
+