Knowledge share- Arduino Freertos Deferred Callbacks and Software Timers

Make changes in FreertosConfig.h file.

#define INCLUDE_xTimerPendFunctionCall 1
#define configTIMER_TASK_PRIORITY 2
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE+(unsigned short)64)
Note: The timer stack size varies according to its callback function

for Low Power usage #define configUSE_TICKLESS_IDLE 1

Example:

#include <Arduino_FreeRTOS.h>
#include <timers.h>
#include <avr/sleep.h>
#include <util/atomic.h>
#include <stdlib.h>

#define ONESECONDDELAY 1000/portTICK_PERIOD_MS
#define HALFSECONDDELAY 500/portTICK_PERIOD_MS

#define TIMERBLOCKTIME UINT32_C(0xffff)
#define TIMERAUTORELOAD_ON 1

const byte interruptPin = 2;
void Application_init(void);
TimerHandle_t timer1;
TimerHandle_t timer2;

static void appDeferredISRCallback(void *interruptDataQueuePtr, uint32_t interruptData)
{
(void) interruptDataQueuePtr;
(void) interruptData;
Serial.println("appDeferredISRCallback received\n");
}

static void realTimeISRCallback(void)
{
signed portBASE_TYPE xHigherPriorityTaskWoken=pdFALSE;
if(xTimerPendFunctionCallFromISR(appDeferredISRCallback, NULL, 0, &xHigherPriorityTaskWoken)==pdPASS)
taskYIELD();

}

static void timer1_callback(void *pvParameters)
{
(void) pvParameters;
Serial.println(rand());
}

static void timer2_callback(void *pvParameters)
{
(void) pvParameters;
Serial.println(rand());
}

void Application_init(void)
{
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin),realTimeISRCallback, CHANGE);
timer1 = xTimerCreate("timer1", ONESECONDDELAY, TIMERAUTORELOAD_ON, NULL, timer1_callback);
timer2 = xTimerCreate("timer2", HALFSECONDDELAY, TIMERAUTORELOAD_ON, NULL, timer2_callback);

xTimerStart(timer1, TIMERBLOCKTIME);
xTimerStart(timer2, TIMERBLOCKTIME);
}

void setup() {

// initialize serial communication at 9600 bits per second:
Serial.begin(9600);

Application_init();

vTaskStartScheduler();
void vApplicationStackOverflowHook();
}

void loop()
{
// Remember that loop() is simply the freeRTOS idle task.
// It is only something to do, when there's nothing else to do.
set_sleep_mode( SLEEP_MODE_IDLE );

ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
sleep_enable();

#if defined(BODS) && defined(BODSE) // Only if there is support to disable the brown-out detection.
sleep_bod_disable();
#endif
}
sleep_cpu(); // good night.

// Ugh. I've been woken up. Better disable sleep mode.
sleep_disable();
}

My sincere thanks to Felipu