AP_Math: move crc8_dvb_update into crc library

This commit is contained in:
Peter Barker 2021-06-29 16:13:07 +02:00 committed by Randy Mackay
parent f1ac606f98
commit da34e63374
2 changed files with 10 additions and 0 deletions

View File

@ -122,6 +122,15 @@ uint8_t crc8_dvb_s2_update(uint8_t crc, const void *data, uint32_t length)
return crc;
}
// copied from AP_FETtecOneWire.cpp
uint8_t crc8_dvb_update(uint8_t crc, const uint8_t* buf, const uint16_t buf_len)
{
for (uint16_t i = 0; i < buf_len; i++) {
crc = crc8_dvb(buf[i], crc, 0x7);
}
return crc;
}
/*
xmodem CRC thanks to avr-liberty
https://github.com/dreamiurg/avr-liberty

View File

@ -22,6 +22,7 @@ uint8_t crc_crc8(const uint8_t *p, uint8_t len);
uint8_t crc8_dvb_s2(uint8_t crc, uint8_t a);
uint8_t crc8_dvb(uint8_t crc, uint8_t a, uint8_t seed);
uint8_t crc8_dvb_s2_update(uint8_t crc, const void *data, uint32_t length);
uint8_t crc8_dvb_update(uint8_t crc, const uint8_t* buf, const uint16_t buf_len);
uint16_t crc_xmodem_update(uint16_t crc, uint8_t data);
uint16_t crc_xmodem(const uint8_t *data, uint16_t len);
uint32_t crc_crc32(uint32_t crc, const uint8_t *buf, uint32_t size);