GY-63_MS5611/libraries/AvrHeap/avrheap.h

55 lines
1.1 KiB
C
Raw Normal View History

2020-11-27 05:10:47 -05:00
#pragma once
2015-12-10 12:26:56 -05:00
//
2020-11-27 05:10:47 -05:00
// FILE: avrheap.h
// AUTHOR: Rob Tillaart
2021-12-13 15:05:26 -05:00
// VERSION: 0.2.5
2020-11-27 05:10:47 -05:00
// PURPOSE: experimental library for heap Arduino UNO
2015-12-10 12:26:56 -05:00
// HISTORY: See avrheap.cpp
//
2021-05-28 07:20:16 -04:00
2020-11-27 05:10:47 -05:00
#if !defined(ARDUINO_ARCH_AVR)
#error “Avrheap library only AVR boards, tested only with UNO.”
2015-12-10 12:26:56 -05:00
#endif
2021-05-28 07:20:16 -04:00
2020-11-27 05:10:47 -05:00
#include "Arduino.h"
2015-12-10 12:26:56 -05:00
#include "Printable.h"
2021-05-28 07:20:16 -04:00
2021-12-13 15:05:26 -05:00
#define AVRHEAP_LIB_VERSION (F("0.2.5"))
2021-05-28 07:20:16 -04:00
2015-12-10 12:26:56 -05:00
class Avrheap : public Printable
2015-12-10 12:26:56 -05:00
{
public:
2021-01-29 06:31:58 -05:00
Avrheap();
2015-12-10 12:30:14 -05:00
2021-01-29 06:31:58 -05:00
bool isFragmented();
uint16_t freeListCount();
uint16_t freeListSize();
void freeListWalk(bool withDump = true);
uint16_t freeListLargest();
2015-12-10 12:30:14 -05:00
2021-01-29 06:31:58 -05:00
uint16_t startAddress();
2021-01-29 06:31:58 -05:00
void dumpHeap(uint16_t count);
size_t heapWalk(Print& p, bool withDump = true) const;
size_t heapWalk(bool withDump = true);
virtual size_t printTo(Print& p) const;
2015-12-10 12:26:56 -05:00
private:
2021-01-29 06:31:58 -05:00
bool inFreeList(uint16_t addr);
2015-12-10 12:26:56 -05:00
};
2021-05-28 07:20:16 -04:00
size_t hNibble(Print& p, byte val);
size_t hByte(Print& p, byte val);
size_t hWord(Print& p, uint16_t val);
size_t dumpR(Print& p, byte* adr, int len);
size_t dumpAlloced(Print& p, byte *ptr, bool withDump = true);
size_t dumpAlloced(byte *ptr, bool withDump = true);
2021-05-28 07:20:16 -04:00
2020-11-27 05:10:47 -05:00
// -- END OF FILE --