Statistics
| Branch: | Revision:

root / toolbox / rfid.h @ 1085ef77

History | View | Annotate | Download (990 Bytes)

1
#ifndef RFID_H
2
#define RFID_H
3

    
4
/* Bytes in serial number on rfid tags */
5
#define RFID_SERNO_SIZE 4
6

    
7
/* Number of consective read failures before giving up and returning all 0s */
8
#define RFID_N_FAILURES 5
9

    
10
/* Should be called before anything else */
11
void rfid_init();
12

    
13
/* Sends the read command to the rfid reader. After, you should call rfid_poll
14
 * until it returns nonzero */
15
void rfid_start_read();
16

    
17
/* Should only be called after rfid_start_read. Keep calling until it returns
18
 * nonzero, which means it is finished reading the serial number, and
19
 * rfid_get_serno can be called */
20
char rfid_poll();
21

    
22
/* Call this only after rfid_poll returns nonzero. This will copy the value it
23
 * read into serno, which should be at least RFID_SERNO_SIZE bytes */
24
void rfid_get_serno(uint8_t *serno);
25

    
26
/* Call this only after rfid_poll returns nonzero. Returns 1 if the internal
27
 * buffer is nonzero, meaning a serial number was successfully read from an
28
 * rfid tag */
29
char rfid_nonzero();
30

    
31
#endif