/**
* mt_rfid.h
- * Start your own mt-rfid pthread.
*/
#ifndef MT_RFID_H
#define MT_RFID_H
-// setup structure
-// it might tempt you to run multiple instances with one reader, don't.
-// running each instance with its own reader (port name) should fine.
-typedef struct {
- unsigned reader_type; // 0: auto, 1: 1Mbps, 2,3: slooow
- char *port_name; // "COM9", "/dev/ttyUSB0", "" for auto selection
- unsigned port_interface; // 0: auto, 1: serial, 2: ftdi
- unsigned beep; // beep when a card is beeing read
- unsigned run; // polling condition
-} mt_rfid_t;
-
-// macros for convenience
+// reader open parameters, see uFR manual
#define READER_TYPE 1 // uFR type (1Mbps)
-#define PORT_INTERFACE 1 // serial
+#define PORT_INTERFACE 1 // serial, auto -> ftdi -> FAIL (some shity drivers missing)
#define PORT_NAME "/dev/ttyUSB0"
-#define ASYNC_SUFFIX 0
-#define ASYNC_BAUD_RATE 1000000
-#define BASYNC_BAUD_RATE B1000000
+// async uid sending parameters
+#define ASYNC_SUFFIX 0 // keep it zero: + separates uids, + terminates strings
+#define ASYNC_BAUD_RATE 1000000 // 1Mbps, otherwise UFR_COMMUNICATION_BREAK
+
+#define UFR_BEEP // define this to annoy people
// really simple JSON helpers
-#define JSON_NUM(NAME) printf("\"" #NAME "\": %d", NAME)
-#define JSON_STR(NAME) printf("\"" #NAME "\": \"%s\"", NAME)
#define JSON_START() printf("{\n")
+#define JSON_NUM(NAME) printf("\"" #NAME "\": %d", NAME)
#define JSON_NEXT() printf(",\n")
+#define JSON_STR(NAME) printf("\"" #NAME "\": \"%s\"", NAME)
#define JSON_END() printf("\n}\n")
#endif