2015-11-11 10:30:21 -04:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <drivers/drv_hrt.h>
|
|
|
|
|
|
|
|
#include <AP_HAL/AP_HAL.h>
|
2015-11-19 23:24:56 -04:00
|
|
|
#include <AP_HAL/system.h>
|
|
|
|
|
2015-11-11 10:30:21 -04:00
|
|
|
extern const AP_HAL::HAL& hal;
|
|
|
|
|
|
|
|
extern bool _vrbrain_thread_should_exit;
|
|
|
|
|
2015-11-19 23:24:56 -04:00
|
|
|
namespace AP_HAL {
|
|
|
|
|
|
|
|
void init()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-11-11 10:30:21 -04:00
|
|
|
void panic(const char *errormsg, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, errormsg);
|
|
|
|
vdprintf(1, errormsg, ap);
|
|
|
|
va_end(ap);
|
|
|
|
write(1, "\n", 1);
|
|
|
|
|
|
|
|
hal.scheduler->delay_microseconds(10000);
|
|
|
|
_vrbrain_thread_should_exit = true;
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t micros()
|
|
|
|
{
|
|
|
|
return micros64() & 0xFFFFFFFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t millis()
|
|
|
|
{
|
|
|
|
return millis64() & 0xFFFFFFFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t micros64()
|
|
|
|
{
|
|
|
|
return hrt_absolute_time();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t millis64()
|
|
|
|
{
|
|
|
|
return micros64() / 1000;
|
|
|
|
}
|
|
|
|
|
2015-11-19 23:24:56 -04:00
|
|
|
} // namespace AP_HAL
|