ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Debug.h
Go to the documentation of this file.
1/**
2 * @file Debug.h
3 * @brief Utility class for debugging and monitoring system memory.
4 *
5 * @date 22/12/2024
6 * @version 1.0
7 * @author Coela Can't
8 */
9
10#pragma once
11
12#include <Arduino.h>
13
14extern unsigned long _heap_start; ///< Start of the heap memory (defined externally).
15extern unsigned long _heap_end; ///< End of the heap memory (defined externally).
16extern char *__brkval; ///< Current break value indicating the end of the heap (defined externally).
17
18/**
19 * @class Debug
20 * @brief Provides debugging utilities for memory analysis.
21 */
22class Debug {
23public:
24 /**
25 * @brief Calculates the available free memory in the system.
26 *
27 * This function calculates the difference between the end of the heap
28 * and the current break value, returning the result in kilobytes.
29 *
30 * @return The available free memory in kilobytes as a float.
31 */
32 static float FreeMem() {
33 return float((char *)&_heap_end - __brkval) / 1000.0f;
34 }
35};
unsigned long _heap_end
End of the heap memory (defined externally).
unsigned long _heap_start
Start of the heap memory (defined externally).
char * __brkval
Current break value indicating the end of the heap (defined externally).
Provides debugging utilities for memory analysis.
Definition Debug.h:22
static float FreeMem()
Calculates the available free memory in the system.
Definition Debug.h:32