NFCT driver
- group nrfx_nfct
Near Field Communication Tag (NFCT) peripheral driver.
Defines
-
NRFX_NFCT_NFCID1_SINGLE_SIZE
Length of single-size NFCID1.
-
NRFX_NFCT_NFCID1_DOUBLE_SIZE
Length of double-size NFCID1.
-
NRFX_NFCT_NFCID1_TRIPLE_SIZE
Length of triple-size NFCID1.
-
NRFX_NFCT_NFCID1_DEFAULT_LEN
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.
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.
- Param p_event:
[in] Pointer to the event descriptor.
Enums
-
enum nrfx_nfct_state_t
NFCT hardware states.
Values:
-
enumerator NRFX_NFCT_STATE_DISABLED
NFC Tag is disabled (no sensing of an external NFC field).
-
enumerator NRFX_NFCT_STATE_SENSING
NFC Tag is sensing whether there is an external NFC field.
-
enumerator NRFX_NFCT_STATE_ACTIVATED
NFC Tag is powered-up (see nrfx_nfct_active_state_t for possible substates).
-
enumerator NRFX_NFCT_STATE_DISABLED
-
enum nrfx_nfct_active_state_t
NFC tag states, when NFCT hardware is activated.
These states are substates of the NRFX_NFCT_STATE_ACTIVATED state.
Values:
-
enumerator NRFX_NFCT_ACTIVE_STATE_IDLE
NFC Tag is activated and idle (not selected by a reader).
-
enumerator NRFX_NFCT_ACTIVE_STATE_SLEEP
NFC Tag is sleeping.
-
enumerator NRFX_NFCT_ACTIVE_STATE_DEFAULT
NFC Tag is either sleeping or idle, depending on the previous state before being selected by a poller.
-
enumerator NRFX_NFCT_ACTIVE_STATE_IDLE
-
enum nrfx_nfct_evt_id_t
NFCT driver event types, passed to the upper-layer callback function provided during the initialization.
Values:
-
enumerator NRFX_NFCT_EVT_FIELD_DETECTED
External NFC field is detected.
-
enumerator NRFX_NFCT_EVT_FIELD_LOST
External NFC Field is lost.
-
enumerator NRFX_NFCT_EVT_SELECTED
Tag was selected by the poller.
-
enumerator NRFX_NFCT_EVT_RX_FRAMESTART
Data frame reception started.
-
enumerator NRFX_NFCT_EVT_RX_FRAMEEND
Data frame is received.
-
enumerator NRFX_NFCT_EVT_TX_FRAMESTART
Data frame transmission started.
-
enumerator NRFX_NFCT_EVT_TX_FRAMEEND
Data frame is transmitted.
-
enumerator NRFX_NFCT_EVT_ERROR
Error occurred in an NFC communication.
-
enumerator NRFX_NFCT_EVT_FIELD_DETECTED
-
enum nrfx_nfct_error_t
NFCT timing-related error types.
Values:
-
enumerator NRFX_NFCT_ERROR_FRAMEDELAYTIMEOUT
No response frame was transmitted to the poller in the transmit window.
-
enumerator NRFX_NFCT_ERROR_NUM
Total number of possible errors.
-
enumerator NRFX_NFCT_ERROR_FRAMEDELAYTIMEOUT
-
enum nrfx_nfct_param_id_t
NFCT driver parameter types.
Values:
-
enumerator NRFX_NFCT_PARAM_ID_FDT
NFC-A Frame Delay Time parameter.
-
enumerator NRFX_NFCT_PARAM_ID_FDT_MIN
NFC-A Frame Delay Time Min parameter.
-
enumerator NRFX_NFCT_PARAM_ID_SEL_RES
Value of the ‘Protocol’ field in the NFC-A SEL_RES frame.
-
enumerator NRFX_NFCT_PARAM_ID_NFCID1
NFC-A NFCID1 setting (NFC tag identifier).
-
enumerator NRFX_NFCT_PARAM_ID_FDT
Functions
-
nrfx_err_t nrfx_nfct_init(nrfx_nfct_config_t const *p_config)
Function for initializing the NFCT driver.
- Parameters:
p_config – [in] Pointer to the NFCT driver configuration structure.
- Return values:
NRFX_SUCCESS – The NFCT driver was initialized successfully.
NRFX_ERROR_ALREADY – The driver is already initialized.
NRFX_ERROR_INVALID_STATE – The driver is already initialized. Deprecated - use NRFX_ERROR_ALREADY instead.
NRFX_ERROR_FORBIDDEN – The NFCT antenna pads are not configured as antenna pins.
-
void nrfx_nfct_uninit(void)
Function for uninitializing the NFCT driver.
After uninitialization, the instance is in disabled state.
-
bool nrfx_nfct_init_check(void)
Function for checking if the NFCT driver is initialized.
- Return values:
true – Driver is already initialized.
false – Driver is not initialized.
-
void nrfx_nfct_enable(void)
Function for starting the NFC subsystem.
After this function completes, NFC readers are able to detect the tag.
-
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.
-
bool nrfx_nfct_field_check(void)
Function for checking whether the external NFC field is present in the range of the tag.
- Return values:
true – The NFC field is present.
false – No NFC field is present.
-
nrfx_err_t nrfx_nfct_rx(nrfx_nfct_data_desc_t const *p_rx_data)
Function for preparing the NFCT driver for receiving an NFC frame.
- Parameters:
p_rx_data – [in] Pointer to the RX buffer.
- Return values:
NRFX_SUCCESS – The operation was successful.
NRFX_ERROR_INVALID_ADDR – Data buffer does not point to memory region reachable by EasyDMA.
-
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:
p_tx_data – [in] Pointer to the TX buffer.
delay_mode – [in] Delay mode of the NFCT frame timer.
- Return values:
NRFX_SUCCESS – The operation was successful.
NRFX_ERROR_INVALID_LENGTH – The TX buffer size is invalid.
NRFX_ERROR_BUSY – Driver is already transferring.
NRFX_ERROR_INVALID_ADDR – Data buffer does not point to memory region reachable by EasyDMA.
-
nrfx_err_t nrfx_nfct_bits_tx(nrfx_nfct_data_desc_t const *p_tx_data, nrf_nfct_frame_delay_mode_t delay_mode)
Function for transmitting an NFC frame with a specified number of bits.
- Parameters:
p_tx_data – [in] Pointer to the TX buffer. Unlike in nrfx_nfct_tx,
data_size
is used as the number of bits to transmit, rather than bytes.delay_mode – [in] Delay mode of the NFCT frame timer.
- Return values:
NRFX_SUCCESS – The operation was successful.
NRFX_ERROR_INVALID_LENGTH – The TX buffer size is invalid.
NRFX_ERROR_BUSY – Driver is already transferring.
NRFX_ERROR_INVALID_ADDR – Data buffer does not point to memory region reachable by EasyDMA.
-
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:
state – [in] The required state.
-
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:
sub_state – [in] The required substate.
-
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:
p_param – [in] Pointer to parameter descriptor.
- Return values:
NRFX_SUCCESS – The operation was successful.
NRFX_ERROR_INVALID_PARAM – The parameter data is invalid.
-
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.
Note
This function cannot be used from the non-secure code because it requires access to FICR registers.
- Parameters:
p_nfcid1_buff – [inout] In: empty buffer for data; Out: buffer with the NFCID1 default data. These values can be used to fill the Type 2 Tag Internal Bytes.
nfcid1_buff_len – [in] Length of the NFCID1 buffer.
- Return values:
NRFX_SUCCESS – The operation was successful.
NRFX_ERROR_INVALID_LENGTH – Length of the NFCID buffer is different than NRFX_NFCT_NFCID1_SINGLE_SIZE, NRFX_NFCT_NFCID1_DOUBLE_SIZE, or NRFX_NFCT_NFCID1_TRIPLE_SIZE.
-
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_autocolres_disable(void)
Function for disabling the automatic collision resolution.
See also details in nrfx_nfct_autocolres_enable.
-
struct nrfx_nfct_nfcid1_t
- #include <nrfx_nfct.h>
NFCID1 descriptor.
-
struct nrfx_nfct_param_t
- #include <nrfx_nfct.h>
NFCT driver parameter descriptor.
Public Members
-
nrfx_nfct_param_id_t id
Type of parameter.
-
uint32_t fdt
NFC-A Frame Delay Time. Filled when nrfx_nfct_param_t.id is NRFX_NFCT_PARAM_ID_FDT.
-
uint32_t fdt_min
NFC-A Frame Delay Time Min. Filled when nrfx_nfct_param_t.id is NRFX_NFCT_PARAM_ID_FDT_MIN.
-
uint8_t sel_res_protocol
NFC-A value of the ‘Protocol’ field in the SEL_RES frame. Filled when nrfx_nfct_param_t.id is NRFX_NFCT_PARAM_ID_SEL_RES.
-
nrfx_nfct_nfcid1_t nfcid1
NFC-A NFCID1 value (tag identifier). Filled when nrfx_nfct_param_t.id is NRFX_NFCT_PARAM_ID_NFCID1.
-
union nrfx_nfct_param_t.[anonymous] data
Union to store parameter data.
-
nrfx_nfct_param_id_t id
-
struct nrfx_nfct_data_desc_t
- #include <nrfx_nfct.h>
NFCT driver RX/TX buffer descriptor.
-
struct nrfx_nfct_evt_rx_frameend_t
- #include <nrfx_nfct.h>
Structure used to describe the NRFX_NFCT_EVT_RX_FRAMEEND event type.
-
struct nrfx_nfct_evt_tx_framestart_t
- #include <nrfx_nfct.h>
Structure used to describe the NRFX_NFCT_EVT_TX_FRAMESTART event type.
Public Members
-
nrfx_nfct_data_desc_t tx_data
TX buffer.
-
nrfx_nfct_data_desc_t tx_data
-
struct nrfx_nfct_evt_error_t
- #include <nrfx_nfct.h>
Structure used to describe the NRFX_NFCT_EVT_ERROR event type.
Public Members
-
nrfx_nfct_error_t reason
Reason for error.
-
nrfx_nfct_error_t reason
-
struct nrfx_nfct_evt_t
- #include <nrfx_nfct.h>
NFCT driver event.
Public Members
-
nrfx_nfct_evt_id_t evt_id
Type of event.
-
nrfx_nfct_evt_rx_frameend_t rx_frameend
End of the RX frame data. Filled when nrfx_nfct_evt_t.evt_id is NRFX_NFCT_EVT_RX_FRAMEEND.
-
nrfx_nfct_evt_tx_framestart_t tx_framestart
Start of the TX frame data. Filled when nrfx_nfct_evt_t.evt_id is NRFX_NFCT_EVT_TX_FRAMESTART.
-
nrfx_nfct_evt_error_t error
Error data. Filled when nrfx_nfct_evt_t.evt_id is NRFX_NFCT_EVT_ERROR.
-
union nrfx_nfct_evt_t.[anonymous] params
Union to store event data.
-
nrfx_nfct_evt_id_t evt_id
-
struct nrfx_nfct_config_t
- #include <nrfx_nfct.h>
NFCT driver configuration structure.
Public Members
-
uint32_t rxtx_int_mask
Mask for enabling RX/TX events. Indicate which events must be forwarded to the upper layer by using nrfx_nfct_evt_id_t. By default, no events are enabled. */.
-
nrfx_nfct_handler_t cb
Callback.
-
uint8_t irq_priority
Interrupt priority.
-
uint32_t rxtx_int_mask
-
NRFX_NFCT_NFCID1_SINGLE_SIZE