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

52 lines
1.0 KiB
C
Raw Normal View History

2021-01-29 06:31:58 -05:00
#pragma once
//
// FILE: SHEX.h
// AUTHOR: Rob Tillaart
2021-12-28 05:19:54 -05:00
// VERSION: 0.2.1
2021-01-29 06:31:58 -05:00
// PURPOSE: Arduino library to generate hex dump over Serial
// DATE: 2020-05-24
// URL: https://github.com/RobTillaart/SHEX
#include "Arduino.h"
#include "Print.h"
2021-12-28 05:19:54 -05:00
#define SHEX_LIB_VERSION (F("0.2.1"))
2021-01-29 06:31:58 -05:00
class SHEX: public Print
{
public:
2021-12-28 05:19:54 -05:00
SHEX(Print* stream = &Serial, uint8_t length = 16);
2021-01-29 06:31:58 -05:00
void reset();
size_t write(uint8_t c);
void setHEX(bool hexOutput = true);
bool getHEX() { return _hexOutput; };
2021-12-28 05:19:54 -05:00
void setBytesPerLine(const uint8_t length = 16);
2021-01-29 06:31:58 -05:00
uint8_t getBytesPerLine() { return _length; };
void setSeparator(char c = ' ') { _separator = c; };
char getSeparator() { return _separator; };
void setCountFlag(bool flag = true) { _countFlag = flag; };
bool getCountFlag() {return _countFlag; };
2021-12-28 05:19:54 -05:00
2021-01-29 06:31:58 -05:00
private:
Print * _stream;
bool _hexOutput = false;
bool _countFlag = true;
uint8_t _length = 0;
uint32_t _charCount = 0;
char _separator = ' ';
};
2021-12-28 05:19:54 -05:00
2021-01-29 06:31:58 -05:00
// -- END OF FILE --
2021-12-28 05:19:54 -05:00