Revision 1085ef77 toolbox/rfid.h

View differences:

toolbox/rfid.h
1 1
#ifndef RFID_H
2 2
#define RFID_H
3 3

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

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

  
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
7
/* Number of consective read failures before giving up and returning all 0s */
8
#define RFID_N_FAILURES 5
14 9

  
15 10
/* Should be called before anything else */
16 11
void rfid_init();
......
24 19
 * rfid_get_serno can be called */
25 20
char rfid_poll();
26 21

  
27
/* Attempts to read the serial number multiple times, and only accepts it if it
28
 * is the same every time. Don't use it */
29
void rfid_read_safe();
30

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

  
35
/* Call this only after rfid_poll returns nonzero. Returns 1 if serno matches
36
 * the internal buffer of the most recently read serial number */
37
char rfid_check_serno(uint8_t *serno);
38

  
39 26
/* Call this only after rfid_poll returns nonzero. Returns 1 if the internal
40 27
 * buffer is nonzero, meaning a serial number was successfully read from an
41 28
 * rfid tag */

Also available in: Unified diff