L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
nfc_st25r3.h
Go to the documentation of this file.
1/*
2 * nfc_st25r3.h
3 *
4 * Created on: 27. 12. 2025
5 * Author: Milan
6 *
7 * NFC 4 tag click, ST25R3916.pdf https://download.mikroe.com/documents/datasheets/ST25R3916%20Datasheet.pdf
8 * nfc - write and read via EEPROM, via mail box it doesn't work, so for now it makes no sense to activate via INT to avoid unnecessary consumption
9 * password default is 8x 0h
10 *
11 * EEPROM works....
12 *
13 *
14 * but MailBox doesn't work - I can't read and write to MailBox.
15 * I tried it via ChatGPT and Gemini, but couldn't transfer data, so it probably makes no sense. RF is static anyway
16 *
17 * It's not entirely clear yet how it will work
18 *
19 */
20
21#if KOKOT
22
23#ifndef INC_NFC_ST25R3_H_
24#define INC_NFC_ST25R3_H_
25
26#include "stm32wlxx_hal.h"
27
28
29/**
30 * @brief Check whether an RF field is currently active (phone/reader present).
31 * Reads the EH_CTRL_DYN register and tests the FIELD_ON bit (bit 2).
32 * Use this before calling nfc_st25r3_WriteEEPROM() if the caller needs
33 * to know upfront whether RF activity is in progress.
34 * @param hi2c Pointer to I2C handle.
35 * @retval 1 – RF field detected (busy), 0 – no RF field or NFC not available.
36 */
37int8_t nfc_st25r3_IsRFBusy(I2C_HandleTypeDef *hi2c);
38
39/**
40 * @brief - check if nfc4 tag sensor is present
41 * @param tryInit - in case sensor is not yet initialized, 1 - attempt to initialize again, 0 - no
42 * @retval 1 - is present, 0 - is not
43 */
44int8_t nfc_st25r3_Is(I2C_HandleTypeDef *hi2c, int8_t tryInit);
45
46/**
47 * @brief initializacia nfc
48 */
49HAL_StatusTypeDef nfc_st25r3_Init(I2C_HandleTypeDef *hi2c);
50
51/**
52 * @brief Reset the entire EEPROM by writing 0xFF to all bytes up to len.
53 * @param hi2c Pointer to I2C handle.
54 * @param len Number of bytes to reset (typically the full EEPROM size).
55 */
56void nfc_st25r3_ResetEEPROM(I2C_HandleTypeDef *hi2c, uint16_t len);
57
58/**
59 * @brief Write to address
60 */
61HAL_StatusTypeDef nfc_st25r3_WriteEEPROM(I2C_HandleTypeDef *hi2c, uint16_t addr, uint8_t *pData, uint16_t len);
62
63/**
64 * @brief Read from EEPROM
65 */
66HAL_StatusTypeDef nfc_st25r3_ReadEEPROM(I2C_HandleTypeDef *hi2c, uint16_t addr, uint8_t *pData, uint16_t len);
67
68/**
69 * @brief get state
70 */
71HAL_StatusTypeDef nfc_st25r3_IsOn(I2C_HandleTypeDef *hi2c, uint8_t *onOff);
72
73/**
74 * @brief Turn on sensor for sending INT that NFC was activated. Increases consumption. Not necessary, reads via EEPROM anyway
75 * I don't see why this would make sense
76 */
77HAL_StatusTypeDef nfc_st25r3_On(I2C_HandleTypeDef *hi2c);
78
79/**
80 * @brief turn off GPO_EN
81 */
82HAL_StatusTypeDef nfc_st25r3_Off(I2C_HandleTypeDef *hi2c);
83
84
85/*
86 * MailBox doesn't work.... so giving up on these....
87 */
88
89HAL_StatusTypeDef nfc_st25r3_ProcessMailBox(I2C_HandleTypeDef *hi2c);
90HAL_StatusTypeDef nfc_st25r3_WriteMailBoxNDEF(I2C_HandleTypeDef *hi2c, char *text);
91HAL_StatusTypeDef nfc_st25r3_SetRFMgmt(I2C_HandleTypeDef *hi2c, uint8_t enable);
92
93// Weak callback for main.c
94__weak void nfc_st25r3_OnMailboxData(uint8_t *data, uint16_t len);
95
96
97
98#endif /* INC_NFC_ST25R3_H_ */
99#endif
void nfc_st25r3_OnMailboxData(uint8_t *data, uint16_t len)
Definition mymems.c:303