PN532 Driver library This library provides an abstract API to drive the pn532 nfc chip, with I2C/HSU/SPI interface. Its based on the Seeed Studio's Arduino version.
PN532/mac_link.cpp@2:ae258f195bbd, 2020-06-26 (annotated)
- Committer:
- maximemau
- Date:
- Fri Jun 26 09:16:19 2020 +0000
- Revision:
- 2:ae258f195bbd
- Parent:
- 0:db8030e71f55
lib_pn532
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dotnfc | 0:db8030e71f55 | 1 | |
dotnfc | 0:db8030e71f55 | 2 | #include "mac_link.h" |
dotnfc | 0:db8030e71f55 | 3 | #include "PN532_debug.h" |
dotnfc | 0:db8030e71f55 | 4 | |
dotnfc | 0:db8030e71f55 | 5 | int8_t MACLink::activateAsTarget(uint16_t timeout) |
dotnfc | 0:db8030e71f55 | 6 | { |
dotnfc | 0:db8030e71f55 | 7 | pn532.begin(); |
dotnfc | 0:db8030e71f55 | 8 | pn532.SAMConfig(); |
dotnfc | 0:db8030e71f55 | 9 | return pn532.tgInitAsTarget(timeout); |
dotnfc | 0:db8030e71f55 | 10 | } |
dotnfc | 0:db8030e71f55 | 11 | |
dotnfc | 0:db8030e71f55 | 12 | bool MACLink::write(const uint8_t *header, uint8_t hlen, const uint8_t *body, uint8_t blen) |
dotnfc | 0:db8030e71f55 | 13 | { |
dotnfc | 0:db8030e71f55 | 14 | return pn532.tgSetData(header, hlen, body, blen); |
dotnfc | 0:db8030e71f55 | 15 | } |
dotnfc | 0:db8030e71f55 | 16 | |
dotnfc | 0:db8030e71f55 | 17 | int16_t MACLink::read(uint8_t *buf, uint8_t len) |
dotnfc | 0:db8030e71f55 | 18 | { |
dotnfc | 0:db8030e71f55 | 19 | return pn532.tgGetData(buf, len); |
dotnfc | 0:db8030e71f55 | 20 | } |