Explicit casting unsigned long to TimerHandle_t
The timer_t type when expanded results in an unsigned long in some Microchip compilers. The compiler does an implicit typecast (which is also bad) which we cannot get around, thus to suppress the warnings, we explicitly typecast the unsigned long to TimerHandle_t. TimerHandle_t is a struct pointer.
@@ -152,7 +152,7 @@ int timer_create( clockid_t clockid,
int timer_delete( timer_t timerid )
{
- TimerHandle_t xTimerHandle = timerid;
+ TimerHandle_t xTimerHandle = ( TimerHandle_t ) timerid;
timer_internal_t * pxTimer = ( timer_internal_t * ) pvTimerGetTimerID( xTimerHandle );
/* The value of the timer ID, set in timer_create, should not be NULL. */
@@ -193,7 +193,7 @@ int timer_settime( timer_t timerid,
struct itimerspec * ovalue )
{
int iStatus = 0;
- TimerHandle_t xTimerHandle = timerid;
+ TimerHandle_t xTimerHandle = ( TimerHandle_t ) timerid;
timer_internal_t * pxTimer = ( timer_internal_t * ) pvTimerGetTimerID( xTimerHandle );
TickType_t xNextTimerExpiration = 0, xTimerExpirationPeriod = 0;
@@ -295,7 +295,7 @@ int timer_settime( timer_t timerid,
int timer_gettime( timer_t timerid,
struct itimerspec * value )
{
- TimerHandle_t xTimerHandle = timerid;
+ TimerHandle_t xTimerHandle = ( TimerHandle_t ) timerid;
timer_internal_t * pxTimer = ( timer_internal_t * ) pvTimerGetTimerID( xTimerHandle );
TickType_t xNextExpirationTime = xTimerGetExpiryTime( xTimerHandle ) - xTaskGetTickCount(),
xTimerExpirationPeriod = pxTimer->xTimerPeriod;
