NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "st25tb_poller.h"
|
|
|
|
|
2023-12-01 09:42:00 +00:00
|
|
|
#include <nfc/nfc_poller.h>
|
|
|
|
|
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define ST25TB_POLLER_MAX_BUFFER_SIZE (16U)
|
|
|
|
|
|
|
|
typedef enum {
|
2023-12-01 09:42:00 +00:00
|
|
|
St25tbPollerStateSelect,
|
|
|
|
St25tbPollerStateRequestMode,
|
|
|
|
St25tbPollerStateRead,
|
|
|
|
St25tbPollerStateWrite,
|
|
|
|
St25tbPollerStateSuccess,
|
|
|
|
St25tbPollerStateFailure,
|
|
|
|
|
|
|
|
St25tbPollerStateNum,
|
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
} St25tbPollerState;
|
|
|
|
|
2023-12-01 09:42:00 +00:00
|
|
|
typedef struct {
|
|
|
|
uint8_t current_block;
|
|
|
|
} St25tbPollerReadContext;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t block_number;
|
|
|
|
uint32_t block_data;
|
|
|
|
} St25tbPollerWriteContext;
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
St25tbPollerReadContext read;
|
|
|
|
St25tbPollerWriteContext write;
|
|
|
|
} St25tbPollerContext;
|
|
|
|
|
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
struct St25tbPoller {
|
|
|
|
Nfc* nfc;
|
|
|
|
St25tbPollerState state;
|
|
|
|
St25tbData* data;
|
|
|
|
BitBuffer* tx_buffer;
|
|
|
|
BitBuffer* rx_buffer;
|
|
|
|
|
2023-12-01 09:42:00 +00:00
|
|
|
St25tbPollerContext poller_ctx;
|
|
|
|
|
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.
Starring:
- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer
Supporting roles:
- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance
Special thanks:
@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 03:08:09 +00:00
|
|
|
NfcGenericEvent general_event;
|
|
|
|
St25tbPollerEvent st25tb_event;
|
|
|
|
St25tbPollerEventData st25tb_event_data;
|
|
|
|
NfcGenericCallback callback;
|
|
|
|
void* context;
|
|
|
|
};
|
|
|
|
|
|
|
|
const St25tbData* st25tb_poller_get_data(St25tbPoller* instance);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|