34 #if !defined(PN532_SUPPORT_I2C) && !defined(PN532_SUPPORT_SPI) 35 #error Please define PN532_SUPPORT_I2C and/or PN532_SUPPORT_SPI to enable \ 36 the functionality on this device 44 #if defined(PN532_SUPPORT_I2C) || DOXYGEN 47 #if defined(PN532_SUPPORT_SPI) || DOXYGEN 53 #if defined(PN532_SUPPORT_SPI) || DOXYGEN 82 #ifndef PN532_BUFFER_LEN 83 #define PN532_BUFFER_LEN (64) 90 #define PN532_IC_VERSION(fwver) ((fwver >> 24) & 0xff) 91 #define PN532_FW_VERSION(fwver) ((fwver >> 16) & 0xff) 92 #define PN532_FW_REVISION(fwver) ((fwver >> 8) & 0xff) 93 #define PN532_FW_FEATURES(fwver) ((fwver) & 0xff) 100 PN532_SAM_NORMAL = 1,
110 PN532_BR_106_ISO_14443_A = 0,
113 PN532_BR_106_ISO_14443_B,
143 PN532_MIFARE_KEY_A = 0x60,
144 PN532_MIFARE_KEY_B = 0x61
153 #define PN532_ISO14443A_4_LEN_FROM_BUFFER(b) ((b[0] << 8) | b[1]) 182 #if defined(PN532_SUPPORT_I2C) || DOXYGEN 194 #if defined(PN532_SUPPORT_SPI) || DOXYGEN
int pn532_write_reg(pn532_t *dev, unsigned addr, char val)
Write register of the pn532.
Low-level GPIO peripheral driver interface definitions.
int pn532_mifareulight_read(pn532_t *dev, char *odata, nfc_iso14443a_t *card, unsigned page)
Read a block of a Mifare Ultralight card.
void pn532_deselect_passive(pn532_t *dev, unsigned target_id)
Deselect a previously selected passive card.
nfc_iso14443a_type_t
ISO14443A Card types.
int pn532_read_reg(pn532_t *dev, char *out, unsigned addr)
Read register of the pn532.
unsigned int i2c_t
Default i2c_t type definition.
Device descriptor for the PN532.
gpio_t nss
Chip Select pin (only SPI)
Low-level SPI peripheral driver interface definition.
int pn532_iso14443a_4_read(pn532_t *dev, char *odata, nfc_iso14443a_t *card, unsigned offset, char len)
Read data from the NDEF file of a ISO14443-A Type 4 tag.
int pn532_init(pn532_t *dev, const pn532_params_t *params, pn532_mode_t mode)
Initialize the module and peripherals.
int pn532_mifareclassic_authenticate(pn532_t *dev, nfc_iso14443a_t *card, pn532_mifare_key_t keyid, char *key, unsigned block)
Authenticate a Mifare classic card.
ISO14443A tag description.
const pn532_params_t * conf
Configuration struct.
nfc_iso14443a_type_t type
Type of ISO14443A card.
char id_len
Length of the ID field.
pn532_mifare_key_t
Mifare keys.
pn532_mode_t
Working mode of the PN532.
static int pn532_init_i2c(pn532_t *dev, const pn532_params_t *params)
Initialization of PN532 using i2c.
RIOT synchronization API.
mutex_t trap
Mutex to wait for chip response.
void pn532_reset(const pn532_t *dev)
Hard reset the chipset.
int pn532_get_passive_iso14443a(pn532_t *dev, nfc_iso14443a_t *out, unsigned max_retries)
Get one ISO14443-A passive target.
int pn532_mifareclassic_write(pn532_t *dev, char *idata, nfc_iso14443a_t *card, unsigned block)
Write a block of a Mifare classic card.
pn532_mode_t mode
Working mode (i2c, spi)
void pn532_release_passive(pn532_t *dev, unsigned target_id)
Release an active passive card.
char auth
Card has been authenticated.
int pn532_iso14443a_4_activate(pn532_t *dev, nfc_iso14443a_t *card)
Activate the NDEF file of a ISO14443-A Type 4 tag.
Data structure with the configuration parameters.
int pn532_mifareclassic_read(pn532_t *dev, char *odata, nfc_iso14443a_t *card, unsigned block)
Read a block of a Mifare classic card.
pn532_sam_conf_mode_t
Possible SAM configurations.
static int pn532_init_spi(pn532_t *dev, const pn532_params_t *params)
Initialization of PN532 using spi.
pn532_target_t
PN532 supported targets.
int pn532_sam_configuration(pn532_t *dev, pn532_sam_conf_mode_t mode, unsigned timeout)
Set new settings for the Security Access Module.
unsigned int spi_t
Default type for SPI devices.
int pn532_fw_version(pn532_t *dev, uint32_t *fw_ver)
Get the firmware version of the pn532.
Low-level I2C peripheral driver interface definition.