1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-13 13:09:49 +04:00

[FL-3666] NFC API improvements (#3214)

* drivers: expose st25r3916 driver API
* nfc poller: add start with custom callback
* mf classic: rework sync API with poller custom start
* mf ultralight: rework sync API with poller custom start
* iso14443_3a poller: remove unused col res state
* nfc: rework nfc poller custom start
* mf ultralight: rename sync API
* mf classic: rename sync API
* iso14443-3a: rename sync API
* nfc: remove async prefix in internal functions
* nfc: expose internal API
* nfc: fix sync api include and docs
* targets: fix f18 build
* nfc: rework NfcGenericEventEx type
* nfc poller: add documentation
* iso14443-3a poller: add documentation
* felica poller: add documentation
* iso14443_3b poller: add documentation
* so14443_4a poller: add documentation
* iso14443_4b poller: add documentation
* iso15693 poller: add documentation
* slix poller: add documentation
* mf desfire poller: add documentation
* mf ultralight poller: fix API and add documentation
* mf classic poller: add documentation

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2023-11-15 12:32:45 +04:00
committed by GitHub
parent d0b9a3a4ae
commit c00776ca22
62 changed files with 1708 additions and 719 deletions

View File

@@ -26,6 +26,31 @@ extern "C" {
*/
typedef struct NfcPoller NfcPoller;
/**
* @brief Extended generic Nfc event type.
*
* An extended generic Nfc event contains protocol poller and it's parent protocol event data.
* If protocol has no parent, then events are produced by Nfc instance.
*
* The parent_event_data field is protocol-specific and should be cast to the appropriate type before use.
*/
typedef struct {
NfcGenericInstance* poller; /**< Pointer to the protocol poller. */
NfcGenericEventData*
parent_event_data /**< Pointer to the protocol's parent poller event data. */;
} NfcGenericEventEx;
/**
* @brief Extended generic Nfc event callback type.
*
* A function of this type must be passed as the callback parameter upon extended start of a poller.
*
* @param [in] event Nfc extended generic event, passed by value, complete with protocol type and data.
* @param [in,out] context pointer to the user-specific context (set when starting a poller/listener instance).
* @returns the command which the event producer must execute.
*/
typedef NfcCommand (*NfcGenericCallbackEx)(NfcGenericEventEx event, void* context);
/**
* @brief Allocate an NfcPoller instance.
*
@@ -57,6 +82,18 @@ void nfc_poller_free(NfcPoller* instance);
*/
void nfc_poller_start(NfcPoller* instance, NfcGenericCallback callback, void* context);
/**
* @brief Start an NfcPoller instance in extended mode.
*
* When nfc poller is started in extended mode, callback will be called with parent protocol events
* and protocol instance. This mode enables to make custom poller state machines.
*
* @param[in,out] instance pointer to the instance to be started.
* @param[in] callback pointer to a user-defined callback function which will receive events.
* @param[in] context pointer to a user-specific context (will be passed to the callback).
*/
void nfc_poller_start_ex(NfcPoller* instance, NfcGenericCallbackEx callback, void* context);
/**
* @brief Stop an NfcPoller instance.
*