Running NFC Transceive

This commit is contained in:
TheJoKlLa 2022-10-31 16:36:11 +01:00
parent 2e9b11afc4
commit 23527a674a

View File

@ -100,6 +100,11 @@ bool NFC::testCard()
MFRC522::StatusCode NFC::Transceive(byte* command, byte command_len, byte* response, byte* response_len)
{
if(command_len >= 0xFF - 4)
{
return MFRC522::STATUS_NO_ROOM;
}
MFRC522::StatusCode state;
byte request_buffer[APDU_BUFFER_SIZE + 4]; // APDU Size + PCB + CID + 2x CRC
byte request_buffer_size = command_len + 4;
@ -122,8 +127,8 @@ MFRC522::StatusCode NFC::Transceive(byte* command, byte command_len, byte* respo
return state;
}
byte response_buffer[APDU_BUFFER_SIZE + 4]; // APDU Size + PCB + CID + 2x CRC
byte response_buffer_size;
byte response_buffer[APDU_BUFFER_SIZE + 4] = {0}; // APDU Size + PCB + CID + 2x CRC
byte response_buffer_size = 0xFF;
printbytes(request_buffer, request_buffer_size);
state = rfid->PCD_TransceiveData(request_buffer, request_buffer_size, response_buffer, &response_buffer_size);