Project

General

Profile

Statistics
| Branch: | Revision:

root / toolbox / rfid.h @ 10936c07

History | View | Annotate | Download (990 Bytes)

1 9b2b6d91 Tom Mullins
#ifndef RFID_H
2
#define RFID_H
3
4
/* Bytes in serial number on rfid tags */
5
#define RFID_SERNO_SIZE 4
6
7 1085ef77 Tom Mullins
/* Number of consective read failures before giving up and returning all 0s */
8
#define RFID_N_FAILURES 5
9 9b2b6d91 Tom Mullins
10
/* Should be called before anything else */
11
void rfid_init();
12
13 532ba0bd Tom Mullins
/* 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 9b2b6d91 Tom Mullins
22 532ba0bd Tom Mullins
/* 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 e1d61b43 Tom Mullins
void rfid_get_serno(uint8_t *serno);
25 9b2b6d91 Tom Mullins
26 532ba0bd Tom Mullins
/* 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 12ea39cc Tom Mullins
char rfid_nonzero();
30
31 9b2b6d91 Tom Mullins
#endif