nRF5 SDK v17.1.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
NFCT driver

Near Field Communication Tag (NFCT) peripheral driver. More...

Modules

 NFCT peripheral driver configuration
 

Data Structures

struct  nrfx_nfct_nfcid1_t
 NFCID1 descriptor. More...
 
struct  nrfx_nfct_param_t
 NFCT driver parameter descriptor. More...
 
struct  nrfx_nfct_data_desc_t
 NFCT driver RX/TX buffer descriptor. More...
 
struct  nrfx_nfct_evt_rx_frameend_t
 Structure used to describe the NRFX_NFCT_EVT_RX_FRAMEEND event type. More...
 
struct  nrfx_nfct_evt_tx_framestart_t
 Structure used to describe the NRFX_NFCT_EVT_TX_FRAMESTART event type. More...
 
struct  nrfx_nfct_evt_error_t
 Structure used to describe the NRFX_NFCT_EVT_ERROR event type. More...
 
struct  nrfx_nfct_evt_t
 NFCT driver event. More...
 
struct  nrfx_nfct_config_t
 NFCT driver configuration structure. More...
 

Macros

#define NRFX_NFCT_NFCID1_SINGLE_SIZE   4u
 Length of single-size NFCID1.
 
#define NRFX_NFCT_NFCID1_DOUBLE_SIZE   7u
 Length of double-size NFCID1.
 
#define NRFX_NFCT_NFCID1_TRIPLE_SIZE   10u
 Length of triple-size NFCID1.
 
#define NRFX_NFCT_NFCID1_DEFAULT_LEN   NRFX_NFCT_NFCID1_DOUBLE_SIZE
 Default length of NFC ID. */.
 

Typedefs

typedef void(* nrfx_nfct_handler_t )(nrfx_nfct_evt_t const *p_event)
 Callback descriptor to pass events from the NFCT driver to the upper layer. More...
 

Enumerations

enum  nrfx_nfct_state_t {
  NRFX_NFCT_STATE_DISABLED = NRF_NFCT_TASK_DISABLE,
  NRFX_NFCT_STATE_SENSING = NRF_NFCT_TASK_SENSE,
  NRFX_NFCT_STATE_ACTIVATED = NRF_NFCT_TASK_ACTIVATE
}
 NFCT hardware states. More...
 
enum  nrfx_nfct_active_state_t {
  NRFX_NFCT_ACTIVE_STATE_IDLE = NRF_NFCT_TASK_GOIDLE,
  NRFX_NFCT_ACTIVE_STATE_SLEEP = NRF_NFCT_TASK_GOSLEEP,
  NRFX_NFCT_ACTIVE_STATE_DEFAULT
}
 NFC tag states, when NFCT hardware is activated. More...
 
enum  nrfx_nfct_evt_id_t {
  NRFX_NFCT_EVT_FIELD_DETECTED = NRF_NFCT_INT_FIELDDETECTED_MASK,
  NRFX_NFCT_EVT_FIELD_LOST = NRF_NFCT_INT_FIELDLOST_MASK,
  NRFX_NFCT_EVT_SELECTED = NRF_NFCT_INT_SELECTED_MASK,
  NRFX_NFCT_EVT_RX_FRAMESTART = NRF_NFCT_INT_RXFRAMESTART_MASK,
  NRFX_NFCT_EVT_RX_FRAMEEND = NRF_NFCT_INT_RXFRAMEEND_MASK,
  NRFX_NFCT_EVT_TX_FRAMESTART = NRF_NFCT_INT_TXFRAMESTART_MASK,
  NRFX_NFCT_EVT_TX_FRAMEEND = NRF_NFCT_INT_TXFRAMEEND_MASK,
  NRFX_NFCT_EVT_ERROR = NRF_NFCT_INT_ERROR_MASK
}
 NFCT driver event types, passed to the upper-layer callback function provided during the initialization. More...
 
enum  nrfx_nfct_error_t {
  NRFX_NFCT_ERROR_FRAMEDELAYTIMEOUT,
  NRFX_NFCT_ERROR_NUM
}
 NFCT timing-related error types. More...
 
enum  nrfx_nfct_param_id_t {
  NRFX_NFCT_PARAM_ID_FDT,
  NRFX_NFCT_PARAM_ID_SEL_RES,
  NRFX_NFCT_PARAM_ID_NFCID1
}
 NFCT driver parameter types. More...
 

Functions

