mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-05 20:38:27 +02:00
Add standardized CRC helper functions (#4798)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -155,7 +155,10 @@ template<typename T, typename U> T remap(U value, U min, U max, T min_out, T max
|
||||
uint8_t crc8(uint8_t *data, uint8_t len);
|
||||
|
||||
/// Calculate a CRC-16 checksum of \p data with size \p len.
|
||||
uint16_t crc16(const uint8_t *data, uint8_t len);
|
||||
uint16_t crc16(const uint8_t *data, uint16_t len, uint16_t crc = 0xffff, uint16_t reverse_poly = 0xa001,
|
||||
bool refin = false, bool refout = false);
|
||||
uint16_t crc16be(const uint8_t *data, uint16_t len, uint16_t crc = 0, uint16_t poly = 0x1021, bool refin = false,
|
||||
bool refout = false);
|
||||
|
||||
/// Calculate a FNV-1 hash of \p str.
|
||||
uint32_t fnv1_hash(const std::string &str);
|
||||
|
||||
Reference in New Issue
Block a user