nfc3 2.0.0.0
NFC 3 Click Driver

API for configuring and manipulating NFC 3 Click driver. More...

Topics

 NFC 3 Commands List
 List of registers of NFC 3 Click driver.
 
 NFC 3 Registers List
 List of registers of NFC 3 Click driver.
 
 NFC 3 Registers Settings
 Settings for registers of NFC 3 Click driver.
 
 NFC 3 MikroBUS Map
 MikroBUS pin mapping of NFC 3 Click driver.
 

Functions

void nfc3_cfg_setup (nfc3_cfg_t *cfg)
 NFC 3 configuration object setup function.
 
err_t nfc3_init (nfc3_t *ctx, nfc3_cfg_t *cfg)
 NFC 3 initialization function.
 
err_t nfc3_generic_write (nfc3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 NFC 3 data writing function.
 
err_t nfc3_generic_transfer (nfc3_t *ctx, uint8_t *data_in, uint8_t tx_len, uint8_t *data_out, uint8_t rx_len)
 NFC 3 data reading function.
 
err_t nfc3_write_eeprom (nfc3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 NFC 3 writing EEPROM function.
 
err_t nfc3_read_eeprom (nfc3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 NFC 3 reading EEPROM function.
 
err_t nfc3_write_reg_with_and_mask (nfc3_t *ctx, uint8_t reg, uint32_t data_in)
 NFC 3 writing register function with AND mask.
 
err_t nfc3_write_reg_with_or_mask (nfc3_t *ctx, uint8_t reg, uint32_t data_in)
 NFC 3 writing register function with OR mask.
 
err_t nfc3_write_reg (nfc3_t *ctx, uint8_t reg, uint32_t data_in)
 NFC 3 writing register function.
 
err_t nfc3_read_reg (nfc3_t *ctx, uint8_t reg, uint32_t *data_out)
 NFC 3 reading register function.
 
err_t nfc3_send_data (nfc3_t *ctx, uint8_t *data_in, uint16_t len, uint8_t valid_bits)
 NFC 3 send data function.
 
err_t nfc3_read_data (nfc3_t *ctx, uint8_t *data_out, uint16_t len)
 NFC 3 read data function.
 
err_t nfc3_load_rf_config (nfc3_t *ctx, uint8_t tx_conf, uint8_t rx_conf)
 NFC 3 load RF config function.
 
err_t nfc3_read_firmware_version (nfc3_t *ctx, uint16_t *data_out)
 NFC 3 reading firmware version function.
 
err_t nfc3_read_product_version (nfc3_t *ctx, uint16_t *data_out)
 NFC 3 reading product version function.
 
err_t nfc3_read_eeprom_version (nfc3_t *ctx, uint16_t *data_out)
 NFC 3 reading EEPROM version function.
 
void nfc3_reset (nfc3_t *ctx)
 NFC 3 reset function.
 
void nfc3_set_rst (nfc3_t *ctx, uint8_t state)
 NFC 3 set RST pin function.
 
uint8_t nfc3_get_irq (nfc3_t *ctx)
 NFC 3 get IRQ pin function.
 
uint8_t nfc3_get_bsy (nfc3_t *ctx)
 NFC 3 get BSY pin function.
 
uint8_t nfc3_get_aux (nfc3_t *ctx)
 NFC 3 get AUX pin function.
 
nfc3_transceive_stat_t nfc3_get_transceive_state (nfc3_t *ctx)
 NFC 3 get TRANSCEIVE_STATE from RF_STATUS register function.
 
uint16_t nfc3_rx_num_bytes_received (nfc3_t *ctx)
 NFC 3 get number of received bytes function.
 
uint8_t nfc3_activate_type_a (nfc3_t *ctx, uint8_t *data_out, uint8_t kind)
 NFC 3 activate ISO/IEC 14443 type A and read card UID function.
 
err_t nfc3_mifare_block_read (nfc3_t *ctx, uint8_t *data_out, uint8_t blockno)
 NFC 3 MIFARE block read function.
 
uint8_t nfc3_mifare_block_write_16 (nfc3_t *ctx, uint8_t *data_in, uint8_t blockno)
 NFC 3 MIFARE block write function.
 
err_t nfc3_mifare_halt (nfc3_t *ctx)
 NFC 3 MIFARE Halt function.
 
uint8_t nfc3_read_card_uid (nfc3_t *ctx, uint8_t *data_out)
 NFC 3 read card UID function.
 
err_t nfc3_clear_rx_tx_crc (nfc3_t *ctx)
 NFC 3 clear RX and TX CRC function.
 
err_t nfc3_enable_rx_tx_crc (nfc3_t *ctx)
 NFC 3 enable RX and TX CRC calculation function.
 

Detailed Description

API for configuring and manipulating NFC 3 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ nfc3_activate_type_a()

uint8_t nfc3_activate_type_a ( nfc3_t * ctx,
uint8_t * data_out,
uint8_t kind )

NFC 3 activate ISO/IEC 14443 type A and read card UID function.

This function activates ISO/IEC 14443 type A and reads card UID.

Parameters
[in]ctx: Click context object.
[out]data_out: Card serial must be 10 byte array: data_out[0-1] is ATQA data_out[2] is sak data_out[3-6] is 4 byte UID data_out[7-9] is remaining 3 bytes of UID for 7 Byte UID tags
[in]kind: 0 we send REQA, 1 we send WUPA See nfc3_t object definition for detailed explanation.
Returns
  • 0 - no tag was recognized,
  • 4 - single Size UID (4 byte),
  • 7 - double Size UID (7 byte).
Note
None.

◆ nfc3_cfg_setup()

void nfc3_cfg_setup ( nfc3_cfg_t * cfg)

NFC 3 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See nfc3_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ nfc3_clear_rx_tx_crc()

err_t nfc3_clear_rx_tx_crc ( nfc3_t * ctx)

NFC 3 clear RX and TX CRC function.

This function clears RX and TX CRC.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See err_t definition for detailed explanation.
Note
None.

◆ nfc3_enable_rx_tx_crc()

err_t nfc3_enable_rx_tx_crc ( nfc3_t * ctx)

NFC 3 enable RX and TX CRC calculation function.

This function enables RX and TX CRC calculation.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See err_t definition for detailed explanation.
Note
None.

◆ nfc3_generic_transfer()

err_t nfc3_generic_transfer ( nfc3_t * ctx,
uint8_t * data_in,
uint8_t tx_len,
uint8_t * data_out,
uint8_t rx_len )

NFC 3 data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]tx_len: Number of bytes to be written.
[out]data_out: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_generic_write()

err_t nfc3_generic_write ( nfc3_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

NFC 3 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_get_aux()

uint8_t nfc3_get_aux ( nfc3_t * ctx)

NFC 3 get AUX pin function.

This function gets AUX pin state.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ nfc3_get_bsy()

uint8_t nfc3_get_bsy ( nfc3_t * ctx)

NFC 3 get BSY pin function.

This function gets BSY pin state.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ nfc3_get_irq()

uint8_t nfc3_get_irq ( nfc3_t * ctx)

NFC 3 get IRQ pin function.

This function gets IRQ pin state.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ nfc3_get_transceive_state()

nfc3_transceive_stat_t nfc3_get_transceive_state ( nfc3_t * ctx)

NFC 3 get TRANSCEIVE_STATE from RF_STATUS register function.

This function reads TRANSCEIVE_STATE from RF_STATUS register.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[out]data_out: Output read data.
Returns
  • 0 - idle,
  • 1 - wait transmit,
  • 2 - transmitting,
  • 3 - wait receive,
  • 4 - wait for data,
  • 5 - receiving,
  • 6 - loopback,
  • 7 - reserved. See nfc3_transceive_stat_t definition for detailed explanation.
Note
None.

◆ nfc3_init()

err_t nfc3_init ( nfc3_t * ctx,
nfc3_cfg_t * cfg )

NFC 3 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See nfc3_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_load_rf_config()

err_t nfc3_load_rf_config ( nfc3_t * ctx,
uint8_t tx_conf,
uint8_t rx_conf )

NFC 3 load RF config function.

This function loads desired RF config.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[out]tx_conf: Transmitter Configuration.
[out]rx_conf: Receiver Configuration.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_mifare_block_read()

err_t nfc3_mifare_block_read ( nfc3_t * ctx,
uint8_t * data_out,
uint8_t blockno )

NFC 3 MIFARE block read function.

This function reads a desired block of memory from MIFARE card.

Parameters
[in]ctx: Click context object.
[out]data_out: The block content (16 bytes).
[in]blockno: Number of the block. See nfc3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See err_t definition for detailed explanation.
Note
None.

◆ nfc3_mifare_block_write_16()

uint8_t nfc3_mifare_block_write_16 ( nfc3_t * ctx,
uint8_t * data_in,
uint8_t blockno )

NFC 3 MIFARE block write function.

This function writes 16 bytes data to a desired block of memory of MIFARE card.

Parameters
[in]ctx: Click context object.
[in]data_out: Data to be written.
[in]blockno: Number of the block. See nfc3_t object definition for detailed explanation.
Returns
ACK/NAK value
Note
None.

◆ nfc3_mifare_halt()

err_t nfc3_mifare_halt ( nfc3_t * ctx)

NFC 3 MIFARE Halt function.

This function halts MIFARE card.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See err_t definition for detailed explanation.
Note
None.

◆ nfc3_read_card_uid()

uint8_t nfc3_read_card_uid ( nfc3_t * ctx,
uint8_t * data_out )

NFC 3 read card UID function.

This function reads card UID.

Parameters
[in]ctx: Click context object.
[out]data_out: Card UID must be 7 byte array: data_out[0-3] is 4 byte UID data_out[4-6] is remaining 3 bytes of UID for 7 Byte UID tags See nfc3_t object definition for detailed explanation.
Returns
  • 0 - no tag was recognized,
  • 4 - single Size UID (4 byte),
  • 7 - double Size UID (7 byte).
Note
None.

◆ nfc3_read_data()

err_t nfc3_read_data ( nfc3_t * ctx,
uint8_t * data_out,
uint16_t len )

NFC 3 read data function.

This function reads data from the RF reception buffer, after a successful reception.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[out]data_out: Output read data.
[out]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_read_eeprom()

err_t nfc3_read_eeprom ( nfc3_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

NFC 3 reading EEPROM function.

This function reads a desired number of data bytes from EEPROM starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_read_eeprom_version()

err_t nfc3_read_eeprom_version ( nfc3_t * ctx,
uint16_t * data_out )

NFC 3 reading EEPROM version function.

This function reads the EEPROM version from the desired EEPROM register.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_read_firmware_version()

err_t nfc3_read_firmware_version ( nfc3_t * ctx,
uint16_t * data_out )

NFC 3 reading firmware version function.

This function reads the firmware version from the desired EEPROM register.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_read_product_version()

err_t nfc3_read_product_version ( nfc3_t * ctx,
uint16_t * data_out )

NFC 3 reading product version function.

This function reads the product version from the desired EEPROM register.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_read_reg()

err_t nfc3_read_reg ( nfc3_t * ctx,
uint8_t reg,
uint32_t * data_out )

NFC 3 reading register function.

This function reads 32-bit data from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_reset()

void nfc3_reset ( nfc3_t * ctx)

NFC 3 reset function.

This function performs the device reset.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ nfc3_rx_num_bytes_received()

uint16_t nfc3_rx_num_bytes_received ( nfc3_t * ctx)

NFC 3 get number of received bytes function.

This function reads the number of bytes received.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
Returns
Number of data bytes received.
Note
None.

◆ nfc3_send_data()

err_t nfc3_send_data ( nfc3_t * ctx,
uint8_t * data_in,
uint16_t len,
uint8_t valid_bits )

NFC 3 send data function.

This function writes data to the RF transmission buffer and starts the RF transmission.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
[in]valid_bits: Indicates the exact number of bits to be transmitted for the last byte (for non-byte aligned frames).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_set_rst()

void nfc3_set_rst ( nfc3_t * ctx,
uint8_t state )

NFC 3 set RST pin function.

This function sets RST pin to the desired state.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]state: Pin state.
Returns
None.
Note
None.

◆ nfc3_write_eeprom()

err_t nfc3_write_eeprom ( nfc3_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

NFC 3 writing EEPROM function.

This function writes a desired number of data bytes to EEPROM starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_write_reg()

err_t nfc3_write_reg ( nfc3_t * ctx,
uint8_t reg,
uint32_t data_in )

NFC 3 writing register function.

This function writes 32-bit data to the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_write_reg_with_and_mask()

err_t nfc3_write_reg_with_and_mask ( nfc3_t * ctx,
uint8_t reg,
uint32_t data_in )

NFC 3 writing register function with AND mask.

This function writes 32-bit data to the selected register with AND mask by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc3_write_reg_with_or_mask()

err_t nfc3_write_reg_with_or_mask ( nfc3_t * ctx,
uint8_t reg,
uint32_t data_in )

NFC 3 writing register function with OR mask.

This function writes 32-bit data to the selected register with OR mask by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.