diff --git a/hal/include/HAL/Interrupts.h b/hal/include/HAL/Interrupts.h index 4497ebcbc9..ee05e3df68 100644 --- a/hal/include/HAL/Interrupts.h +++ b/hal/include/HAL/Interrupts.h @@ -15,8 +15,8 @@ #ifdef __cplusplus extern "C" { #endif -typedef void (*InterruptHandlerFunction)(uint32_t interruptAssertedMask, - void* param); +typedef void (*HAL_InterruptHandlerFunction)(uint32_t interruptAssertedMask, + void* param); HAL_InterruptHandle HAL_InitializeInterrupts(HAL_Bool watcher, int32_t* status); void HAL_CleanInterrupts(HAL_InterruptHandle interruptHandle, int32_t* status); @@ -36,8 +36,8 @@ void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle, HAL_AnalogTriggerType analogTriggerType, int32_t* status); void HAL_AttachInterruptHandler(HAL_InterruptHandle interruptHandle, - InterruptHandlerFunction handler, void* param, - int32_t* status); + HAL_InterruptHandlerFunction handler, + void* param, int32_t* status); void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle, HAL_Bool risingEdge, HAL_Bool fallingEdge, int32_t* status); diff --git a/hal/include/HAL/Notifier.h b/hal/include/HAL/Notifier.h index 27c69f013d..0d3d2110ad 100644 --- a/hal/include/HAL/Notifier.h +++ b/hal/include/HAL/Notifier.h @@ -14,7 +14,10 @@ #ifdef __cplusplus extern "C" { #endif -HAL_NotifierHandle HAL_InitializeNotifier(void (*process)(uint64_t, HAL_NotifierHandle), +typedef void (*HAL_NotifierProcessFunction)(uint64_t currentTime, + HAL_NotifierHandle handle); + +HAL_NotifierHandle HAL_InitializeNotifier(HAL_NotifierProcessFunction process, void* param, int32_t* status); void HAL_CleanNotifier(HAL_NotifierHandle notifierHandle, int32_t* status); void* HAL_GetNotifierParam(HAL_NotifierHandle notifierHandle, int32_t* status); diff --git a/hal/lib/athena/Interrupts.cpp b/hal/lib/athena/Interrupts.cpp index 19ec2b4157..a9525dd439 100644 --- a/hal/lib/athena/Interrupts.cpp +++ b/hal/lib/athena/Interrupts.cpp @@ -171,8 +171,8 @@ void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle, } void HAL_AttachInterruptHandler(HAL_InterruptHandle interruptHandle, - InterruptHandlerFunction handler, void* param, - int32_t* status) { + HAL_InterruptHandlerFunction handler, + void* param, int32_t* status) { auto anInterrupt = interruptHandles.Get(interruptHandle); if (anInterrupt == nullptr) { *status = HAL_HANDLE_ERROR; diff --git a/hal/lib/athena/Notifier.cpp b/hal/lib/athena/Notifier.cpp index 6b64f6ab33..cf300e08a1 100644 --- a/hal/lib/athena/Notifier.cpp +++ b/hal/lib/athena/Notifier.cpp @@ -32,7 +32,7 @@ namespace { struct Notifier { std::shared_ptr prev, next; void* param; - void (*process)(uint64_t, HAL_NotifierHandle); + HAL_NotifierProcessFunction process; uint64_t triggerTime = UINT64_MAX; HAL_NotifierHandle handle; }; @@ -110,7 +110,7 @@ static void cleanupNotifierAtExit() { extern "C" { -HAL_NotifierHandle HAL_InitializeNotifier(void (*process)(uint64_t, HAL_NotifierHandle), +HAL_NotifierHandle HAL_InitializeNotifier(HAL_NotifierProcessFunction process, void* param, int32_t* status) { if (!process) { *status = NULL_PARAMETER; @@ -134,8 +134,8 @@ HAL_NotifierHandle HAL_InitializeNotifier(void (*process)(uint64_t, HAL_Notifier std::shared_ptr notifier = std::make_shared(); HAL_NotifierHandle handle = notifierHandles.Allocate(notifier); if (handle == HAL_kInvalidHandle) { - *status = HAL_HANDLE_ERROR; - return HAL_kInvalidHandle; + *status = HAL_HANDLE_ERROR; + return HAL_kInvalidHandle; } // create notifier structure and add to list notifier->next = notifiers; diff --git a/wpilibc/athena/include/InterruptableSensorBase.h b/wpilibc/athena/include/InterruptableSensorBase.h index 9299dbcc60..cabe809552 100644 --- a/wpilibc/athena/include/InterruptableSensorBase.h +++ b/wpilibc/athena/include/InterruptableSensorBase.h @@ -27,7 +27,7 @@ class InterruptableSensorBase : public SensorBase { virtual HAL_Handle GetPortHandleForRouting() const = 0; virtual AnalogTriggerType GetAnalogTriggerTypeForRouting() const = 0; virtual void RequestInterrupts( - InterruptHandlerFunction handler, + HAL_InterruptHandlerFunction handler, void* param); ///< Asynchronus handler version. virtual void RequestInterrupts(); ///< Synchronus Wait version. virtual void diff --git a/wpilibc/athena/src/InterruptableSensorBase.cpp b/wpilibc/athena/src/InterruptableSensorBase.cpp index b2772d89ec..487fa05349 100644 --- a/wpilibc/athena/src/InterruptableSensorBase.cpp +++ b/wpilibc/athena/src/InterruptableSensorBase.cpp @@ -22,7 +22,7 @@ InterruptableSensorBase::InterruptableSensorBase() {} * thread. The default is interrupt on rising edges only. */ void InterruptableSensorBase::RequestInterrupts( - InterruptHandlerFunction handler, void* param) { + HAL_InterruptHandlerFunction handler, void* param) { if (StatusIsFatal()) return; wpi_assert(m_interrupt == HAL_kInvalidHandle);