mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Make crc8 const-correct (#7027)
This commit is contained in:
parent
7aaa5ce9c8
commit
582386d3a2
2 changed files with 2 additions and 2 deletions
|
@ -93,7 +93,7 @@ std::string to_string(long double value) { return str_snprintf("%Lf", 32, value)
|
|||
// Mathematics
|
||||
|
||||
float lerp(float completion, float start, float end) { return start + (end - start) * completion; }
|
||||
uint8_t crc8(uint8_t *data, uint8_t len) {
|
||||
uint8_t crc8(const uint8_t *data, uint8_t len) {
|
||||
uint8_t crc = 0;
|
||||
|
||||
while ((len--) != 0u) {
|
||||
|
|
|
@ -155,7 +155,7 @@ template<typename T, typename U> T remap(U value, U min, U max, T min_out, T max
|
|||
}
|
||||
|
||||
/// Calculate a CRC-8 checksum of \p data with size \p len.
|
||||
uint8_t crc8(uint8_t *data, uint8_t len);
|
||||
uint8_t crc8(const 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, uint16_t len, uint16_t crc = 0xffff, uint16_t reverse_poly = 0xa001,
|
||||
|
|
Loading…
Reference in a new issue