From 96ff627f48382f65fdc6a7f3036ce471cdd4f8e5 Mon Sep 17 00:00:00 2001 From: slaenger <55430878+slaenger@users.noreply.github.com> Date: Tue, 17 Sep 2019 10:25:14 +0200 Subject: [PATCH] Added Mifare Ultralight C support. Changed SettingsSetActiveById() to first MemoryRecall() before initializing Application. --- Firmware/Chameleon-Mini/Configuration.c | 17 +++++++++++++++++ Firmware/Chameleon-Mini/Configuration.h | 1 + Firmware/Chameleon-Mini/Settings.c | 5 +++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Firmware/Chameleon-Mini/Configuration.c b/Firmware/Chameleon-Mini/Configuration.c index cefa5f3..159e036 100644 --- a/Firmware/Chameleon-Mini/Configuration.c +++ b/Firmware/Chameleon-Mini/Configuration.c @@ -18,6 +18,7 @@ static const MapEntryType PROGMEM ConfigurationMap[] = { { .Id = CONFIG_MF_ULTRALIGHT, .Text = "MF_ULTRALIGHT" }, { .Id = CONFIG_MF_ULTRALIGHT_EV1_80B, .Text = "MF_ULTRALIGHT_EV1_80B" }, { .Id = CONFIG_MF_ULTRALIGHT_EV1_164B, .Text = "MF_ULTRALIGHT_EV1_164B" }, + {.Id = CONFIG_MF_ULTRALIGHT_C, .Text = "MF_ULTRALIGHT_C"}, #endif #ifdef CONFIG_MF_CLASSIC_MINI_4B_SUPPORT { .Id = CONFIG_MF_CLASSIC_MINI_4B, .Text = "MF_CLASSIC_MINI_4B" }, @@ -107,6 +108,22 @@ static const PROGMEM ConfigurationType ConfigurationTable[] = { .ReadOnly = false, .TagFamily = TAG_FAMILY_ISO14443A }, + [CONFIG_MF_ULTRALIGHT_C] ={ + .CodecInitFunc = ISO14443ACodecInit, + .CodecDeInitFunc = ISO14443ACodecDeInit, + .CodecTaskFunc = ISO14443ACodecTask, + .ApplicationInitFunc = MifareUltralightCAppInit, + .ApplicationResetFunc = MifareUltralightCAppReset, + .ApplicationTaskFunc = MifareUltralightAppTask, + .ApplicationTickFunc = ApplicationTickDummy, + .ApplicationProcessFunc = MifareUltralightAppProcess, + .ApplicationGetUidFunc = MifareUltralightGetUid, + .ApplicationSetUidFunc = MifareUltralightSetUid, + .UidSize = MIFARE_ULTRALIGHT_UID_SIZE, + .MemorySize = MIFARE_ULTRALIGHTC_MEM_SIZE, + .ReadOnly = false, + .TagFamily = TAG_FAMILY_ISO14443A + }, [CONFIG_MF_ULTRALIGHT_EV1_80B] = { .CodecInitFunc = ISO14443ACodecInit, .CodecDeInitFunc = ISO14443ACodecDeInit, diff --git a/Firmware/Chameleon-Mini/Configuration.h b/Firmware/Chameleon-Mini/Configuration.h index 230f8e7..7ab8540 100644 --- a/Firmware/Chameleon-Mini/Configuration.h +++ b/Firmware/Chameleon-Mini/Configuration.h @@ -22,6 +22,7 @@ typedef enum { #ifdef CONFIG_MF_ULTRALIGHT_SUPPORT CONFIG_MF_ULTRALIGHT, + CONFIG_MF_ULTRALIGHT_C, CONFIG_MF_ULTRALIGHT_EV1_80B, CONFIG_MF_ULTRALIGHT_EV1_164B, #endif diff --git a/Firmware/Chameleon-Mini/Settings.c b/Firmware/Chameleon-Mini/Settings.c index 5ea9174..767e06d 100644 --- a/Firmware/Chameleon-Mini/Settings.c +++ b/Firmware/Chameleon-Mini/Settings.c @@ -72,12 +72,13 @@ bool SettingsSetActiveById(uint8_t Setting) { GlobalSettings.ActiveSettingPtr = &GlobalSettings.Settings[SettingIdx]; + /* Recall new memory contents ( Moved this to allow for Access to new Memory in Application init())*/ + MemoryRecall(); + /* Settings have changed. Progress changes through system */ ConfigurationSetById(GlobalSettings.ActiveSettingPtr->Configuration); LogSetModeById(GlobalSettings.ActiveSettingPtr->LogMode); - /* Recall new memory contents */ - MemoryRecall(); SETTING_UPDATE(GlobalSettings.ActiveSettingIdx); SETTING_UPDATE(GlobalSettings.ActiveSettingPtr);