Dual CANbus monitor and instrumentation cluster
Dependencies: SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed
Fork of CANary by
Util/mbedUtils.cpp@125:f58b7ab2abee, 2013-07-21 (annotated)
- Committer:
- TickTock
- Date:
- Sun Jul 21 11:08:38 2013 +0000
- Branch:
- Metric
- Revision:
- 125:f58b7ab2abee
- Parent:
- 1:9dcd70c32180
Re-centered efficiency screen
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 | } |