Loading...
Searching...
No Matches
furi_hal_nfc_i.h File Reference

NFC HAL library (private definitions). More...

#include <furi.h>
#include <furi_hal_nfc.h>
#include <furi_hal_spi.h>
#include <drivers/st25r3916.h>
#include <drivers/st25r3916_reg.h>

Go to the source code of this file.

Data Structures

struct  FuriHalNfcEventInternal
 NFC HAL internal event structure. More...
 
struct  FuriHalNfc
 NFC HAL global state structure. More...
 

Macros

#define FURI_HAL_NFC_POLLER_FDT_COMP_FC   (-500)
 Common frame delay time compensation for pollers.
 
#define FURI_HAL_NFC_POLLER_FWT_COMP_FC   (FURI_HAL_NFC_POLLER_FDT_COMP_FC)
 Common frame wait time compensation for pollers.
 
#define FURI_HAL_NFC_EVENT_INTERNAL_ALL
 Special bitmask value of all internal events.
 

Enumerations

enum  FuriHalNfcEventInternalType {
  FuriHalNfcEventInternalTypeAbort = (1U << 0) , FuriHalNfcEventInternalTypeIrq = (1U << 1) , FuriHalNfcEventInternalTypeTimerFwtExpired , FuriHalNfcEventInternalTypeTimerBlockTxExpired ,
  FuriHalNfcEventInternalTypeTransparentDataReceived
}
 Enumeration containing bitmask values for NFC HAL internal events. More...
 

Functions

void furi_hal_nfc_event_init (void)
 Initialise NFC HAL event system.
 
void furi_hal_nfc_event_set (FuriHalNfcEventInternalType event)
 Forcibly emit (a) particular internal event(s).
 
void furi_hal_nfc_init_gpio_isr (void)
 Initialise GPIO to generate an interrupt from the NFC hardware.
 
void furi_hal_nfc_deinit_gpio_isr (void)
 Disable interrupts from the NFC hardware.
 
void furi_hal_nfc_timers_init (void)
 Initialise all NFC timers.
 
void furi_hal_nfc_timers_deinit (void)
 Disable all NFC timers.
 
uint32_t furi_hal_nfc_get_irq (FuriHalSpiBusHandle *handle)
 Get the interrupt bitmask from the NFC hardware.
 
bool furi_hal_nfc_event_wait_for_specific_irq (FuriHalSpiBusHandle *handle, uint32_t mask, uint32_t timeout_ms)
 Wait until a specified type of interrupt occurs.
 
FuriHalNfcEvent furi_hal_nfc_wait_event_common (uint32_t timeout_ms)
 Wait for any event to occur.
 
FuriHalNfcError furi_hal_nfc_common_listener_rx_start (FuriHalSpiBusHandle *handle)
 Start reception in listener mode.
 
FuriHalNfcError furi_hal_nfc_common_fifo_tx (FuriHalSpiBusHandle *handle, const uint8_t *tx_data, size_t tx_bits)
 Transmit data using on-chip FIFO.
 
FuriHalNfcError furi_hal_nfc_common_fifo_rx (FuriHalSpiBusHandle *handle, uint8_t *rx_data, size_t rx_data_size, size_t *rx_bits)
 Receive data using on-chip FIFO.
 
FuriHalNfcError furi_hal_nfc_poller_tx_common (FuriHalSpiBusHandle *handle, const uint8_t *tx_data, size_t tx_bits)
 Transmit data in poller mode.
 

Variables

FuriHalNfc furi_hal_nfc
 NFC HAL global state object declaration.
 

Detailed Description

NFC HAL library (private definitions).

This file is an implementation detail. It must not be included in any public API-related headers.

Macro Definition Documentation

◆ FURI_HAL_NFC_EVENT_INTERNAL_ALL

#define FURI_HAL_NFC_EVENT_INTERNAL_ALL
Value:
@ FuriHalNfcEventInternalTypeIrq
NFC hardware interrupt has occurred.
Definition furi_hal_nfc_i.h:31
@ FuriHalNfcEventInternalTypeTimerBlockTxExpired
Transmission block timeout has expired.
Definition furi_hal_nfc_i.h:34
@ FuriHalNfcEventInternalTypeTimerFwtExpired
Frame wait time timeout has expired.
Definition furi_hal_nfc_i.h:32
@ FuriHalNfcEventInternalTypeTransparentDataReceived
Data was received in transparent mode.
Definition furi_hal_nfc_i.h:36
@ FuriHalNfcEventInternalTypeAbort
Abort waiting for hardware events.
Definition furi_hal_nfc_i.h:30

