Dual CANbus monitor and instrumentation cluster
Dependencies: SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed
Fork of CANary by
Util/mbedUtils.cpp@1:9dcd70c32180, 2013-02-03 (annotated)
- Committer:
- TickTock
- Date:
- Sun Feb 03 18:16:53 2013 +0000
- Revision:
- 1:9dcd70c32180
compiles
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
TickTock | 1:9dcd70c32180 | 1 | |
TickTock | 1:9dcd70c32180 | 2 | #include "mbedUtils.h" |
TickTock | 1:9dcd70c32180 | 3 | |
TickTock | 1:9dcd70c32180 | 4 | #include "mbed.h" |
TickTock | 1:9dcd70c32180 | 5 | |
TickTock | 1:9dcd70c32180 | 6 | |
TickTock | 1:9dcd70c32180 | 7 | int getFreeMemory() |
TickTock | 1:9dcd70c32180 | 8 | { |
TickTock | 1:9dcd70c32180 | 9 | // Return the difference between the heap pointer and stack pointer. |
TickTock | 1:9dcd70c32180 | 10 | char stackVar = '\0'; |
TickTock | 1:9dcd70c32180 | 11 | char* stackPtr = &stackVar; |
TickTock | 1:9dcd70c32180 | 12 | char* heapPtr = (char*)malloc(sizeof(char)); |
TickTock | 1:9dcd70c32180 | 13 | int memFree = stackPtr - heapPtr; |
TickTock | 1:9dcd70c32180 | 14 | free(heapPtr); |
TickTock | 1:9dcd70c32180 | 15 | return memFree; |
TickTock | 1:9dcd70c32180 | 16 | } |