Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Util/mbedUtils.cpp

Committer:
TickTock
Date:
2013-07-21
Branch:
Metric
Revision:
125:f58b7ab2abee
Parent:
1:9dcd70c32180

File content as of revision 125:f58b7ab2abee:


#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;
}