Project

General

Profile

Statistics
| Branch: | Revision:

root / toolbox / rfid.h @ 36f3b65f

History | View | Annotate | Download (884 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
/* Should be called before anything else */
8
void rfid_init();
9

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

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

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

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

    
28
#endif