Skip to content

Commit

Permalink
Merge pull request #114 from GMMan/ntag203-support
Browse files Browse the repository at this point in the history
Ntag203 support
  • Loading branch information
RogueMaster authored Jul 25, 2022
2 parents d8149b4 + 3a0cb87 commit 0c66c7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 1 addition & 6 deletions lib/nfc_protocols/mifare_ultralight.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,10 +1176,6 @@ void mf_ul_prepare_emulation(MfUltralightEmulator* emulator, MfUltralightData* d
memset(&emulator->auth_attempt, 0, sizeof(MfUltralightAuth));
emulator->comp_write_cmd_started = false;
emulator->sector_select_cmd_started = false;
if(emulator->data.type == MfUltralightTypeNTAG203) {
// Clear holding counter
emulator->data.counter[0] = 0;
}
mf_ul_reset_emulation(emulator, true);
}

Expand Down Expand Up @@ -1242,8 +1238,7 @@ bool mf_ul_prepare_emulation_response(
} else if(buff_rx_len >= 8) {
uint8_t cmd = buff_rx[0];
if(cmd == MF_UL_GET_VERSION_CMD) {
if(emulator->data.type != MfUltralightTypeUnknown &&
emulator->data.type != MfUltralightTypeNTAG203) {
if(emulator->data.type >= MfUltralightTypeUL11) {
if(buff_rx_len == 1 * 8) {
tx_bytes = sizeof(emulator->data.version);
memcpy(buff_tx, &emulator->data.version, tx_bytes);
Expand Down
5 changes: 5 additions & 0 deletions lib/nfc_protocols/mifare_ultralight.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,21 @@

#define MF_UL_NTAG203_COUNTER_PAGE (41)

// Important: order matters; some features are based on positioning in this enum
typedef enum {
MfUltralightTypeUnknown,
MfUltralightTypeNTAG203,
// Below have config pages and GET_VERSION support
MfUltralightTypeUL11,
MfUltralightTypeUL21,
MfUltralightTypeNTAG213,
MfUltralightTypeNTAG215,
MfUltralightTypeNTAG216,
// Below also have sector select
// NTAG I2C's *does not* have regular config pages, so it's a bit of an odd duck
MfUltralightTypeNTAGI2C1K,
MfUltralightTypeNTAGI2C2K,
// NTAG I2C Plus has stucture expected from NTAG21x
MfUltralightTypeNTAGI2CPlus1K,
MfUltralightTypeNTAGI2CPlus2K,

Expand Down

0 comments on commit 0c66c7f

Please sign in to comment.