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

40 lines
614 B
C
Raw Normal View History

2022-01-27 04:11:25 -05:00
#pragma once
//
// FILE: Fletcher16.h
2022-09-13 10:31:43 -04:00
// AUTHOR: Rob Tillaart, Daniel Mohr
2022-01-27 04:11:25 -05:00
// PURPOSE: Arduino class for Fletcher16
// URL: https://github.com/RobTillaart/Fletcher
#include "Arduino.h"
class Fletcher16
{
public:
Fletcher16();
2023-01-17 13:28:45 -05:00
// set parameters to default
2022-01-27 04:11:25 -05:00
void begin(uint8_t s1 = 0, uint8_t s2 = 0);
void add(uint8_t value);
void add(const uint8_t * array, uint16_t length);
2022-09-13 10:31:43 -04:00
uint16_t getFletcher();
uint32_t count();
2022-01-27 04:11:25 -05:00
private:
2022-09-13 10:31:43 -04:00
#ifdef ARDUINO_ARCH_AVR
uint8_t _s1;
uint8_t _s2;
#else
2022-01-27 04:11:25 -05:00
uint16_t _s1;
uint16_t _s2;
2022-09-13 10:31:43 -04:00
#endif
2022-01-27 04:11:25 -05:00
uint32_t _count;
};
2023-01-17 13:28:45 -05:00
// -- END OF FILE --
2022-01-27 04:11:25 -05:00