ahoy/tools/esp8266/crc.h
lumapu 4561655d9d * improved serial console
* repaired /save
* removed yields (not allowed with async-web)
2022-09-08 22:52:51 +02:00

21 lines
647 B
C++

//-----------------------------------------------------------------------------
// 2022 Ahoy, https://www.mikrocontroller.net/topic/525778
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
//-----------------------------------------------------------------------------
#ifndef __CRC_H__
#define __CRC_H__
#include <cstdint>
#include "Arduino.h"
#define CRC8_INIT 0x00
#define CRC8_POLY 0x01
#define CRC16_MODBUS_POLYNOM 0xA001
namespace Ahoy {
uint8_t crc8(uint8_t buf[], uint8_t len);
uint16_t crc16(uint8_t buf[], uint8_t len, uint16_t start = 0xffff);
}
#endif /*__CRC_H__*/