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

65 lines
1.1 KiB
C
Raw Normal View History

2022-01-27 06:18:16 -05:00
#pragma once
//
// FILE: Adler.h
// AUTHOR: Rob Tillaart
2022-06-14 09:28:07 -04:00
// VERSION: 0.1.2
2022-01-27 06:18:16 -05:00
// DATE: 2022-01-27
// PURPOSE: Arduino Library for calculating Adler-32 checksum
// URL: https://github.com/RobTillaart/Adler
// https://en.wikipedia.org/wiki/Adler-32
#include "Arduino.h"
2022-06-14 09:28:07 -04:00
#define ADLER32_LIB_VERSION (F("0.1.2"))
const uint16_t ADLER32_MOD_PRIME = 65521;
2022-01-27 06:18:16 -05:00
/////////////////////////////////////////////////
//
2022-06-14 09:28:07 -04:00
// STATIC FUNCTIONS
2022-01-27 06:18:16 -05:00
//
2022-04-15 08:35:07 -04:00
uint32_t adler32(uint8_t *data, uint16_t length);
2022-01-27 06:18:16 -05:00
/////////////////////////////////////////////////
//
// CLASS VERSION
//
class Adler32
{
public:
2022-06-14 09:28:07 -04:00
Adler32();
void begin(uint32_t s1 = 1, uint32_t s2 = 0);
void add(uint8_t value);
void add(uint8_t * array, uint16_t length);
// trade PROGMEM for speed
void addFast(uint8_t * array, uint16_t length);
// wrappers for strings
void add(char value);
void add(char * array, uint16_t length);
void addFast(char * array, uint16_t length);
uint32_t getAdler();
uint32_t count() { return _count; };
2022-01-27 06:18:16 -05:00
private:
uint32_t _s1;
uint32_t _s2;
uint32_t _count;
};
// -- END OF FILE --