HAL_Linux: updates for AP_HAL::MemberProc

This commit is contained in:
Andrew Tridgell 2013-09-30 20:36:12 +10:00
parent 82fe40224b
commit f2ebb2ca87
2 changed files with 9 additions and 15 deletions

View File

@ -107,7 +107,7 @@ void LinuxScheduler::register_delay_callback(AP_HAL::Proc proc,
_min_delay_cb_ms = min_time_ms;
}
void LinuxScheduler::register_timer_process(AP_HAL::TimedProc proc, void *arg)
void LinuxScheduler::register_timer_process(AP_HAL::MemberProc proc)
{
for (uint8_t i = 0; i < _num_timer_procs; i++) {
if (_timer_proc[i] == proc) {
@ -117,14 +117,13 @@ void LinuxScheduler::register_timer_process(AP_HAL::TimedProc proc, void *arg)
if (_num_timer_procs < LINUX_SCHEDULER_MAX_TIMER_PROCS) {
_timer_proc[_num_timer_procs] = proc;
_timer_arg[_num_timer_procs] = arg;
_num_timer_procs++;
} else {
hal.console->printf("Out of timer processes\n");
}
}
void LinuxScheduler::register_io_process(AP_HAL::TimedProc proc, void *arg)
void LinuxScheduler::register_io_process(AP_HAL::MemberProc proc)
{
for (uint8_t i = 0; i < _num_io_procs; i++) {
if (_io_proc[i] == proc) {
@ -134,15 +133,13 @@ void LinuxScheduler::register_io_process(AP_HAL::TimedProc proc, void *arg)
if (_num_io_procs < LINUX_SCHEDULER_MAX_TIMER_PROCS) {
_io_proc[_num_io_procs] = proc;
_io_arg[_num_io_procs] = arg;
_num_io_procs++;
} else {
hal.console->printf("Out of IO processes\n");
}
}
void LinuxScheduler::register_timer_failsafe(AP_HAL::TimedProc failsafe,
uint32_t period_us)
void LinuxScheduler::register_timer_failsafe(AP_HAL::MemberProc failsafe, uint32_t period_us)
{
_failsafe = failsafe;
}

View File

@ -21,15 +21,14 @@ public:
void register_delay_callback(AP_HAL::Proc,
uint16_t min_time_ms);
void register_timer_process(AP_HAL::TimedProc, void *arg);
void register_io_process(AP_HAL::TimedProc, void *arg);
void register_timer_process(AP_HAL::MemberProc, void *arg);
void register_io_process(AP_HAL::MemberProc, void *arg);
void suspend_timer_procs();
void resume_timer_procs();
bool in_timerprocess();
void register_timer_failsafe(AP_HAL::TimedProc,
uint32_t period_us);
void register_timer_failsafe(AP_HAL::Proc, uint32_t period_us);
void begin_atomic();
void end_atomic();
@ -47,20 +46,18 @@ private:
AP_HAL::Proc _delay_cb;
uint16_t _min_delay_cb_ms;
AP_HAL::TimedProc _failsafe;
AP_HAL::Proc _failsafe;
bool _initialized;
volatile bool _timer_pending;
volatile bool _timer_suspended;
AP_HAL::TimedProc _timer_proc[LINUX_SCHEDULER_MAX_TIMER_PROCS];
void * _timer_arg[LINUX_SCHEDULER_MAX_TIMER_PROCS];
AP_HAL::MemberProc _timer_proc[LINUX_SCHEDULER_MAX_TIMER_PROCS];
uint8_t _num_timer_procs;
volatile bool _in_timer_proc;
AP_HAL::TimedProc _io_proc[LINUX_SCHEDULER_MAX_TIMER_PROCS];
void * _io_arg[LINUX_SCHEDULER_MAX_TIMER_PROCS];
AP_HAL::MemberProc _io_proc[LINUX_SCHEDULER_MAX_TIMER_PROCS];
uint8_t _num_io_procs;
volatile bool _in_io_proc;