__hal_lock(__handle__)

I don’t know what __HAL_LOCK() and __HAL_UNLOCK() do, but ST’s own tools generate FreeRTOS projects - what do they do for this? Can you just use a project as provided by ST?