Loading...
Searching...
No Matches
st25tb.h
1#pragma once
2
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ST25TB_UID_SIZE (8U)
10
11//#define ST25TB_FDT_FC (4205U)
12#define ST25TB_FDT_FC (8494U)
13#define ST25TB_GUARD_TIME_US (5000U)
14#define ST25TB_POLL_POLL_MIN_US (1280U)
15
16#define ST25TB_MAX_BLOCKS (128U)
17#define ST25TB_SYSTEM_OTP_BLOCK (0xFFU)
18#define ST25TB_BLOCK_SIZE (4U)
19
20typedef enum {
21 St25tbErrorNone,
22 St25tbErrorNotPresent,
23 St25tbErrorColResFailed,
24 St25tbErrorBufferOverflow,
25 St25tbErrorCommunication,
26 St25tbErrorFieldOff,
27 St25tbErrorWrongCrc,
28 St25tbErrorTimeout,
29 St25tbErrorWriteFailed,
30} St25tbError;
31
32typedef enum {
33 St25tbType512At,
34 St25tbType512Ac,
35 St25tbTypeX512,
36 St25tbType02k,
37 St25tbType04k,
38 St25tbTypeX4k,
39 St25tbTypeNum,
40} St25tbType;
41
42typedef struct {
43 uint8_t uid[ST25TB_UID_SIZE];
44 St25tbType type;
45 uint32_t blocks[ST25TB_MAX_BLOCKS];
46 uint32_t system_otp_block;
48
49extern const NfcDeviceBase nfc_device_st25tb;
50
51St25tbData* st25tb_alloc(void);
52
53void st25tb_free(St25tbData* data);
54
55void st25tb_reset(St25tbData* data);
56
57void st25tb_copy(St25tbData* data, const St25tbData* other);
58
59bool st25tb_verify(St25tbData* data, const FuriString* device_type);
60
61bool st25tb_load(St25tbData* data, FlipperFormat* ff, uint32_t version);
62
63bool st25tb_save(const St25tbData* data, FlipperFormat* ff);
64
65bool st25tb_is_equal(const St25tbData* data, const St25tbData* other);
66
67uint8_t st25tb_get_block_count(St25tbType type);
68
69const char* st25tb_get_device_name(const St25tbData* data, NfcDeviceNameType name_type);
70
71const uint8_t* st25tb_get_uid(const St25tbData* data, size_t* uid_len);
72
73bool st25tb_set_uid(St25tbData* data, const uint8_t* uid, size_t uid_len);
74
75St25tbData* st25tb_get_base_data(const St25tbData* data);
76
77St25tbType st25tb_get_type_from_uid(const uint8_t* uid);
78
79#ifdef __cplusplus
80}
81#endif
NfcDeviceNameType
Verbosity level of the displayed NFC device name.
Definition nfc_device_base.h:14
Abstract interface definitions for the NFC device system.
Definition flipper_format.c:12
Definition string.c:4
Generic NFC device interface.
Definition nfc_device_base_i.h:142
Definition st25tb.h:42