nrfx_err_t nrfx_nfct_init (nrfx_nfct_config_t const *p_config)
 Function for initializing the NFCT driver. More...
 
void nrfx_nfct_uninit (void)
 Function for uninitializing the NFCT driver. More...
 
void nrfx_nfct_enable (void)
 Function for starting the NFC subsystem. More...
 
void nrfx_nfct_disable (void)
 Function for disabling the NFCT driver. More...
 
bool nrfx_nfct_field_check (void)
 Function for checking whether the external NFC field is present in the range of the tag. More...
 
void nrfx_nfct_rx (nrfx_nfct_data_desc_t const *p_rx_data)
 Function for preparing the NFCT driver for receiving an NFC frame. More...
 
nrfx_err_t nrfx_nfct_tx (nrfx_nfct_data_desc_t const *p_tx_data, nrf_nfct_frame_delay_mode_t delay_mode)
 Function for transmitting an NFC frame. More...
 
void nrfx_nfct_state_force (nrfx_nfct_state_t state)
 Function for moving the NFCT to a new state. More...
 
void nrfx_nfct_init_substate_force (nrfx_nfct_active_state_t sub_state)
 Function for moving the NFCT to a new initial substate within NRFX_NFCT_STATE_ACTIVATED. More...
 
nrfx_err_t nrfx_nfct_parameter_set (nrfx_nfct_param_t const *p_param)
 Function for setting the NFC communication parameter. More...
 
nrfx_err_t nrfx_nfct_nfcid1_default_bytes_get (uint8_t *const p_nfcid1_buff, uint32_t nfcid1_buff_len)
 Function for getting default bytes for NFCID1. More...
 
void nrfx_nfct_autocolres_enable (void)
 Function for enabling the automatic collision resolution. More...
 
void nrfx_nfct_autocolres_disable (void)
 Function for disabling the automatic collision resolution. More...
 

Detailed Description

Near Field Communication Tag (NFCT) peripheral driver.

Typedef Documentation

typedef void(* nrfx_nfct_handler_t)(nrfx_nfct_evt_t const *p_event)

Callback descriptor to pass events from the NFCT driver to the upper layer.

Parameters
[in]p_eventPointer to the event descriptor.
Note
NRFX_NFCT_EVT_FIELD_DETECTED and NRFX_NFCT_EVT_FIELD_LOST are generated only on field state transitions, i.e. there will be no multiple events of the same type (out of the 2 mentioned) coming in a row.

Enumeration Type Documentation

NFC tag states, when NFCT hardware is activated.

These states are substates of the NRFX_NFCT_STATE_ACTIVATED state.

Enumerator
NRFX_NFCT_ACTIVE_STATE_IDLE 

NFC Tag is activated and idle (not selected by a reader).

NRFX_NFCT_ACTIVE_STATE_SLEEP 

NFC Tag is sleeping.

NRFX_NFCT_ACTIVE_STATE_DEFAULT 

NFC Tag is either sleeping or idle, depending on the previous state before being selected by a poller.

NFCT timing-related error types.

Enumerator
NRFX_NFCT_ERROR_FRAMEDELAYTIMEOUT 

No response frame was transmitted to the poller in the transmit window.

NRFX_NFCT_ERROR_NUM 

Total number of possible errors.

NFCT driver event types, passed to the upper-layer callback function provided during the initialization.

Enumerator
NRFX_NFCT_EVT_FIELD_DETECTED 

External NFC field is detected.

NRFX_NFCT_EVT_FIELD_LOST 

External NFC Field is lost.

NRFX_NFCT_EVT_SELECTED 

Tag was selected by the poller.

NRFX_NFCT_EVT_RX_FRAMESTART 

Data frame reception started.

NRFX_NFCT_EVT_RX_FRAMEEND 

Data frame is received.

NRFX_NFCT_EVT_TX_FRAMESTART 

Data frame transmission started.

NRFX_NFCT_EVT_TX_FRAMEEND 

Data frame is transmitted.

NRFX_NFCT_EVT_ERROR 

Error occurred in an NFC communication.

NFCT driver parameter types.

Enumerator
NRFX_NFCT_PARAM_ID_FDT 

NFC-A Frame Delay Time parameter.

NRFX_NFCT_PARAM_ID_SEL_RES 

Value of the 'Protocol' field in the NFC-A SEL_RES frame.

NRFX_NFCT_PARAM_ID_NFCID1 

NFC-A NFCID1 setting (NFC tag identifier).

NFCT hardware states.

