From 013c619eaf4b15e5c77cc171e8cc385e592b047b Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 26 Feb 2023 16:26:25 +0100 Subject: [PATCH] Fix function type to remove compiler warnings. --- src/include/timer_utils.h | 7 +------ src/timer_utils.c | 10 ++-------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/include/timer_utils.h b/src/include/timer_utils.h index 69d309f..5efcc44 100644 --- a/src/include/timer_utils.h +++ b/src/include/timer_utils.h @@ -10,12 +10,7 @@ typedef struct void (*funcToBeCalled)(void); } tmr_ctx; -void tmr_timerOverflow(); - void tmr_initTimer(tmr_ctx *ctx); - -void *tmr_handleTimerOverflow(void *timer_context); - +void tmr_handleTimerOverflow(union sigval); int tmr_callEveryMs(void (*func)(void)); - void tmr_add_ns_to_current_time(struct itimerspec *current, long usecs); \ No newline at end of file diff --git a/src/timer_utils.c b/src/timer_utils.c index 128c19a..d31bbf5 100644 --- a/src/timer_utils.c +++ b/src/timer_utils.c @@ -7,10 +7,6 @@ #include "time_scales.h" #include "timer_utils.h" -void tmr_timerOverflow() -{ -} - void tmr_initTimer(tmr_ctx *ctx) { ctx->sevp = (struct sigevent){ @@ -25,15 +21,13 @@ void tmr_initTimer(tmr_ctx *ctx) timer_settime(ctx->timerid, TIMER_ABSTIME, &ctx->times, NULL); } -void *tmr_handleTimerOverflow(void *ctx_par) +void tmr_handleTimerOverflow(sigval_t ctx_par) { - tmr_ctx *ctx = (tmr_ctx *)ctx_par; + tmr_ctx *ctx = (tmr_ctx *)ctx_par.sival_ptr; ctx->funcToBeCalled(); tmr_add_ns_to_current_time(&ctx->times, ctx->interval); timer_settime(ctx->timerid, TIMER_ABSTIME, &ctx->times, NULL); - - return (void *)0; } int tmr_callEveryMs(void (*func)(void))