Special bitmask value of all internal events.

Enumeration Type Documentation

◆ FuriHalNfcEventInternalType

Enumeration containing bitmask values for NFC HAL internal events.

Enumerator
FuriHalNfcEventInternalTypeAbort 

Abort waiting for hardware events.

FuriHalNfcEventInternalTypeIrq 

NFC hardware interrupt has occurred.

FuriHalNfcEventInternalTypeTimerFwtExpired 

Frame wait time timeout has expired.

FuriHalNfcEventInternalTypeTimerBlockTxExpired 

Transmission block timeout has expired.

FuriHalNfcEventInternalTypeTransparentDataReceived 

Data was received in transparent mode.

Function Documentation

◆ furi_hal_nfc_common_fifo_rx()

FuriHalNfcError furi_hal_nfc_common_fifo_rx ( FuriHalSpiBusHandle * handle,
uint8_t * rx_data,
size_t rx_data_size,
size_t * rx_bits )

Receive data using on-chip FIFO.

This function is common to all technologies.

Parameters
[in,out]handlepointer to the SPI handle associated with the NFC chip.
[out]rx_datapointer to a byte array to be filled with received data.
[in]rx_data_sizemaximum received data size, in bytes.
[out]rx_bitspointer to the variable to contain the received data size, in bits.
Returns
FuriHalNfcErrorNone on success, any other error code on failure.

◆ furi_hal_nfc_common_fifo_tx()

FuriHalNfcError furi_hal_nfc_common_fifo_tx ( FuriHalSpiBusHandle * handle,
const uint8_t * tx_data,
size_t tx_bits )

Transmit data using on-chip FIFO.

This function is common to all technologies.

Parameters
[in,out]handlepointer to the SPI handle associated with the NFC chip.
[in]tx_datapointer to a byte array containing the data to be transmitted.
[in]tx_bitstransmit data size, in bits.
Returns
FuriHalNfcErrorNone on success, any other error code on failure.

◆ furi_hal_nfc_common_listener_rx_start()

FuriHalNfcError furi_hal_nfc_common_listener_rx_start ( FuriHalSpiBusHandle * handle)

Start reception in listener mode.

This function is common to all technologies.

Parameters
[in,out]handlepointer to the SPI handle associated with the NFC chip.
Returns
FuriHalNfcErrorNone on success, any other error code on failure.

◆ furi_hal_nfc_event_set()

void furi_hal_nfc_event_set ( FuriHalNfcEventInternalType event)

Forcibly emit (a) particular internal event(s).

Parameters
[in]eventbitmask of one or more events to be emitted.

◆ furi_hal_nfc_event_wait_for_specific_irq()

bool furi_hal_nfc_event_wait_for_specific_irq ( FuriHalSpiBusHandle * handle,
uint32_t mask,
uint32_t timeout_ms )

Wait until a specified type of interrupt occurs.

Parameters
[in,out]handlepointer to the SPI handle associated with the NFC chip.
[in]maskbitmask of one or more interrupts to wait for.
[in]timeout_msmaximum time to wait for an interrupt, in milliseconds.
Returns
true if specified interrupt(s) have occured within timeout, false otherwise.

◆ furi_hal_nfc_get_irq()

uint32_t furi_hal_nfc_get_irq ( FuriHalSpiBusHandle * handle)

Get the interrupt bitmask from the NFC hardware.

Parameters
[in,out]handlepointer to the SPI handle associated with the NFC chip.
Returns
bitmask of zero or more occurred interrupts.

◆ furi_hal_nfc_poller_tx_common()

FuriHalNfcError furi_hal_nfc_poller_tx_common ( FuriHalSpiBusHandle * handle,
const uint8_t * tx_data,
size_t tx_bits )

Transmit data in poller mode.

This function is common to all technologies.

Parameters
[in,out]handlepointer to the SPI handle associated with the NFC chip.
[in]tx_datapointer to a byte array containing the data to be transmitted.
[in]tx_bitstransmit data size, in bits.
Returns
FuriHalNfcErrorNone on success, any other error code on failure.

◆ furi_hal_nfc_wait_event_common()

FuriHalNfcEvent furi_hal_nfc_wait_event_common ( uint32_t timeout_ms)

Wait for any event to occur.

This function is common to all technologies.

Parameters
[in]timeout_msmaximum time to wait for an event, in milliseconds.
Returns
bitmask of zero or more occurred events.