Utility library. Some string and mbed memory utilities.
Dependents: 19E042PIM_T3_2020_0639
Diff: mbedUtils.cpp
- Revision:
- 0:3d93ff64fdee
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbedUtils.cpp Sun Jun 19 13:13:00 2011 +0000 @@ -0,0 +1,16 @@ + +#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; +}