From f0f5761e8dfa7a7c008c7c86051406b065d2207e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 28 Sep 2013 16:23:34 +1000 Subject: [PATCH] AP_HAL: make timed processes take void *argument this allows the class to be passed in, meaning that drivers that use register_timer_process() and register_io_process() don't need to use static members. That results in simpler, easier to read code --- libraries/AP_HAL/AP_HAL_Namespace.h | 2 +- libraries/AP_HAL/Scheduler.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/AP_HAL/AP_HAL_Namespace.h b/libraries/AP_HAL/AP_HAL_Namespace.h index 6a193339fa..2a6dc56534 100644 --- a/libraries/AP_HAL/AP_HAL_Namespace.h +++ b/libraries/AP_HAL/AP_HAL_Namespace.h @@ -34,7 +34,7 @@ namespace AP_HAL { /* Typdefs for function pointers (Procedure, Timed Procedure) */ typedef void(*Proc)(void); - typedef void(*TimedProc)(uint32_t); + typedef void(*TimedProc)(void *); /** * Global names for all of the existing SPI devices on all platforms. diff --git a/libraries/AP_HAL/Scheduler.h b/libraries/AP_HAL/Scheduler.h index 7f4fecec5a..a83f6a6631 100644 --- a/libraries/AP_HAL/Scheduler.h +++ b/libraries/AP_HAL/Scheduler.h @@ -16,13 +16,13 @@ public: virtual uint32_t micros() = 0; virtual void delay_microseconds(uint16_t us) = 0; virtual void register_delay_callback(AP_HAL::Proc, - uint16_t min_time_ms) = 0; + uint16_t min_time_ms) = 0; // register a high priority timer task - virtual void register_timer_process(AP_HAL::TimedProc) = 0; + virtual void register_timer_process(AP_HAL::TimedProc, void *) = 0; // register a low priority IO task - virtual void register_io_process(AP_HAL::TimedProc) = 0; + virtual void register_io_process(AP_HAL::TimedProc, void *) = 0; // suspend and resume both timer and IO processes virtual void suspend_timer_procs() = 0; @@ -31,7 +31,7 @@ public: virtual bool in_timerprocess() = 0; virtual void register_timer_failsafe(AP_HAL::TimedProc, - uint32_t period_us) = 0; + uint32_t period_us) = 0; virtual bool system_initializing() = 0; virtual void system_initialized() = 0;