mirror of
https://github.com/RfidResearchGroup/ChameleonMini.git
synced 2026-05-12 11:20:37 -07:00
Reverse the UID before sending or saving it (Thanks @m2otech). Fixed a double define on the same constant
This commit is contained in:
committed by
Thorsten Bosbach
parent
be48e0b751
commit
c9f0408917
@@ -69,7 +69,7 @@ uint16_t TITagitstandardAppProcess(uint8_t* FrameBuf, uint16_t FrameBytes)
|
||||
uint8_t Uid[8];
|
||||
|
||||
//MemoryReadBlock(actualTagIt, 0, 44); // read the whole tag from FRAM
|
||||
MemoryReadBlock(Uid, MEM_UID_ADDRESS, ActiveConfiguration.UidSize);
|
||||
TITagitstandardGetUid(Uid);
|
||||
|
||||
//for (j==0 ; j < ActiveConfiguration.UidSize; j++) Uid[j] = actualTagIt[MEM_UID_ADDRESS + j] ;
|
||||
|
||||
@@ -174,9 +174,25 @@ uint16_t TITagitstandardAppProcess(uint8_t* FrameBuf, uint16_t FrameBytes)
|
||||
void TITagitstandardGetUid(ConfigurationUidType Uid)
|
||||
{
|
||||
MemoryReadBlock(&Uid[0], MEM_UID_ADDRESS, ActiveConfiguration.UidSize);
|
||||
|
||||
// Reverse UID after reading it
|
||||
uint8_t* UidTemp = calloc(ActiveConfiguration.UidSize, sizeof(UidTemp));
|
||||
int i;
|
||||
for (i = 0; i < ActiveConfiguration.UidSize; i++)
|
||||
UidTemp[i] = Uid[i];
|
||||
for (i = 0; i < ActiveConfiguration.UidSize; i++)
|
||||
Uid[i] = UidTemp[ActiveConfiguration.UidSize - i - 1];
|
||||
}
|
||||
|
||||
void TITagitstandardSetUid(ConfigurationUidType Uid)
|
||||
{
|
||||
// Reverse UID before writing it
|
||||
uint8_t* UidTemp = calloc(ActiveConfiguration.UidSize, sizeof(UidTemp));
|
||||
int i;
|
||||
for (i = 0; i < ActiveConfiguration.UidSize; i++)
|
||||
UidTemp[i] = Uid[i];
|
||||
for (i = 0; i < ActiveConfiguration.UidSize; i++)
|
||||
Uid[i] = UidTemp[ActiveConfiguration.UidSize - i - 1];
|
||||
|
||||
MemoryWriteBlock(Uid, MEM_UID_ADDRESS, ActiveConfiguration.UidSize);
|
||||
}
|
||||
@@ -12,8 +12,8 @@
|
||||
#include "Application.h"
|
||||
#include "ISO15693-A.h"
|
||||
|
||||
#define ISO15693_GENERIC_UID_SIZE 8 //ISO15693_UID_SIZE
|
||||
#define ISO15693_GENERIC_MEM_SIZE 44 //TAG-IT STANDARD MAX MEM SIZE
|
||||
#define TITAGIT_STD_UID_SIZE ISO15693_GENERIC_UID_SIZE //ISO15693_UID_SIZE
|
||||
#define TITAGIT_STD_MEM_SIZE 44 //TAG-IT STANDARD MAX MEM SIZE
|
||||
|
||||
void TITagitstandardAppInit(void);
|
||||
void TITagitstandardAppReset(void);
|
||||
|
||||
@@ -297,8 +297,8 @@ static const PROGMEM ConfigurationType ConfigurationTable[] = {
|
||||
.ApplicationProcessFunc = TITagitstandardAppProcess,
|
||||
.ApplicationGetUidFunc = TITagitstandardGetUid,
|
||||
.ApplicationSetUidFunc = TITagitstandardSetUid,
|
||||
.UidSize = ISO15693_GENERIC_UID_SIZE,
|
||||
.MemorySize = ISO15693_GENERIC_MEM_SIZE,
|
||||
.UidSize = TITAGIT_STD_UID_SIZE,
|
||||
.MemorySize = TITAGIT_STD_MEM_SIZE,
|
||||
.ReadOnly = false
|
||||
},
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user