1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-18 22:05:17 +03:00

Use CRC rather than simple checksum for EEPROM (#2517)

Use CRC rather than simple checksum for EEPROM
This commit is contained in:
Martin Budden 2017-03-08 17:50:45 +00:00 committed by GitHub
parent 9c03b32114
commit a77e424dec
3 changed files with 49 additions and 47 deletions

View file

@ -350,6 +350,17 @@ uint16_t crc16_ccitt(uint16_t crc, unsigned char a)
return crc;
}
uint16_t crc16_ccitt_update(uint16_t crc, const void *data, uint32_t length)
{
const uint8_t *p = (const uint8_t *)data;
const uint8_t *pend = p + length;
for (; p != pend; p++) {
crc = crc16_ccitt(crc, *p);
}
return crc;
}
uint8_t crc8_dvb_s2(uint8_t crc, unsigned char a)
{
crc ^= a;