Utility library. Some string and mbed memory utilities.

Dependents:   19E042PIM_T3_2020_0639

mbedUtils.cpp

Committer:
Phlaphead
Date:
2011-06-19
Revision:
0:3d93ff64fdee

File content as of revision 0:3d93ff64fdee:


#include "mbedUtils.h"

#include "mbed.h"


int getFreeMemory()
{
    // Return the difference between the heap pointer and stack pointer.
    char stackVar = '\0';
    char* stackPtr = &stackVar;
    char* heapPtr = (char*)malloc(sizeof(char));
    int memFree = stackPtr - heapPtr;
    free(heapPtr);
    return memFree;
}