AP_HAL_F4Light: move delay callback handling to base HAL Scheduler class
This commit is contained in:
parent
ae56cbc302
commit
f2d73bb9b0
@ -36,9 +36,6 @@ AP_HAL::Proc Scheduler::_failsafe IN_CCM= NULL;
|
||||
Revo_IO Scheduler::_io_proc[F4Light_SCHEDULER_MAX_IO_PROCS] IN_CCM;
|
||||
uint8_t Scheduler::_num_io_proc IN_CCM=0;
|
||||
|
||||
|
||||
AP_HAL::Proc Scheduler::_delay_cb IN_CCM=NULL;
|
||||
uint16_t Scheduler::_min_delay_cb_ms IN_CCM=0;
|
||||
void * Scheduler::_delay_cb_handle IN_CCM=0;
|
||||
|
||||
uint32_t Scheduler::timer5_ovf_cnt IN_CCM=0;
|
||||
@ -269,8 +266,8 @@ void Scheduler::_delay(uint16_t ms)
|
||||
uint32_t now;
|
||||
|
||||
while((now=_micros()) - start < dt) {
|
||||
if (_delay_cb && _min_delay_cb_ms <= ms) { // MAVlink callback uses 5ms
|
||||
_delay_cb();
|
||||
if (_min_delay_cb_ms <= ms) { // MAVlink callback uses 5ms
|
||||
call_delay_cb();
|
||||
yield(1000 - (_micros() - now)); // to not stop MAVlink callback
|
||||
} else {
|
||||
yield(dt); // for full time
|
||||
@ -355,8 +352,7 @@ void Scheduler::register_delay_callback(AP_HAL::Proc proc, uint16_t min_time_ms)
|
||||
init_done=true;
|
||||
}
|
||||
|
||||
_delay_cb = proc;
|
||||
_min_delay_cb_ms = min_time_ms;
|
||||
AP_HAL::register_delay_callback(proc, min_time_ms);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -192,7 +192,7 @@ public:
|
||||
inline void suspend_timer_procs(){} // nothing to do in multitask
|
||||
inline void resume_timer_procs() {}
|
||||
|
||||
void register_delay_callback(AP_HAL::Proc, uint16_t min_time_ms);
|
||||
void register_delay_callback(AP_HAL::Proc, uint16_t min_time_ms) override;
|
||||
static void _register_io_process(Handler h, Revo_IO_Flags flags);
|
||||
void register_io_process(AP_HAL::MemberProc proc) { Revo_handler h = { .mp=proc }; _register_io_process(h.h, IO_PERIODIC); }
|
||||
|
||||
@ -502,9 +502,7 @@ protected:
|
||||
private:
|
||||
static AP_HAL::Device::PeriodicHandle _register_timer_task(uint32_t period_us, Handler proc, F4Light::Semaphore *sem);
|
||||
|
||||
static AP_HAL::Proc _delay_cb;
|
||||
static void * _delay_cb_handle;
|
||||
static uint16_t _min_delay_cb_ms;
|
||||
static bool _initialized;
|
||||
|
||||
// ISR functions
|
||||
|
Loading…
Reference in New Issue
Block a user