mirror of
https://github.com/RfidResearchGroup/ChameleonMini.git
synced 2026-05-12 11:20:37 -07:00
Additional reader mode ifdefs
This commit is contained in:
@@ -505,10 +505,14 @@ void ConfigurationSetById(ConfigurationEnum Configuration) {
|
||||
&ConfigurationTable[Configuration], sizeof(ConfigurationType));
|
||||
|
||||
// Configure antenna load as appropriate
|
||||
#ifdef CONFIG_ISO14443A_READER_SUPPORT
|
||||
if (Configuration == CONFIG_ISO14443A_READER)
|
||||
PORTC.OUTCLR = PIN7_bm;
|
||||
else
|
||||
PORTC.OUTSET = PIN7_bm;
|
||||
#else
|
||||
PORTC.OUTSET = PIN7_bm;
|
||||
#endif
|
||||
|
||||
CodecInit();
|
||||
ApplicationInit();
|
||||
@@ -523,7 +527,11 @@ bool ConfigurationSetByName(const char *Configuration) {
|
||||
|
||||
if (MapTextToId(ConfigurationMap, ARRAY_COUNT(ConfigurationMap), Configuration, &Id)) {
|
||||
// The last configuration can only be configured as a reader
|
||||
#ifdef CONFIG_ISO14443A_READER_SUPPORT
|
||||
if (GlobalSettings.ActiveSettingIdx >= SETTINGS_COUNT && Id != CONFIG_ISO14443A_READER) {
|
||||
#else
|
||||
if (GlobalSettings.ActiveSettingIdx >= SETTINGS_COUNT) {
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
ConfigurationSetById(Id);
|
||||
|
||||
@@ -172,10 +172,15 @@ INLINE void FRAMWrite(const void *Buffer, uint16_t Address, uint16_t ByteCount)
|
||||
SPIWriteBlock(Buffer, ByteCount);
|
||||
|
||||
FRAM_PORT.OUTSET = FRAM_CS;
|
||||
|
||||
#ifdef CONFIG_ISO14443A_READER_SUPPORT
|
||||
if (0 == Address && GlobalSettings.ActiveSettingPtr->Configuration != CONFIG_ISO14443A_READER) {
|
||||
ConfigurationSetById(GlobalSettings.ActiveSettingPtr->Configuration);
|
||||
}
|
||||
#else
|
||||
if (0 == Address) {
|
||||
ConfigurationSetById(GlobalSettings.ActiveSettingPtr->Configuration);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
INLINE void FlashRead(void *Buffer, uint32_t Address, uint16_t ByteCount) {
|
||||
@@ -421,8 +426,10 @@ void MemoryRecall(void) {
|
||||
if (GlobalSettings.ActiveSettingIdx < SETTINGS_COUNT)
|
||||
FlashToFRAM((uint32_t) GlobalSettings.ActiveSettingIdx * MEMORY_SIZE_PER_SETTING, ActiveConfiguration.MemorySize);
|
||||
|
||||
#ifdef CONFIG_ISO14443A_READER_SUPPORT
|
||||
if (GlobalSettings.ActiveSettingPtr->Configuration != CONFIG_ISO14443A_READER)
|
||||
ActiveConfiguration.ApplicationInitFunc();
|
||||
#endif
|
||||
|
||||
SystemTickClearFlag();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,9 @@ SettingsType EEMEM StoredSettings = {
|
||||
.PendingTaskTimeout = DEFAULT_PENDING_TASK_TIMEOUT,
|
||||
.ReaderThreshold = DEFAULT_READER_THRESHOLD,
|
||||
.bSakMode = 0,
|
||||
},
|
||||
}
|
||||
#ifdef CONFIG_ISO14443A_READER_SUPPORT
|
||||
,
|
||||
// In the last configuration, there is no storage space. This is used as the card reader mode only
|
||||
[SETTINGS_COUNT] =
|
||||
{
|
||||
@@ -55,6 +57,7 @@ SettingsType EEMEM StoredSettings = {
|
||||
.ReaderThreshold = DEFAULT_READER_THRESHOLD,
|
||||
.bSakMode = 0,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -77,7 +80,9 @@ void SettingsLoad(void) {
|
||||
GlobalSettings.Settings[i].PendingTaskTimeout = DEFAULT_PENDING_TASK_TIMEOUT;
|
||||
GlobalSettings.Settings[i].ReaderThreshold = DEFAULT_READER_THRESHOLD;
|
||||
}
|
||||
#ifdef CONFIG_ISO14443A_READER_SUPPORT
|
||||
GlobalSettings.Settings[SETTINGS_COUNT].Configuration = CONFIG_ISO14443A_READER;
|
||||
#endif
|
||||
|
||||
SettingsSave();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user