|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
#include "stm32wlxx_hal.h"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. | |
| 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).
| hi2c | Pointer to I2C handle. |
| 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().
| int8_t nfc_st25dv16kc_Is | ( | I2C_HandleTypeDef * | hi2c, |
| int8_t | tryInit ) |
Check whether the ST25DV16KC has been successfully initialised.
| hi2c | Pointer to I2C handle. |
| tryInit | When 1, attempt Init() if not yet initialised; 0 – no retry. |
| 1 | – NFC present and ready, 0 – not available. |
Definition at line 154 of file nfc_st25dv16kc.c.
References _isNfc, and nfc_st25dv16kc_Init().
| HAL_StatusTypeDef nfc_st25dv16kc_Off | ( | I2C_HandleTypeDef * | hi2c | ) |
Turn the NFC GPO OFF and enable GPO RF to achieve minimum current (~1 µA).
| hi2c | Pointer to I2C handle. |
| HAL_OK | on 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().
| 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.
| hi2c | Pointer to I2C handle. |
| HAL_OK | on 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.
| __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.
| data | Pointer to received data buffer. |
| len | Number of bytes received. |
Definition at line 409 of file nfc_st25dv16kc.c.
Referenced by 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().
| hi2c | Pointer to I2C handle. |
| 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.
| HAL_StatusTypeDef nfc_st25dv16kc_ReadEEPROM | ( | I2C_HandleTypeDef * | hi2c, |
| uint16_t | addr, | ||
| uint8_t * | pData, | ||
| uint16_t | len ) |
Read data from the EEPROM user memory.
| hi2c | Pointer to I2C handle. |
| addr | Start address within EEPROM. |
| pData | Pointer to destination buffer. |
| len | Number of bytes to read. |
| HAL_OK | on 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.
| 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).
| hi2c | Pointer to I2C handle. |
| addr | Start address within EEPROM (0x0000–0x07FF for 16Kbit). |
| pData | Pointer to data buffer to write. |
| len | Number of bytes to write. |
| HAL_OK | on 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.
| 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.
| hi2c | Pointer to I2C handle. |
| pData | Pointer to data buffer. |
| len | Number of bytes to write (max ST25DV16KC_MB_SIZE). |
| HAL_OK | on 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.