Statistics
| Branch: | Revision:

root / rfid.h @ 9b2b6d91

History | View | Annotate | Download (918 Bytes)

1
#ifndef RFID_H
2
#define RFID_H
3

    
4
/* First byte back from rfid reader */
5
#define RFID_OK 1
6

    
7
/* Bytes in serial number on rfid tags */
8
#define RFID_SERNO_SIZE 4
9

    
10
/* In rfid_read_safe, it must read the same value RFID_MIN_OK times. If it
11
 * encounters RFID_MAX_ERRS read errors first, it will output all 0's. */
12
#define RFID_MAX_ERRS 10
13
#define RFID_MIN_OK 5
14

    
15
/* Should be called before anything else */
16
void rfid_init();
17

    
18
/* Reads the serial number of an rfid tag into an internal buffer, accessbile
19
 * with rfid_get_serno */
20
void rfid_read();
21

    
22
/* Attempts to read the serial number multiple times, and only accepts it if it
23
 * is the same every time. Use rfid_read instead until this one is proven
24
 * necessary */
25
void rfid_read_safe();
26

    
27
/* Call this only after calling rfid_read. This will copy the value it read
28
 * into serno, which should be at least RFID_SERNO_SIZE bytes */
29
void rfid_get_serno(char *serno);
30

    
31
#endif