AP_HAL: removed hal argument to EXPECT_DELAY_MS()

This commit is contained in:
Andrew Tridgell 2019-05-15 14:09:13 +10:00
parent f8bcdf9d3a
commit 911a99b79e
2 changed files with 9 additions and 10 deletions

View File

@ -3,6 +3,8 @@
using namespace AP_HAL;
extern const AP_HAL::HAL& hal;
void Scheduler::register_delay_callback(AP_HAL::Proc proc,
uint16_t min_time_ms)
{
@ -24,12 +26,12 @@ void Scheduler::call_delay_cb()
_in_delay_callback = false;
}
ExpectDelay::ExpectDelay(const AP_HAL::HAL &hal, uint32_t ms) : _hal(hal)
ExpectDelay::ExpectDelay(uint32_t ms)
{
_hal.scheduler->expect_delay_ms(ms);
hal.scheduler->expect_delay_ms(ms);
}
ExpectDelay::~ExpectDelay()
{
_hal.scheduler->expect_delay_ms(0);
hal.scheduler->expect_delay_ms(0);
}

View File

@ -127,13 +127,10 @@ private:
*/
class ExpectDelay {
public:
ExpectDelay(const AP_HAL::HAL &hal, uint32_t ms);
ExpectDelay(uint32_t ms);
~ExpectDelay();
private:
const AP_HAL::HAL &_hal;
};
#define EXPECT_DELAY(hal, ms) DELAY_JOIN( hal, ms, __COUNTER__ )
#define DELAY_JOIN( hal, ms, counter) _DO_DELAY_JOIN( hal, ms, counter )
#define _DO_DELAY_JOIN( hal, ms, counter ) ExpectDelay _getdelay ## counter(hal, ms)
#define EXPECT_DELAY_MS(ms) DELAY_JOIN( ms, __COUNTER__ )
#define DELAY_JOIN( ms, counter) _DO_DELAY_JOIN( ms, counter )
#define _DO_DELAY_JOIN( ms, counter ) ExpectDelay _getdelay ## counter(ms)