Merge pull request #219 from brunob45/dev/teensyfix
Fix teensy compilation errors and CRC32 calculation
This commit is contained in:
commit
85bdf4181a
|
@ -382,10 +382,11 @@ FastCRC32::FastCRC32(){
|
|||
* @param datalen Length of Data
|
||||
* @return CRC value
|
||||
*/
|
||||
uint32_t FastCRC32::crc32(const uint8_t *data, const uint16_t datalen)
|
||||
uint32_t FastCRC32::crc32(const uint8_t *data, const uint16_t datalen, bool reflect)
|
||||
{
|
||||
// poly=0x04c11db7 init=0xffffffff refin=true refout=true xorout=0xffffffff check=0xcbf43926
|
||||
return generic(0x04C11DB7L, 0XFFFFFFFFL, CRC_FLAG_REFLECT | CRC_FLAG_XOR, data, datalen);
|
||||
uint32_t flags = CRC_FLAG_REFLECT | (reflect ? CRC_FLAG_XOR : 0);
|
||||
return generic(0x04C11DB7L, 0XFFFFFFFFL, flags, data, datalen);
|
||||
}
|
||||
|
||||
/** CKSUM
|
||||
|
@ -448,6 +449,6 @@ uint32_t FastCRC32::generic(const uint32_t polynom, const uint32_t seed, const u
|
|||
return update(data, datalen);
|
||||
}
|
||||
|
||||
uint32_t FastCRC32::crc32_upd(const uint8_t *data, uint16_t len){return update(data, len);}
|
||||
uint32_t FastCRC32::crc32_upd(const uint8_t *data, uint16_t len, bool reflect){return update(data, len);}
|
||||
uint32_t FastCRC32::cksum_upd(const uint8_t *data, uint16_t len){return update(data, len);}
|
||||
#endif // #if defined(KINETISK)
|
||||
|
|
|
@ -273,10 +273,9 @@
|
|||
#elif defined (ARDUINO_ARCH_AVR)
|
||||
SPI.transfer(&(*data_buffer), size);
|
||||
#else
|
||||
uint8_t *_dataAddr = &(*data_buffer);
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
*_dataAddr = xfer(NULLBYTE);
|
||||
_dataAddr++;
|
||||
while(size--) {
|
||||
*data_buffer = xfer(NULLBYTE);
|
||||
data_buffer++;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
@ -293,9 +292,9 @@
|
|||
#elif defined (ARDUINO_ARCH_AVR)
|
||||
SPI.transfer(&(*data_buffer), size);
|
||||
#else
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
xfer(*_dataAddr);
|
||||
_dataAddr++;
|
||||
while(size--) {
|
||||
xfer(*data_buffer);
|
||||
data_buffer++;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
|
|
@ -165,6 +165,7 @@ uint32_t calculateCRC32(byte pageNo)
|
|||
break;
|
||||
|
||||
default:
|
||||
CRC32_val = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue