unleashed-firmware/lib/nfc/protocols/felica/felica_poller_i.h
gornekich c00776ca22
[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>
2023-11-15 17:32:45 +09:00

59 lines
1.2 KiB
C

#pragma once
#include "felica_poller.h"
#include <toolbox/bit_buffer.h>
#ifdef __cplusplus
extern "C" {
#endif
#define FELICA_POLLER_MAX_BUFFER_SIZE (256U)
#define FELICA_POLLER_POLLING_FWT (200000U)
#define FELICA_POLLER_CMD_POLLING_REQ_CODE (0x00U)
#define FELICA_POLLER_CMD_POLLING_RESP_CODE (0x01U)
typedef enum {
FelicaPollerStateIdle,
FelicaPollerStateActivated,
} FelicaPollerState;
struct FelicaPoller {
Nfc* nfc;
FelicaPollerState state;
FelicaData* data;
BitBuffer* tx_buffer;
BitBuffer* rx_buffer;
NfcGenericEvent general_event;
FelicaPollerEvent felica_event;
FelicaPollerEventData felica_event_data;
NfcGenericCallback callback;
void* context;
};
typedef struct {
uint16_t system_code;
uint8_t request_code;
uint8_t time_slot;
} FelicaPollerPollingCommand;
typedef struct {
FelicaIDm idm;
FelicaPMm pmm;
uint8_t request_data[2];
} FelicaPollerPollingResponse;
const FelicaData* felica_poller_get_data(FelicaPoller* instance);
FelicaError felica_poller_polling(
FelicaPoller* instance,
const FelicaPollerPollingCommand* cmd,
FelicaPollerPollingResponse* resp);
#ifdef __cplusplus
}
#endif