Created
January 10, 2018 02:32
-
-
Save jessicacarneiro/3c4ee49513fcfd34ca0c4ae828662c04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uint32_t freeRam() // for Teensy 3.0 | |
| { | |
| uint32_t stackTop; | |
| uint32_t heapTop; | |
| // current position of the stack. | |
| stackTop = (uint32_t) &stackTop; | |
| // current position of heap. | |
| void* hTop = malloc(1); | |
| heapTop = (uint32_t) hTop; | |
| free(hTop); | |
| // the difference is the free, available ram. | |
| return stackTop - heapTop; | |
| } | |
| void setup() | |
| { | |
| } | |
| void loop() | |
| { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment