EVE 1.0
pn512 NFC chip driver
Collaboration diagram for pn512 NFC chip driver:

Modules

 Component : Stub
 These Components implement the Osal commands.
 

Data Structures

struct  nfc_nxp_t
 NFC driver descriptor: static structure for configuration of driver instance. More...
 
struct  nfc_nxp_state_t
 holds current NFC instance state variables. More...
 

Typedefs

typedef void(* nfc_irq_callback_t) (const struct nfc_nxp_t *Nfc)
 The callback is called on interrupt from pn512. More...
 

Functions

bool NfcNxpLibInit (const struct nfc_nxp_t *Nfc)
 Initialises NFC instance structure, connects it to SPI.
Powers up pn512 if supported. More...
 
bool NfcNxpLibDisable (const struct nfc_nxp_t *Nfc)
 Disables interrupts from pn512 and releases SPI.
Powers down pn512 if supported by product HW. More...
 
void NfcNxpResetReader (const struct nfc_nxp_t *Nfc)
 Performs pn512 HW reset. pn512 switches to configuration mode after reset.
NB! It should be verified that pn512 is in configuration mode with NfcNxpGetMode() function after reset before any subsequent operation. More...
 
bool NfcNxpSetup (const struct nfc_nxp_t *Nfc)
 Sets up pn512 registers according to preconfigured parameters.
NB! pn512 should be in configuration mode. More...
 
uint8_t NfcNxpDiscovery (const struct nfc_nxp_t *Nfc, bool Continue)
 Starts cards detection phase. During execution NFC lib is in the reader mode.
NFC lib loops through all the available (configured) RF technologies. More...
 
void NfcNxpGetUid (const struct nfc_nxp_t *Nfc, uint8_t TagIndex, uint8_t **Uid, uint8_t *UidLen)
 Returns UID of one of detected tags. More...
 
void NfcNxpSetNdefFile (const struct nfc_nxp_t *Nfc, uint8_t *NdefFile, uint16_t NdefFileSize)
 Sets a memory buffer as an NDEF file for subsequent NfcNrfCardEmulation function call. More...
 
void NfcNxpCardEmulation (const struct nfc_nxp_t *Nfc)
 Starts external RF detection phase During execution NFC lib is in the card emulation mode.
. More...
 
void NfcNxpInterruptCb (const struct nfc_nxp_t *Nfc)
 Driver's HW interrupt callback to be exposed to EVE config. More...
 

Detailed Description

This NFC driver supports pn512 NFC chip connected with EVE SPI driver.

Typedef Documentation

typedef void(* nfc_irq_callback_t) (const struct nfc_nxp_t *Nfc)

The callback is called on interrupt from pn512.

Parameters
NfcNFC driver descriptor

Definition at line 127 of file nfc-nxp.h.

Function Documentation

bool NfcNxpLibInit ( const struct nfc_nxp_t Nfc)

Initialises NFC instance structure, connects it to SPI.
Powers up pn512 if supported.

Parameters
NfcNFC driver descriptor
bool NfcNxpLibDisable ( const struct nfc_nxp_t Nfc)

Disables interrupts from pn512 and releases SPI.
Powers down pn512 if supported by product HW.

Parameters
NfcNFC driver descriptor
void NfcNxpResetReader ( const struct nfc_nxp_t Nfc)

Performs pn512 HW reset. pn512 switches to configuration mode after reset.
NB! It should be verified that pn512 is in configuration mode with NfcNxpGetMode() function after reset before any subsequent operation.

Parameters
NfcNFC driver descriptor
bool NfcNxpSetup ( const struct nfc_nxp_t Nfc)

Sets up pn512 registers according to preconfigured parameters.
NB! pn512 should be in configuration mode.

Parameters
NfcNFC driver descriptor
uint8_t NfcNxpDiscovery ( const struct nfc_nxp_t Nfc,
bool  Continue 
)

Starts cards detection phase. During execution NFC lib is in the reader mode.
NFC lib loops through all the available (configured) RF technologies.

Parameters
NfcNFC driver descriptor
Continuetrue: start technologies discovery loop and discover cards in the first available technology. false: discover cards in the next available technology.
Returns
uint8_t Number of cards detected for the first available technology (Continue==false), or the next available technology ((Continue==true). Return value of 0 means there is no next technology.
void NfcNxpGetUid ( const struct nfc_nxp_t Nfc,
uint8_t  TagIndex,
uint8_t **  Uid,
uint8_t *  UidLen 
)

Returns UID of one of detected tags.

Parameters
[in]NfcNFC driver descriptor
[in]TagIndexIndex of the card in the array of detected cards to read.
[out]UidUID of the requested card
[out]UidLenLength of the UID returned
void NfcNxpSetNdefFile ( const struct nfc_nxp_t Nfc,
uint8_t *  NdefFile,
uint16_t  NdefFileSize 
)

Sets a memory buffer as an NDEF file for subsequent NfcNrfCardEmulation function call.

Parameters
NfcNFC driver descriptor
NdefFilePointer to the buffer to set.
NdefFileSizeFull buffer length (not current data length!)
void NfcNxpCardEmulation ( const struct nfc_nxp_t Nfc)

Starts external RF detection phase During execution NFC lib is in the card emulation mode.
.

Parameters
NfcNFC driver descriptor param TypeName NDEF record type name - NULL terminated ASCII string param Data NDEF record data param DataLen NDEF record data length
void NfcNxpInterruptCb ( const struct nfc_nxp_t Nfc)

Driver's HW interrupt callback to be exposed to EVE config.

Parameters
NfcPointer to NFC instance structure