chg: parameter adjustments

This commit is contained in:
iceman1001 2018-01-28 12:42:17 +01:00
parent fd854a9308
commit 0c827e755f
2 changed files with 7 additions and 6 deletions

View file

@ -72,22 +72,22 @@ char* Iso15693sprintUID(char *target, uint8_t *uid) {
return target;
}
uint16_t iclass_crc16(char *data_p, unsigned short length) {
unsigned char i;
uint16_t iclass_crc16(uint8_t *d, uint16_t n) {
unsigned int data;
uint16_t crc = 0xffff;
if (length == 0)
if (n == 0)
return (~crc);
do {
for (i=0, data = (unsigned int)0xff & *data_p++; i < 8; i++, data >>= 1) {
for (uint8_t i=0, data = *d++; i < 8; i++, data >>= 1) {
if ((crc & 0x0001) ^ (data & 0x0001))
crc = (crc >> 1) ^ POLY;
else
crc >>= 1;
}
} while (--length);
} while (--n);
crc = ~crc;
data = crc;

View file

@ -78,7 +78,8 @@ uint16_t Iso15693Crc(uint8_t *v, int n);
int Iso15693AddCrc(uint8_t *req, int n);
bool Iso15693CheckCrc(uint8_t *d, int n);
char* Iso15693sprintUID(char *target,uint8_t *uid);
unsigned short iclass_crc16(char *data_p, unsigned short length);
uint16_t iclass_crc16(uint8_t *d, uint16_t n);
//-----------------------------------------------------------------------------
// Map a sequence of octets (~layer 2 command) into the set of bits to feed