mirror of
https://github.com/RfidResearchGroup/ChameleonMini.git
synced 2026-05-12 11:20:37 -07:00
Merge pull request #35 from dev-zzo/pr-const-crca
make CRCA checking const-correct
This commit is contained in:
@@ -52,9 +52,9 @@ void ISO14443AAppendCRCA(void* Buffer, uint16_t ByteCount)
|
||||
#endif
|
||||
|
||||
#ifdef USE_HW_CRC
|
||||
bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount)
|
||||
bool ISO14443ACheckCRCA(const void* Buffer, uint16_t ByteCount)
|
||||
{
|
||||
uint8_t* DataPtr = (uint8_t*) Buffer;
|
||||
const uint8_t* DataPtr = (const uint8_t*) Buffer;
|
||||
|
||||
CRC.CTRL = CRC_RESET0_bm;
|
||||
CRC.CHECKSUM1 = (CRC_INIT_R >> 8) & 0xFF;
|
||||
@@ -76,10 +76,10 @@ bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount)
|
||||
}
|
||||
#else
|
||||
#include <util/crc16.h>
|
||||
bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount)
|
||||
bool ISO14443ACheckCRCA(const void* Buffer, uint16_t ByteCount)
|
||||
{
|
||||
uint16_t Checksum = CRC_INIT;
|
||||
uint8_t* DataPtr = (uint8_t*) Buffer;
|
||||
const uint8_t* DataPtr = (const uint8_t*) Buffer;
|
||||
|
||||
while(ByteCount--) {
|
||||
uint8_t Byte = *DataPtr++;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
( ByteBuffer[0] ^ ByteBuffer[1] ^ ByteBuffer[2] ^ ByteBuffer[3] )
|
||||
|
||||
void ISO14443AAppendCRCA(void* Buffer, uint16_t ByteCount);
|
||||
bool ISO14443ACheckCRCA(void* Buffer, uint16_t ByteCount);
|
||||
bool ISO14443ACheckCRCA(const void* Buffer, uint16_t ByteCount);
|
||||
|
||||
INLINE bool ISO14443ASelect(void* Buffer, uint16_t* BitCount, uint8_t* UidCL, uint8_t SAKValue);
|
||||
INLINE bool ISO14443AWakeUp(void* Buffer, uint16_t* BitCount, uint16_t ATQAValue, bool FromHalt);
|
||||
|
||||
Reference in New Issue
Block a user