HAL_PX4: implement available_memory()

This commit is contained in:
Andrew Tridgell 2013-12-28 16:01:28 +11:00
parent c1115bd440
commit 22bdee8727
2 changed files with 15 additions and 0 deletions

View File

@ -121,4 +121,17 @@ bool PX4Util::get_system_id(char buf[40])
return true;
}
/**
how much free memory do we have in bytes.
*/
uint16_t PX4Util::available_memory(void)
{
struct mallinfo mem;
mem = mallinfo();
if (mem.fordblks > 0xFFFF) {
return 0xFFFF;
}
return mem.fordblks;
}
#endif // CONFIG_HAL_BOARD == HAL_BOARD_PX4

View File

@ -22,6 +22,8 @@ public:
*/
bool get_system_id(char buf[40]);
uint16_t available_memory(void);
private:
int _safety_handle;
};