PN532 customized
Fork of PN532 by
mac_link.cpp@10:2fcf2448d199, 2016-02-11 (annotated)
- Committer:
- stanvn
- Date:
- Thu Feb 11 11:56:00 2016 +0000
- Revision:
- 10:2fcf2448d199
- Parent:
- 3:4189a10038e6
Working code for reading type-a and type-b cards
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 3:4189a10038e6 | 1 | |
yihui | 3:4189a10038e6 | 2 | #include "mac_link.h" |
yihui | 3:4189a10038e6 | 3 | #include "PN532_debug.h" |
yihui | 3:4189a10038e6 | 4 | |
yihui | 3:4189a10038e6 | 5 | int8_t MACLink::activateAsTarget(uint16_t timeout) |
yihui | 3:4189a10038e6 | 6 | { |
yihui | 3:4189a10038e6 | 7 | pn532.begin(); |
yihui | 3:4189a10038e6 | 8 | pn532.SAMConfig(); |
yihui | 3:4189a10038e6 | 9 | return pn532.tgInitAsTarget(timeout); |
yihui | 3:4189a10038e6 | 10 | } |
yihui | 3:4189a10038e6 | 11 | |
yihui | 3:4189a10038e6 | 12 | bool MACLink::write(const uint8_t *header, uint8_t hlen, const uint8_t *body, uint8_t blen) |
yihui | 3:4189a10038e6 | 13 | { |
yihui | 3:4189a10038e6 | 14 | return pn532.tgSetData(header, hlen, body, blen); |
yihui | 3:4189a10038e6 | 15 | } |
yihui | 3:4189a10038e6 | 16 | |
yihui | 3:4189a10038e6 | 17 | int16_t MACLink::read(uint8_t *buf, uint8_t len) |
yihui | 3:4189a10038e6 | 18 | { |
yihui | 3:4189a10038e6 | 19 | return pn532.tgGetData(buf, len); |
yihui | 3:4189a10038e6 | 20 | } |