L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
nfc_st25dv16kc.h File Reference
#include "stm32wlxx_hal.h"
Include dependency graph for nfc_st25dv16kc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int8_t nfc_st25dv16kc_Is (I2C_HandleTypeDef *hi2c, int8_t tryInit)
 Check whether the ST25DV16KC has been successfully initialised.
HAL_StatusTypeDef nfc_st25dv16kc_Init (I2C_HandleTypeDef *hi2c)
 Check the I2C bus and try to find the NFC chip. Enables the mailbox, clears it, and turns GPO off (low-power state).
HAL_StatusTypeDef nfc_st25dv16kc_On (I2C_HandleTypeDef *hi2c)
 Turn the NFC GPO ON (all events: MsgReady, FieldChange, RFWrite). Enables host-side reading/writing via the Mailbox.
HAL_StatusTypeDef nfc_st25dv16kc_Off (I2C_HandleTypeDef *hi2c)
 Turn the NFC GPO OFF and enable GPO RF to achieve minimum current (~1 µA).
HAL_StatusTypeDef nfc_st25dv16kc_WriteEEPROM (I2C_HandleTypeDef *hi2c, uint16_t addr, uint8_t *pData, uint16_t len)
 Write data to the EEPROM user memory (4-byte page writes).
HAL_StatusTypeDef nfc_st25dv16kc_ReadEEPROM (I2C_HandleTypeDef *hi2c, uint16_t addr, uint8_t *pData, uint16_t len)
 Read data from the EEPROM user memory.
HAL_StatusTypeDef nfc_st25dv16kc_ProcessMailBox (I2C_HandleTypeDef *hi2c)
 Process incoming data from the RF Mailbox. Checks MB_CTRL_DYN for an RF message; if present reads it and invokes nfc_st25dv16kc_OnMailboxData().
HAL_StatusTypeDef nfc_st25dv16kc_WriteMailBox (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t len)
 Write raw data into the Mailbox so the RF reader (phone) can retrieve it.
__weak void nfc_st25dv16kc_OnMailboxData (uint8_t *data, uint16_t len)
 Weak callback invoked by nfc_st25dv16kc_ProcessMailBox() when new data has arrived in the Mailbox. Override in main.c or application code to process the received message.

Function Documentation

◆ nfc_st25dv16kc_Init()

HAL_StatusTypeDef nfc_st25dv16kc_Init ( I2C_HandleTypeDef * hi2c)

Check the I2C bus and try to find the NFC chip. Enables the mailbox, clears it, and turns GPO off (low-power state).

Parameters
hi2cPointer to I2C handle.
Return values
HAL_OK– NFC found and initialised, HAL_ERROR – not on the bus.

< User memory / EEPROM

< Enable mailbox

< User memory / EEPROM

< Mailbox control (dynamic)

< User memory / EEPROM

< Mailbox control (dynamic)

Definition at line 161 of file nfc_st25dv16kc.c.

References _isNfc, HAL_Delay(), I2C_IsDeviceReadyMT(), nfc_st25dv16kc_Off(), ST25DV16KC_I2C_ADDR_USER, ST25DV16KC_MB_EN, and ST25DV16KC_REG_MB_CTRL_DYN.

Referenced by nfc_st25dv16kc_Is().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nfc_st25dv16kc_Is()

int8_t nfc_st25dv16kc_Is ( I2C_HandleTypeDef * hi2c,
int8_t tryInit )

Check whether the ST25DV16KC has been successfully initialised.

Parameters
hi2cPointer to I2C handle.
tryInitWhen 1, attempt Init() if not yet initialised; 0 – no retry.
Return values
1– NFC present and ready, 0 – not available.

Definition at line 154 of file nfc_st25dv16kc.c.

References _isNfc, and nfc_st25dv16kc_Init().

Here is the call graph for this function:

◆ nfc_st25dv16kc_Off()

HAL_StatusTypeDef nfc_st25dv16kc_Off ( I2C_HandleTypeDef * hi2c)

Turn the NFC GPO OFF and enable GPO RF to achieve minimum current (~1 µA).

Parameters
hi2cPointer to I2C handle.
Return values
HAL_OKon success, HAL_ERROR if NFC not available.

< GPO output enable

< Put RF analog block to sleep

< User memory / EEPROM

< RF management (dynamic)

Definition at line 239 of file nfc_st25dv16kc.c.

References _isNfc, _isOnOff, nfc_st25dv16kc_WriteGPO(), ST25DV16KC_GPO_EN, ST25DV16KC_I2C_ADDR_USER, ST25DV16KC_REG_RF_MNGT_DYN, and ST25DV16KC_RF_SLEEP.

Referenced by nfc_st25dv16kc_Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nfc_st25dv16kc_On()

HAL_StatusTypeDef nfc_st25dv16kc_On ( I2C_HandleTypeDef * hi2c)

Turn the NFC GPO ON (all events: MsgReady, FieldChange, RFWrite). Enables host-side reading/writing via the Mailbox.

