STM32l496 Sleep Mode problem with FreeRTOS

This function is called when some conditions are meet.

I did not try before calling the schedualer. Thanks for this idea. I will try it tomorrow and update here.