nfc3 2.0.0.0
nfc3.h File Reference

This file contains API for NFC 3 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  nfc3_t
 NFC 3 Click context object. More...
 
struct  nfc3_cfg_t
 NFC 3 Click configuration object. More...
 

Macros

#define NFC3_CMD_WRITE_REGISTER   0x00
 NFC 3 commands description.
 
#define NFC3_CMD_WRITE_REGISTER_OR_MASK   0x01
 
#define NFC3_CMD_WRITE_REGISTER_AND_MASK   0x02
 
#define NFC3_CMD_WRITE_REGISTER_MULTIPLE   0x03
 
#define NFC3_CMD_READ_REGISTER   0x04
 
#define NFC3_CMD_READ_REGISTER_MULTIPLE   0x05
 
#define NFC3_CMD_WRITE_EEPROM   0x06
 
#define NFC3_CMD_READ_EEPROM   0x07
 
#define NFC3_CMD_WRITE_TX_DATA   0x08
 
#define NFC3_CMD_SEND_DATA   0x09
 
#define NFC3_CMD_READ_DATA   0x0A
 
#define NFC3_CMD_SWITCH_MODE   0x0B
 
#define NFC3_CMD_MIFARE_AUTHENTICATE   0x0C
 
#define NFC3_CMD_EPC_INVENTORY   0x0D
 
#define NFC3_CMD_EPC_RESUME_INVENTORY   0x0E
 
#define NFC3_CMD_EPC_RETRIEVE_INVENTORY_RESULT_SIZE   0x0F
 
#define NFC3_CMD_EPC_RETRIEVE_INVENTORY_RESULT   0x10
 
#define NFC3_CMD_LOAD_RF_CONFIG   0x11
 
#define NFC3_CMD_UPDATE_RF_CONFIG   0x12
 
#define NFC3_CMD_RETRIEVE_RF_CONFIG_SIZE   0x13
 
#define NFC3_CMD_RETRIEVE_RF_CONFIG   0x14
 
#define NFC3_CMD_RF_ON   0x16
 
#define NFC3_CMD_RF_OFF   0x17
 
#define NFC3_CMD_CONFIGURE_TESTBUS_DIGITAL   0x18
 
#define NFC3_CMD_CONFIGURE_TESTBUS_ANALOG   0x19
 
#define NFC3_REG_SYSTEM_CONFIG   0x00
 NFC 3 register description.
 
#define NFC3_REG_IRQ_ENABLE   0x01
 
#define NFC3_REG_IRQ_STATUS   0x02
 
#define NFC3_REG_IRQ_CLEAR   0x03
 
#define NFC3_REG_TRANSCEIVER_CONFIG   0x04
 
#define NFC3_REG_PADCONFIG   0x05
 
#define NFC3_REG_PADOUT   0x07
 
#define NFC3_REG_TIMER0_STATUS   0x08
 
#define NFC3_REG_TIMER1_STATUS   0x09
 
#define NFC3_REG_TIMER2_STATUS   0x0A
 
#define NFC3_REG_TIMER0_RELOAD   0x0B
 
#define NFC3_REG_TIMER1_RELOAD   0x0C
 
#define NFC3_REG_TIMER2_RELOAD   0x0D
 
#define NFC3_REG_TIMER0_CONFIG   0x0E
 
#define NFC3_REG_TIMER1_CONFIG   0x0F
 
#define NFC3_REG_TIMER2_CONFIG   0x10
 
#define NFC3_REG_RX_WAIT_CONFIG   0x11
 
#define NFC3_REG_CRC_RX_CONFIG   0x12
 
#define NFC3_REG_RX_STATUS   0x13
 
#define NFC3_REG_TX_UNDERSHOOT_CONFIG   0x14
 
#define NFC3_REG_TX_OVERSHOOT_CONFIG   0x15
 
#define NFC3_REG_TX_DATA_MOD   0x16
 
#define NFC3_REG_TX_WAIT_CONFIG   0x17
 
#define NFC3_REG_TX_CONFIG   0x18
 
#define NFC3_REG_CRC_TX_CONFIG   0x19
 
#define NFC3_REG_SIGPRO_CONFIG   0x1A
 
