mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-12 23:48:10 -07:00
Merge pull request #571 from DarkFlippers/nfc_mfclassic_custom_uid
NFC App: Add manual MF Classic custom UID
This commit is contained in:
@@ -333,14 +333,22 @@ static void nfc_generate_ntag_i2c_plus_2k(NfcDeviceData* data) {
|
||||
mful->version.storage_size = 0x15;
|
||||
}
|
||||
|
||||
void nfc_generate_mf_classic(NfcDeviceData* data, uint8_t uid_len, MfClassicType type) {
|
||||
void nfc_generate_mf_classic_ext(
|
||||
NfcDeviceData* data,
|
||||
uint8_t uid_len,
|
||||
MfClassicType type,
|
||||
bool random_uid,
|
||||
uint8_t* uid) {
|
||||
nfc_generate_common_start(data);
|
||||
nfc_generate_mf_classic_uid(data->mf_classic_data.block[0].value, uid_len);
|
||||
if(random_uid) {
|
||||
nfc_generate_mf_classic_uid(data->mf_classic_data.block[0].value, uid_len);
|
||||
} else {
|
||||
memcpy(data->mf_classic_data.block[0].value, uid, uid_len);
|
||||
}
|
||||
nfc_generate_mf_classic_common(data, uid_len, type);
|
||||
|
||||
// Set the UID
|
||||
data->nfc_data.uid[0] = NXP_MANUFACTURER_ID;
|
||||
for(int i = 1; i < uid_len; i++) {
|
||||
for(int i = 0; i < uid_len; i++) {
|
||||
data->nfc_data.uid[i] = data->mf_classic_data.block[0].value[i];
|
||||
}
|
||||
|
||||
@@ -395,6 +403,11 @@ void nfc_generate_mf_classic(NfcDeviceData* data, uint8_t uid_len, MfClassicType
|
||||
mfc->type = type;
|
||||
}
|
||||
|
||||
void nfc_generate_mf_classic(NfcDeviceData* data, uint8_t uid_len, MfClassicType type) {
|
||||
uint8_t uid = 0;
|
||||
nfc_generate_mf_classic_ext(data, uid_len, type, true, &uid);
|
||||
}
|
||||
|
||||
static void nfc_generate_mf_mini(NfcDeviceData* data) {
|
||||
nfc_generate_mf_classic(data, 4, MfClassicTypeMini);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
#include "../nfc_device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*NfcGeneratorFunc)(NfcDeviceData* data);
|
||||
|
||||
typedef struct {
|
||||
@@ -12,3 +16,14 @@ typedef struct {
|
||||
extern const NfcGenerator* const nfc_generators[];
|
||||
|
||||
void nfc_generate_mf_classic(NfcDeviceData* data, uint8_t uid_len, MfClassicType type);
|
||||
|
||||
void nfc_generate_mf_classic_ext(
|
||||
NfcDeviceData* data,
|
||||
uint8_t uid_len,
|
||||
MfClassicType type,
|
||||
bool random_uid,
|
||||
uint8_t* uid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user