NFC library using PN532 to read/write NDEF Messages to NFC tags

Dependents:   Seeed_NFC_Shield_write Nucleo_test_nfc

Fork of PN532 by Yihui Xiong

mac_link.cpp

Committer:
screamer
Date:
2014-03-25
Revision:
6:26c1b3b6c192
Parent:
3:4189a10038e6

File content as of revision 6:26c1b3b6c192:


#include "mac_link.h"
#include "PN532_debug.h"

int8_t MACLink::activateAsTarget(uint16_t timeout)
{
	pn532.begin();
	pn532.SAMConfig();
    return pn532.tgInitAsTarget(timeout);
}

bool MACLink::write(const uint8_t *header, uint8_t hlen, const uint8_t *body, uint8_t blen)
{
    return pn532.tgSetData(header, hlen, body, blen);
}

int16_t MACLink::read(uint8_t *buf, uint8_t len)
{
    return pn532.tgGetData(buf, len);
}