Function to calculate the memory available for malloc
Dependents: AvailableMemory_HelloWorld MCBBThermostat helloaabbc SP14P1_skeleton
Revision 11:0f5d5918761a, committed 2010-11-08
- Comitter:
- segundo
- Date:
- Mon Nov 08 12:42:34 2010 +0000
- Parent:
- 10:7474d5df69c2
- Child:
- 12:3004855925ff
- Commit message:
Changed in this revision
AvailableMemory.cpp | Show annotated file Show diff for this revision Revisions of this file |
AvailableMemory.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/AvailableMemory.cpp Sun Nov 07 21:52:34 2010 +0000 +++ b/AvailableMemory.cpp Mon Nov 08 12:42:34 2010 +0000 @@ -4,11 +4,6 @@ namespace segundo { namespace Utilities { -int AvailableMemory() { - - return AvailableMemory(256, 0x8000, true); -} - int AvailableMemory(int resolution, int maximum, bool disableInterrupts) { if (resolution < 1) resolution = 1;
--- a/AvailableMemory.h Sun Nov 07 21:52:34 2010 +0000 +++ b/AvailableMemory.h Mon Nov 08 12:42:34 2010 +0000 @@ -1,5 +1,5 @@ /** @file - * Return the memory available for a malloc call + * @brief Return the memory available for a malloc call * This is done by a binary search approach * calling malloc/free starting with a maximum */ @@ -16,19 +16,14 @@ namespace Utilities { /** Return the memory available for a malloc call - * @return AvailableMemory(256, 0x8000, true) + * @param resolution Resolution in number of bytes, + * 1 will return the exact value, + * default is 256 which will return the available memory to the nearest 256 bytes + * @param maximum Maximum amount of memory to check, default is 32K + * @param disableInterrupts Disable interrupts whilst checking, default is true + * @return Available memory in bytes accurate to within resolution */ -int AvailableMemory(); - -/** Return the memory available for a malloc call - * @param resolution Resolution in number of bytes - * 1 will return the exact value - * 256 will return the available memory to the nearest 256 bytes - * @param maximum Maximum amount of memory to check - * @param disableInterrupts Disable interrupts whilst checking - * @return Available memory in bytes - */ -int AvailableMemory(int resolution, int maximum, bool disableInterrupts); +int AvailableMemory(int resolution = 256, int maximum = 0x8000, bool disableInterrupts = true); } // namespace Utilities } // namespace segundo