#define NFC3_REG_SIGPRO_CM_CONFIG   0x1B
 
#define NFC3_REG_SIGPRO_RM_CONFIG   0x1C
 
#define NFC3_REG_RF_STATUS   0x1D
 
#define NFC3_REG_AGC_CONFIG   0x1E
 
#define NFC3_REG_AGC_VALUE   0x1F
 
#define NFC3_REG_RF_CONTROL_TX   0x20
 
#define NFC3_REG_RF_CONTROL_TX_CLK   0x21
 
#define NFC3_REG_RF_CONTROL_RX   0x22
 
#define NFC3_REG_LD_CONTROL   0x23
 
#define NFC3_REG_SYSTEM_STATUS   0x24
 
#define NFC3_REG_TEMP_CONTROL   0x25
 
#define NFC3_REG_CECK_CARD_RESULT   0x26
 
#define NFC3_REG_DPC_CONFIG   0x27
 
#define NFC3_REG_EMD_CONTROL   0x28
 
#define NFC3_REG_ANT_CONTROL   0x29
 
#define NFC3_EEPROM_DIE_ID   0x00
 NFC 3 EEPROM register description.
 
#define NFC3_EEPROM_PRODUCT_VERSION   0x10
 
#define NFC3_EEPROM_FIRMWARE_VERSION   0x12
 
#define NFC3_EEPROM_EEPROM_VERSION   0x14
 
#define NFC3_EEPROM_IDLE_IRQ_AFTER_BOOT   0x16
 
#define NFC3_EEPROM_TESTBUS_ENABLE   0x17
 
#define NFC3_EEPROM_XTAL_BOOT_TIME   0x18
 
#define NFC3_EEPROM_IRQ_PIN_CONFIG   0x1A
 
#define NFC3_EEPROM_MISO_PULLUP_ENABLE   0x1B
 
#define NFC3_EEPROM_PLL_DEFAULT_SETTING   0x1C
 
#define NFC3_EEPROM_PLL_DEFAULT_SETTING_ALM   0x24
 
#define NFC3_EEPROM_PLL_LOCK_SETTING   0x2C
 
#define NFC3_EEPROM_CLOCK_CONFIG   0x30
 
#define NFC3_EEPROM_MFC_AUTH_TIMEOUT   0x32
 
#define NFC3_EEPROM_LPCD_REFERENCE_VALUE   0x34
 
#define NFC3_EEPROM_LPCD_FIELD_ON_TIME   0x36
 
#define NFC3_EEPROM_LPCD_THRESHOLD   0x37
 
#define NFC3_EEPROM_LPCD_REFVAL_GPO_CONTROL   0x38
 
#define NFC3_EEPROM_LPCD_GPO_TOGGLE_BEFORE_FIELD_ON   0x39
 
#define NFC3_EEPROM_LPCD_GPO_TOGGLE_AFTER_FIELD_OFF   0x3A
 
#define NFC3_EEPROM_NFCLD_SENSITIVITY_VAL   0x3B
 
#define NFC3_EEPROM_FIELD_ON_CP_SETTLE_TIME   0x3C
 
#define NFC3_EEPROM_RF_DEBOUNCE_TIMEOUT   0x3F
 
#define NFC3_EEPROM_SENS_RES   0x40
 
#define NFC3_EEPROM_NFCID1   0x42
 
#define NFC3_EEPROM_SEL_RES   0x45
 
#define NFC3_EEPROM_FELICA_POLLING_RESPONSE   0x46
 
#define NFC3_EEPROM_RANDOMUID_ENABLE   0x51
 
#define NFC3_EEPROM_RANDOM_UID_ENABLE   0x58
 
#define NFC3_EEPROM_DPC_CONTROL   0x59
 
#define NFC3_EEPROM_DPC_TIME   0x5A
 
#define NFC3_EEPROM_DPC_XI   0x5C
 
#define NFC3_EEPROM_AGC_CONTROL   0x5D
 
#define NFC3_EEPROM_DPC_THRSH_HIGH   0x5F
 
#define NFC3_EEPROM_DPC_THRSH_LOW   0x7D
 
#define NFC3_EEPROM_DPC_DEBUG   0x7F
 