Parameters
hi2cPointer to I2C handle.
Return values
HAL_OKon success, HAL_ERROR if NFC not available.

< GPO output enable

< GPO on mailbox message-ready

< GPO on RF field change

< GPO on RF EEPROM write

Definition at line 222 of file nfc_st25dv16kc.c.

References _isNfc, _isOnOff, nfc_st25dv16kc_WriteGPO(), and ST25DV16KC_GPO_ALL_EN.

Here is the call graph for this function:

◆ nfc_st25dv16kc_OnMailboxData()

__weak void nfc_st25dv16kc_OnMailboxData ( uint8_t * data,
uint16_t len )

Weak callback invoked by nfc_st25dv16kc_ProcessMailBox() when new data has arrived in the Mailbox. Override in main.c or application code to process the received message.

Parameters
dataPointer to received data buffer.
lenNumber of bytes received.

Definition at line 409 of file nfc_st25dv16kc.c.

Referenced by nfc_st25dv16kc_ProcessMailBox().

Here is the caller graph for this function:

◆ nfc_st25dv16kc_ProcessMailBox()

HAL_StatusTypeDef nfc_st25dv16kc_ProcessMailBox ( I2C_HandleTypeDef * hi2c)

Process incoming data from the RF Mailbox. Checks MB_CTRL_DYN for an RF message; if present reads it and invokes nfc_st25dv16kc_OnMailboxData().

Parameters
hi2cPointer to I2C handle.
Return values
HAL_OK– message read, HAL_ERROR – no message or NFC absent.

< User memory / EEPROM

< Mailbox control (dynamic)

< RF has written to mailbox

< User memory / EEPROM

< Mailbox message length (dyn)

< Mailbox buffer size in bytes

< Mailbox buffer size in bytes

< Mailbox buffer size in bytes

< User memory / EEPROM

< Mailbox RAM start (256 bytes)

Definition at line 348 of file nfc_st25dv16kc.c.

References _isNfc, nfc_st25dv16kc_OnMailboxData(), ST25DV16KC_I2C_ADDR_USER, ST25DV16KC_MB_RF_PUT_MSG, ST25DV16KC_MB_SIZE, ST25DV16KC_REG_MB_CTRL_DYN, ST25DV16KC_REG_MB_DATA, and ST25DV16KC_REG_MB_LEN_DYN.

Here is the call graph for this function:

◆ nfc_st25dv16kc_ReadEEPROM()

HAL_StatusTypeDef nfc_st25dv16kc_ReadEEPROM ( I2C_HandleTypeDef * hi2c,
uint16_t addr,
uint8_t * pData,
uint16_t len )

Read data from the EEPROM user memory.

Parameters
hi2cPointer to I2C handle.
addrStart address within EEPROM.
pDataPointer to destination buffer.
lenNumber of bytes to read.
Return values
HAL_OKon success, HAL_ERROR on failure or NFC absent.

< User memory / EEPROM

Definition at line 339 of file nfc_st25dv16kc.c.

References _isNfc, EEPROM_TIMEOUT, and ST25DV16KC_I2C_ADDR_USER.

◆ nfc_st25dv16kc_WriteEEPROM()

HAL_StatusTypeDef nfc_st25dv16kc_WriteEEPROM ( I2C_HandleTypeDef * hi2c,
uint16_t addr,
uint8_t * pData,
uint16_t len )

Write data to the EEPROM user memory (4-byte page writes).

Parameters
hi2cPointer to I2C handle.
addrStart address within EEPROM (0x0000–0x07FF for 16Kbit).
pDataPointer to data buffer to write.
lenNumber of bytes to write.
Return values
HAL_OKon success, HAL_ERROR on failure or NFC absent.

< User memory / EEPROM

Definition at line 288 of file nfc_st25dv16kc.c.

References _isNfc, EEPROM_TIMEOUT, HAL_Delay(), and ST25DV16KC_I2C_ADDR_USER.

Here is the call graph for this function:

◆ nfc_st25dv16kc_WriteMailBox()

HAL_StatusTypeDef nfc_st25dv16kc_WriteMailBox ( I2C_HandleTypeDef * hi2c,
uint8_t * pData,
uint16_t len )

Write raw data into the Mailbox so the RF reader (phone) can retrieve it.

Parameters
hi2cPointer to I2C handle.
pDataPointer to data buffer.
lenNumber of bytes to write (max ST25DV16KC_MB_SIZE).
Return values
HAL_OKon success, HAL_ERROR on failure or NFC absent.

< Mailbox buffer size in bytes

< Mailbox buffer size in bytes

< Enable mailbox

< User memory / EEPROM

< Mailbox control (dynamic)

< User memory / EEPROM

< Mailbox RAM start (256 bytes)

Definition at line 384 of file nfc_st25dv16kc.c.

References _isNfc, ST25DV16KC_I2C_ADDR_USER, ST25DV16KC_MB_EN, ST25DV16KC_MB_SIZE, ST25DV16KC_REG_MB_CTRL_DYN, and ST25DV16KC_REG_MB_DATA.