Skip to content

Commit

Permalink
feat: added cardemu functions to test sketch
Browse files Browse the repository at this point in the history
  • Loading branch information
REGIOIGER committed Nov 15, 2024
1 parent 1e9b057 commit 6a18bbe
Showing 1 changed file with 65 additions and 1 deletion.
66 changes: 65 additions & 1 deletion dev/test_nci2_pn7160_settings/test_nci2_pn7160_settings.ino
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,69 @@ void printBuffer(uint8_t *buffer, uint16_t length) {
}
Serial.println(); // Nueva línea al final de la impresión del búfer
}

static void NxpNci_FillInterfaceInfo(NxpNci_RfIntf_t* pRfIntf, uint8_t* pBuf)
{
uint8_t i, temp;

switch(pRfIntf->ModeTech)
{
case (MODE_POLL | TECH_PASSIVE_NFCA):
memcpy(pRfIntf->Info.NFC_APP.SensRes, &pBuf[0], 2);
temp = 2;
pRfIntf->Info.NFC_APP.NfcIdLen = pBuf[temp];
temp++;
memcpy(pRfIntf->Info.NFC_APP.NfcId, &pBuf[3], pRfIntf->Info.NFC_APP.NfcIdLen);
temp+=pBuf[2];
pRfIntf->Info.NFC_APP.SelResLen = pBuf[temp];
temp++;
if(pRfIntf->Info.NFC_APP.SelResLen == 1) pRfIntf->Info.NFC_APP.SelRes[0] = pBuf[temp];
temp+=4;
if(pBuf[temp] != 0)
{
temp++;
pRfIntf->Info.NFC_APP.RatsLen = pBuf[temp];
memcpy(pRfIntf->Info.NFC_APP.Rats, &pBuf[temp+1], pBuf[temp]);
}
else
{
pRfIntf->Info.NFC_APP.RatsLen = 0;
}
break;

case (MODE_POLL | TECH_PASSIVE_NFCB):
pRfIntf->Info.NFC_BPP.SensResLen = pBuf[0];
memcpy(pRfIntf->Info.NFC_BPP.SensRes, &pBuf[1], pRfIntf->Info.NFC_BPP.SensResLen);
temp = pBuf[0] + 4;
if(pBuf[temp] != 0)
{
temp++;
pRfIntf->Info.NFC_BPP.AttribResLen = pBuf[temp];
memcpy(pRfIntf->Info.NFC_BPP.AttribRes, &pBuf[temp+1], pBuf[temp]);
}
else
{
pRfIntf->Info.NFC_BPP.AttribResLen = 0;
}
break;

case (MODE_POLL | TECH_PASSIVE_NFCF):
pRfIntf->Info.NFC_FPP.BitRate = pBuf[0];
pRfIntf->Info.NFC_FPP.SensResLen = pBuf[1];
memcpy(pRfIntf->Info.NFC_FPP.SensRes, &pBuf[2], pRfIntf->Info.NFC_FPP.SensResLen);
break;

case (MODE_POLL | TECH_PASSIVE_15693):
pRfIntf->Info.NFC_VPP.AFI = pBuf[0];
pRfIntf->Info.NFC_VPP.DSFID = pBuf[1];
for(i=0; i<8; i++) pRfIntf->Info.NFC_VPP.ID[7-i] = pBuf[2+i];
break;

default:
break;
}
}

bool NxpNci_ConfigureSettings(void)
{
uint8_t Answer[MAX_NCI_FRAME_SIZE];
Expand Down Expand Up @@ -295,10 +358,11 @@ bool NxpNci_ConfigureSettings(void)
#if NXP_RF_CONF
if (sizeof(NxpNci_RF_CONF) != 0)
{
Serial.println("HELL 0");
Serial.println("HELL 0");
isResetRequired = true;
NxpNci_HostTransceive(NxpNci_RF_CONF, sizeof(NxpNci_RF_CONF), Answer, sizeof(Answer), &AnswerSize);
if ((Answer[0] != 0x40) || (Answer[1] != 0x02) || (Answer[3] != 0x00) || (Answer[4] != 0x00)) return NXPNCI_ERROR;
Serial.println("¿SI PASÓ?");
}
#endif
/* Store curent timestamp to NFC Controller memory for further checks */
Expand Down

0 comments on commit 6a18bbe

Please sign in to comment.