mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 08:38:36 -04:00
AP_Math: added CRC16_CCITT non-standard variant
This commit is contained in:
parent
f16e1cac0d
commit
8c9dcf4ad8
@ -339,6 +339,14 @@ uint16_t crc16_ccitt(const uint8_t *buf, uint32_t len, uint16_t crc)
|
||||
return crc;
|
||||
}
|
||||
|
||||
uint16_t crc16_ccitt_GDL90(const uint8_t *buf, uint32_t len, uint16_t crc)
|
||||
{
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
crc = crc16tab[crc >> 8] ^ (crc << 8) ^ (uint16_t) *buf++;
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate Modbus CRC16 for array of bytes
|
||||
*
|
||||
|
@ -37,6 +37,10 @@ uint8_t crc_sum8(const uint8_t *p, uint8_t len);
|
||||
// Contact: Fergus Noble <fergus@swift-nav.com>
|
||||
uint16_t crc16_ccitt(const uint8_t *buf, uint32_t len, uint16_t crc);
|
||||
|
||||
// CRC16_CCITT algorithm using the GDL90 parser method which is non-standard
|
||||
// https://www.faa.gov/nextgen/programs/adsb/archival/media/gdl90_public_icd_reva.pdf
|
||||
uint16_t crc16_ccitt_GDL90(const uint8_t *buf, uint32_t len, uint16_t crc);
|
||||
|
||||
uint16_t calc_crc_modbus(uint8_t *buf, uint16_t len);
|
||||
|
||||
// generate 64bit FNV1a hash from buffer
|
||||
|
Loading…
Reference in New Issue
Block a user