#define NFC3_EEPROM_DPC_AGC_SHIFT_VALUE   0x80
 
#define NFC3_EEPROM_DPC_AGC_GEAR_LUT_SIZE   0x81
 
#define NFC3_EEPROM_DPC_AGC_GEAR_LUT   0x82
 
#define NFC3_EEPROM_DPC_GUARD_FAST_MODE   0x91
 
#define NFC3_EEPROM_DPC_GUARD_SOF_DETECTED   0x93
 
#define NFC3_EEPROM_DPC_GUARD_FIELD_ON   0x95
 
#define NFC3_EEPROM_PCD_AWC_DRC_LUT_SIZE   0x97
 
#define NFC3_EEPROM_PCD_AWC_DRC_LUT   0x98
 
#define NFC3_EEPROM_MISC_CONFIG   0xE8
 
#define NFC3_EEPROM_DIGIDELAY_A_848_RW   0xE9
 
#define NFC3_EEPROM_DIGIDELAY_B_848_RW   0xEA
 
#define NFC3_EEPROM_DIGIDELAY_F_424_RW   0xEB
 
#define NFC3_EEPROM_DIGIDELAY_15693_RW_FASTHIGH   0xEC
 
#define NFC3_EEPROM_DIGIDELAY_18000_2_848   0xED
 
#define NFC3_EEPROM_DIGIDELAY_18000_4_848   0xEE
 
#define NFC3_EEPROM_TESTBUSMODE   0xF0
 
#define NFC3_EEPROM_TBSELECT   0xF1
 
#define NFC3_EEPROM_MAPTB1_TO_TB0   0xF2
 
#define NFC3_EEPROM_NUMPADSIGNALMAPS   0xF3
 
#define NFC3_EEPROM_PADSIGNALMAP   0xF4
 
#define NFC3_EEPROM_TBDAC1   0xF5
 
#define NFC3_EEPROM_TBDAC2   0xF6
 
#define NFC3_RX_IRQ_STAT   (1<<0)
 NFC 3 setting description.
 
#define NFC3_TX_IRQ_STAT   (1<<1)
 
#define NFC3_IDLE_IRQ_STAT   (1<<2)
 
#define NFC3_RFOFF_DET_IRQ_STAT   (1<<6)
 
#define NFC3_RFON_DET_IRQ_STAT   (1<<7)
 
#define NFC3_TX_RFOFF_IRQ_STAT   (1<<8)
 
#define NFC3_TX_RFON_IRQ_STAT   (1<<9)
 
#define NFC3_RX_SOF_DET_IRQ_STAT   (1<<14)
 
#define NFC3_GENERAL_ERROR_IRQ_STAT   (1ul<<17)
 
#define NFC3_LPCD_IRQ_STAT   (1ul<<19)
 
#define NFC3_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  nfc3_return_value_t { NFC3_OK = 0 , NFC3_ERROR = -1 }
 NFC 3 Click return value data. More...
 
enum  nfc3_transceive_stat_t {
  NFC3_TS_IDLE = 0 , NFC3_TS_WAIT_TRANSMIT = 1 , NFC3_TS_TRANSMITTING = 2 , NFC3_TS_WAIT_RECEIVE = 3 ,
  NFC3_TS_WAIT_FOR_DATA = 4 , NFC3_TS_RECEIVING = 5 , NFC3_TS_LOOPBACK = 6 , NFC3_TS_RESERVED = 7
}
 NFC 3 Click transceive status value data. More...
 

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

This file contains API for NFC 3 Click Driver.

Enumeration Type Documentation

◆ nfc3_return_value_t

NFC 3 Click return value data.

Predefined enum values for driver return values.

Enumerator
NFC3_OK 
NFC3_ERROR 

◆ nfc3_transceive_stat_t

NFC 3 Click transceive status value data.

Predefined enum values for transceive status values.

Enumerator
NFC3_TS_IDLE 
NFC3_TS_WAIT_TRANSMIT 
NFC3_TS_TRANSMITTING 
NFC3_TS_WAIT_RECEIVE 
NFC3_TS_WAIT_FOR_DATA 
NFC3_TS_RECEIVING 
NFC3_TS_LOOPBACK 
NFC3_TS_RESERVED