Edit formats

This commit is contained in:
md5sum-as 2022-10-28 01:24:22 +03:00
parent 0d22a16240
commit d152199aee

View File

@ -414,10 +414,11 @@ uint8_t mifareclassic_ReadDataBlock (uint8_t blockNumber, uint8_t *data) {
/* Copy the 16 data bytes to the output buffer */
/* Block content starts at byte 9 of a valid response */
memcpy (data, &Pn532.packetbuffer[1], 16);
return 1;
}
bool mifareclassic_WriteDataBlock (uint8_t blockNumber, uint8_t *data) {
uint8_t mifareclassic_WriteDataBlock (uint8_t blockNumber, uint8_t *data) {
/* Prepare the first command */
Pn532.packetbuffer[0] = PN532_COMMAND_INDATAEXCHANGE;
Pn532.packetbuffer[1] = 1; /* Card number */
@ -427,14 +428,11 @@ bool mifareclassic_WriteDataBlock (uint8_t blockNumber, uint8_t *data) {
/* Send the command */
if (PN532_writeCommand(Pn532.packetbuffer, 20)) {
return false;
}
/* Read the response packet */
if (PN532_readResponse(Pn532.packetbuffer, sizeof(Pn532.packetbuffer)) < 1) {
return false;
return 0;
}
return true;
/* Read the response packet */
return (0 < PN532_readResponse(Pn532.packetbuffer, sizeof(Pn532.packetbuffer)));
}
uint8_t ntag21x_probe (void) {