Enumerator
NRFX_NFCT_STATE_DISABLED 

NFC Tag is disabled (no sensing of an external NFC field).

NRFX_NFCT_STATE_SENSING 

NFC Tag is sensing whether there is an external NFC field.

NRFX_NFCT_STATE_ACTIVATED 

NFC Tag is powered-up (see nrfx_nfct_active_state_t for possible substates).

Function Documentation

void nrfx_nfct_autocolres_disable ( void  )

Function for disabling the automatic collision resolution.

See also details in nrfx_nfct_autocolres_enable.

void nrfx_nfct_autocolres_enable ( void  )

Function for enabling the automatic collision resolution.

As defined by the NFC Forum Digital Protocol Technical Specification (and ISO 14443-3), the automatic collision resolution is implemented in the NFCT hardware. This function allows enabling and disabling this feature.

void nrfx_nfct_disable ( void  )

Function for disabling the NFCT driver.

After this function returns, NFC readers are no longer able to connect to the tag.

void nrfx_nfct_enable ( void  )

Function for starting the NFC subsystem.

After this function completes, NFC readers are able to detect the tag.

bool nrfx_nfct_field_check ( void  )

Function for checking whether the external NFC field is present in the range of the tag.

Return values
trueThe NFC field is present.
falseNo NFC field is present.
nrfx_err_t nrfx_nfct_init ( nrfx_nfct_config_t const *  p_config)

Function for initializing the NFCT driver.

Parameters
[in]p_configPointer to the NFCT driver configuration structure.
Return values
NRFX_SUCCESSThe NFCT driver was initialized successfully.
NRFX_ERROR_INVALID_STATEThe NFCT driver is already initialized.
void nrfx_nfct_init_substate_force ( nrfx_nfct_active_state_t  sub_state)

Function for moving the NFCT to a new initial substate within NRFX_NFCT_STATE_ACTIVATED.

Parameters
[in]sub_stateThe required substate.
nrfx_err_t nrfx_nfct_nfcid1_default_bytes_get ( uint8_t *const  p_nfcid1_buff,
uint32_t  nfcid1_buff_len 
)

Function for getting default bytes for NFCID1.

Parameters
[in,out]p_nfcid1_buffIn: empty buffer for data; Out: buffer with the NFCID1 default data. These values can be used to fill the Type 2 Tag Internal Bytes.
[in]nfcid1_buff_lenLength of the NFCID1 buffer.
Return values
NRFX_SUCCESSThe operation was successful.
NRFX_ERROR_INVALID_LENGTHLength of the NFCID buffer is different than NRFX_NFCT_NFCID1_SINGLE_SIZE, NRFX_NFCT_NFCID1_DOUBLE_SIZE, or NRFX_NFCT_NFCID1_TRIPLE_SIZE.
nrfx_err_t nrfx_nfct_parameter_set ( nrfx_nfct_param_t const *  p_param)

Function for setting the NFC communication parameter.

Note
Parameter validation for length and acceptable values.
Parameters
[in]p_paramPointer to parameter descriptor.
Return values
NRFX_SUCCESSThe operation was successful.
NRFX_ERROR_INVALID_PARAMThe parameter data is invalid.
void nrfx_nfct_rx ( nrfx_nfct_data_desc_t const *  p_rx_data)

Function for preparing the NFCT driver for receiving an NFC frame.

Parameters
[in]p_rx_dataPointer to the RX buffer.
void nrfx_nfct_state_force ( nrfx_nfct_state_t  state)

Function for moving the NFCT to a new state.

Note
The HFCLK must be running before activating the NFCT with NRFX_NFCT_STATE_ACTIVATED.
Parameters
[in]stateThe required state.
nrfx_err_t nrfx_nfct_tx ( nrfx_nfct_data_desc_t const *  p_tx_data,
nrf_nfct_frame_delay_mode_t  delay_mode 
)

Function for transmitting an NFC frame.

Parameters
[in]p_tx_dataPointer to the TX buffer.
[in]delay_modeDelay mode of the NFCT frame timer.
Return values
NRFX_SUCCESSThe operation was successful.
NRFX_ERROR_INVALID_LENGTHThe TX buffer size is invalid.
NRFX_ERROR_BUSYDriver is already transferring.
void nrfx_nfct_uninit ( void  )

Function for uninitializing the NFCT driver.

After uninitialization, the instance is in disabled state.


Documentation feedback | Developer Zone | Subscribe | Updated