From 8f4ba94a6e78e4c7337fe1842956c549edcd5a2e Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 16 Apr 2021 22:14:14 +0200 Subject: [PATCH] sign-conversion fixes --- armsrc/iso15693.c | 6 +++--- armsrc/iso15693.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index 9ead4c117..42edf63e9 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -245,7 +245,7 @@ void CodeIso15693AsTag(uint8_t *cmd, size_t len) { ts->buf[++ts->max] = 0x1D; // 00011101 // data - for (int i = 0; i < len; i += 2) { + for (size_t i = 0; i < len; i += 2) { ts->buf[++ts->max] = encode_4bits[cmd[i] & 0xF]; ts->buf[++ts->max] = encode_4bits[cmd[i] >> 4]; ts->buf[++ts->max] = encode_4bits[cmd[i + 1] & 0xF]; @@ -515,7 +515,7 @@ static RAMFUNC int Handle15693SamplesFromTag(uint16_t amplitude, DecodeTag_t *ta tag->shiftReg |= 0x80; tag->bitCount++; if (tag->bitCount == 8) { - tag->output[tag->len] = tag->shiftReg; + tag->output[tag->len] = tag->shiftReg & 0xFF; tag->len++; if (tag->len > tag->max_len) { @@ -540,7 +540,7 @@ static RAMFUNC int Handle15693SamplesFromTag(uint16_t amplitude, DecodeTag_t *ta tag->bitCount++; if (tag->bitCount == 8) { - tag->output[tag->len] = tag->shiftReg; + tag->output[tag->len] = (tag->shiftReg & 0xFF); tag->len++; if (tag->len > tag->max_len) { diff --git a/armsrc/iso15693.h b/armsrc/iso15693.h index 168cee42c..29909dfc2 100644 --- a/armsrc/iso15693.h +++ b/armsrc/iso15693.h @@ -39,7 +39,6 @@ void ReaderIso15693(uint32_t parameter); // Simulate an ISO15693 reader - greg void SimTagIso15693(uint8_t *uid); // simulate an ISO15693 tag - greg void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox void DirectTag15693Command(uint32_t datalen, uint32_t speed, uint32_t recv, uint8_t *data); // send arbitrary commands from CLI - atrox -void Iso15693InitReader(void); void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string);