GY-63_MS5611/libraries/Fletcher/Fletcher.h

38 lines
995 B
C
Raw Normal View History

2022-01-26 04:24:06 -05:00
#pragma once
//
// FILE: Fletcher.h
// AUTHOR: Rob Tillaart
2023-01-17 13:28:45 -05:00
// VERSION: 0.1.8
2022-01-26 04:24:06 -05:00
// DATE: 2022-01-25
// PURPOSE: Arduino Library for calculating Fletcher's checksum
2022-01-26 10:34:57 -05:00
// URL: https://github.com/RobTillaart/Fletcher
// https://en.wikipedia.org/wiki/Fletcher%27s_checksum
2022-01-26 04:24:06 -05:00
#include "Arduino.h"
2023-01-17 13:28:45 -05:00
#define FLETCHER_LIB_VERSION (F("0.1.8"))
2022-01-26 04:24:06 -05:00
#define FLETCHER_16 255
#define FLETCHER_32 65535UL
#define FLETCHER_64 4294967295ULL
//
// straightforward implementation.
// max length buffer 65534.
// Wikipedia shows optimizations.
//
2023-01-17 13:28:45 -05:00
// Since 0.1.8: added parameters s1 and s2 to make functions more versatile.
2022-01-26 04:24:06 -05:00
2023-01-17 13:28:45 -05:00
uint16_t fletcher16(uint8_t *data, uint16_t length, uint32_t s1 = 0, uint32_t s2 = 0);
2022-01-26 04:24:06 -05:00
2023-01-17 13:28:45 -05:00
uint32_t fletcher32(uint16_t *data, uint16_t length, uint32_t s1 = 0, uint32_t s2 = 0);
2022-01-26 04:24:06 -05:00
2023-01-17 13:28:45 -05:00
uint64_t fletcher64(uint32_t *data, uint16_t length, uint64_t s1 = 0, uint64_t s2 = 0);
2022-01-26 04:24:06 -05:00
2023-01-17 13:28:45 -05:00
// -- END OF FILE --
2022-01-26 04:24:06 -05:00