nfc7i2c  2.1.0.0
Main Page

NFC 7 I2C click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Stefan Filipovic
  • Date : Oct 2024.
  • Type : I2C type

Software Support

We provide a library for the NFC 7 I2C Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for NFC 7 I2C Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of NFC 7 I2C click board by handling the detection

and processing of various NFC technologies and protocols, and ensuring the application can respond to different NFC card types (A,B,F,V).

The demo application is composed of two sections :

Application Init

Initializes the driver and logger, performs the click default configuration and reads the device firmware version.

void application_init ( void )
{
log_cfg_t log_cfg;
nfc7i2c_cfg_t nfc7i2c_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
nfc7i2c_cfg_setup( &nfc7i2c_cfg );
NFC7I2C_MAP_MIKROBUS( nfc7i2c_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == nfc7i2c_init( &nfc7i2c, &nfc7i2c_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( NFC7I2C_ERROR == nfc7i2c_default_cfg ( &nfc7i2c ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_printf( &logger, " FW version: %.2X.%.2X.%.2X\r\n",
( uint16_t ) nfc7i2c.fw_version[ 0 ],
( uint16_t ) nfc7i2c.fw_version[ 1 ],
( uint16_t ) nfc7i2c.fw_version[ 2 ] );
log_info( &logger, " Application Task " );
}

Application Task

Waits for an NFC device to be discovered, checks if it supports a known NFC technology,

and then handles the device based on its protocol. The application continues processing the device (reading and writing information) and waits until the card is removed. Once the card is removed, the discovery process is restarted to detect a new NFC device.

void application_task ( void )
{
log_printf( &logger, " WAITING FOR DEVICE DISCOVERY\r\n\n" );
if ( NFC7I2C_OK == nfc7i2c_wait_discovery ( &nfc7i2c, &rf_intf ) )
{
{
for ( ; ; )
{
nfc7i2c_display_card_info ( rf_intf );
switch ( rf_intf.protocol )
{
{
nfc7i2c_handle_iso14443_3a ( &nfc7i2c );
break;
}
{
nfc7i2c_handle_iso14443_4 ( &nfc7i2c );
break;
}
{
nfc7i2c_handle_iso15693 ( &nfc7i2c );
break;
}
{
nfc7i2c_handle_mifare ( &nfc7i2c );
break;
}
default:
{
break;
}
}
if ( !rf_intf.more_tags )
{
break;
}
nfc7i2c_reader_act_next ( &nfc7i2c, &rf_intf );
}
nfc7i2c_presence_check ( &nfc7i2c, &rf_intf );
log_printf ( &logger, " - CARD REMOVED\r\n\n" );
nfc7i2c_stop_discovery ( &nfc7i2c );
while ( NFC7I2C_OK != nfc7i2c_start_discovery ( &nfc7i2c ) );
}
else
{
log_printf ( &logger, " - WRONG DISCOVERY\r\n\n" );
}
}
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.NFC7I2C

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


nfc7i2c_cfg_t
NFC 7 I2C Click configuration object.
Definition: nfc7i2c.h:489
nfc7i2c_reader_act_next
err_t nfc7i2c_reader_act_next(nfc7i2c_t *ctx, nfc7i2c_rf_intf_t *rf_intf)
NFC 7 I2C reader activate next function.
nfc7i2c_wait_discovery
err_t nfc7i2c_wait_discovery(nfc7i2c_t *ctx, nfc7i2c_rf_intf_t *rf_intf)
NFC 7 I2C wait discovery function.
NFC7I2C_NCI_RF_TECH_PASSIVE_POLL_NFC_A
#define NFC7I2C_NCI_RF_TECH_PASSIVE_POLL_NFC_A
NFC 7 I2C RF technologies and mode setting.
Definition: nfc7i2c.h:179
nfc7i2c_rf_intf_t::protocol
uint8_t protocol
Definition: nfc7i2c.h:422
nfc7i2c_start_discovery
err_t nfc7i2c_start_discovery(nfc7i2c_t *ctx)
NFC 7 I2C start discovery function.
nfc7i2c_t
NFC 7 I2C Click context object.
Definition: nfc7i2c.h:460
nfc7i2c_default_cfg
err_t nfc7i2c_default_cfg(nfc7i2c_t *ctx)
NFC 7 I2C default configuration function.
nfc7i2c_rf_intf_t::more_tags
uint8_t more_tags
Definition: nfc7i2c.h:424
NFC7I2C_NCI_RF_PROT_T5T
#define NFC7I2C_NCI_RF_PROT_T5T
Definition: nfc7i2c.h:195
nfc7i2c_presence_check
void nfc7i2c_presence_check(nfc7i2c_t *ctx, nfc7i2c_rf_intf_t *rf_intf)
NFC 7 I2C presence check function.
nfc7i2c_cfg_setup
void nfc7i2c_cfg_setup(nfc7i2c_cfg_t *cfg)
NFC 7 I2C configuration object setup function.
application_task
void application_task(void)
Definition: main.c:126
nfc7i2c_rf_intf_t::mode_tech
uint8_t mode_tech
Definition: nfc7i2c.h:423
NFC7I2C_NCI_RF_PROT_T2T
#define NFC7I2C_NCI_RF_PROT_T2T
Definition: nfc7i2c.h:191
NFC7I2C_ERROR
@ NFC7I2C_ERROR
Definition: nfc7i2c.h:508
NFC7I2C_OK
@ NFC7I2C_OK
Definition: nfc7i2c.h:507
nfc7i2c_init
err_t nfc7i2c_init(nfc7i2c_t *ctx, nfc7i2c_cfg_t *cfg)
NFC 7 I2C initialization function.
nfc7i2c_stop_discovery
err_t nfc7i2c_stop_discovery(nfc7i2c_t *ctx)
NFC 7 I2C stop discovery function.
NFC7I2C_NCI_RF_PROT_ISODEP
#define NFC7I2C_NCI_RF_PROT_ISODEP
Definition: nfc7i2c.h:193
NFC7I2C_NCI_RF_TECH_PASSIVE_POLL_NFC_B
#define NFC7I2C_NCI_RF_TECH_PASSIVE_POLL_NFC_B
Definition: nfc7i2c.h:180
NFC7I2C_NCI_RF_PROT_MIFARE
#define NFC7I2C_NCI_RF_PROT_MIFARE
Definition: nfc7i2c.h:196
nfc7i2c_rf_intf_t
NFC 7 I2C Click discovered remote device properties object.
Definition: nfc7i2c.h:420
application_init
void application_init(void)
Definition: main.c:86
NFC7I2C_NCI_RF_TECH_PASSIVE_POLL_NFC_F
#define NFC7I2C_NCI_RF_TECH_PASSIVE_POLL_NFC_F
Definition: nfc7i2c.h:181
NFC7I2C_NCI_RF_TECH_PASSIVE_POLL_15693
#define NFC7I2C_NCI_RF_TECH_PASSIVE_POLL_15693
Definition: nfc7i2c.h:182
NFC7I2C_MAP_MIKROBUS
#define NFC7I2C_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: nfc7i2c.h:340