First attempt at detecting D-Star data frames, Kenwood and Icom.

This commit is contained in:
Jonathan Naylor
2018-11-12 11:57:34 +00:00
parent 34eb69dede
commit 3362e29b62
4 changed files with 140 additions and 44 deletions

View File

@@ -144,3 +144,22 @@ void CUtils::bitsToByteLE(const bool* bits, unsigned char& byte)
byte |= bits[6U] ? 0x40U : 0x00U;
byte |= bits[7U] ? 0x80U : 0x00U;
}
unsigned int CUtils::compare(const unsigned char* bytes1, const unsigned char* bytes2, unsigned int length)
{
assert(bytes1 != NULL);
assert(bytes2 != NULL);
unsigned int diffs = 0U;
for (unsigned int i = 0U; i < length; i++) {
unsigned char v = bytes1[i] ^ bytes2[i];
while (v != 0U) {
v &= v - 1U;
diffs++;
}
}
return diffs;
}