![](/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
AvailableMemory/AvailableMemory.cpp
- Committer:
- nobukuma
- Date:
- 2013-12-08
- Revision:
- 2:9f25a7fa1a54
- Parent:
- 0:003889bc474f
File content as of revision 2:9f25a7fa1a54:
#include "AvailableMemory.h" #include <stdlib.h> namespace segundo { namespace Utilities { int AvailableMemory(int resolution, int maximum, bool disableInterrupts) { if (resolution < 1) resolution = 1; if (maximum < 0) maximum = 0; int low = 0; int high = maximum + 1; if (disableInterrupts) __disable_irq(); while (high - low > resolution) { int mid = (low + high) / 2; void* p = malloc(mid); if (p == NULL) { high = mid; } else { free(p); low = mid; } } if (disableInterrupts) __enable_irq(); return low; } } // namespace Utilities } // namespace segundo