![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
local fix version of myBlueUSB (http://mbed.org/users/networker/code/myBlueUSB/). - merge deleted files which are required to compile. - enable echo back of received data via RFCOMM.
Dependencies: AvailableMemory FatFileSystem mbed myUSBHost
Diff: AvailableMemory/AvailableMemory.h
- Revision:
- 0:003889bc474f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AvailableMemory/AvailableMemory.h Sat Dec 07 14:19:00 2013 +0000 @@ -0,0 +1,46 @@ +/** @file + * Return the memory available for a malloc call. + */ +#ifndef SEGUNDO_UTILITIES_AVAILABLEMEMORY_H +#define SEGUNDO_UTILITIES_AVAILABLEMEMORY_H + +/** + * Segundo Equipo + */ +namespace segundo { +/** + * A collection of utilities + */ +namespace Utilities { + +/** Return the memory available for a malloc call. + * This is done by a binary search approach + * calling malloc/free starting with a maximum. + * + * Example: + * @code + * #include <stdio.h> + * #include "AvailableMemory.h" + * + * int main() { + * + * printf("Available memory (bytes to nearest 256) : %d\n", AvailableMemory()); + * printf("Available memory (exact bytes) : %d\n", AvailableMemory(1)); + * + * } + * @endcode + * @param resolution Resolution in number of bytes, + * 1 will return the exact value, + * default will return the available memory to the nearest 256 bytes + * @param maximum Maximum amount of memory to check, default is 32K (0x8000) + * @param disableInterrupts Disable interrupts whilst checking, default is true + * @return Available memory in bytes accurate to within resolution + */ +int AvailableMemory(int resolution = 256, int maximum = 0x8000, bool disableInterrupts = true); + +} // namespace Utilities +} // namespace segundo + +using namespace segundo::Utilities; + +#endif // SEGUNDO_UTILITIES_AVAILABLEMEMORY_H \ No newline at end of file