Delete the timer from call back function

Hello, Can i somehow get the timer handler from within the callback function and delete it?

Delete the timer from call back function

The callback function is given a void* pointer, you can point that to the timer, or to a structure with a pointer to the timer.

Delete the timer from call back function

The callback function is given a void* pointer, you can point that to the timer, or to a structure with a pointer to the timer.

Delete the timer from call back function

Can you please give me an example?

Delete the timer from call back function

Thsi is what I am doing. ~~~ static void vTimerCallBackinitial( TimerHandlet xTimer ) { timerinfo=xTimerDelete(xTimer,0);//Delete the timer } void doipinitialactivity_timer(int id) {
    // Save the socket id in the currently available instance
        TimerHandle_t  one_shot_timer;
    BaseType_t xTimer1Started;
    one_shot_timer=xTimerCreate(
            /* Text name for the software timer - not used by FreeRTOS. */
            "Initial",
            /* The software timer's period in ticks. */
        INITIAL_ACTIVITY_TIMER_PERIOD,
            /* Setting uxAutoRealod to pdFALSE creates a one-shot software timer. */
            pdFALSE,
            /* This example does not use the timer id. */
            (void*)id,
            /* The callback function to be used by the software timer being created. */
            vTimerCallBackinitial);
    if(one_shot_timer != NULL)
    {
        xTimer1Started=xTimerStart(one_shot_timer, 0 );
        //Start the Multi shot timer
        if( ( xTimer1Started == pdPASS ))
        {
        print("Timer created");
        }

    }

else
{
    print("Timer not createdn");


}
} ~~~

Delete the timer from call back function

Above, I have posted mu code. Is it okay?

Delete the timer from call back function

I don’t think this is a valid thing to do. The callback function is called using the following code:
pxTimer->pxCallbackFunction( ( TimerHandle_t ) pxTimer );
where pxTimer is pointing to the same structure as the handle passed into the callback function. If the structure is deleted in the callback function then it is the structure that is being de-referenced that is being deleted. As the code stands today it should be ok as the timer callback just returns and the structure does not get referenced again after that – but that doesn’t mean it will be ok in future versions.