#pragma once #include "stm32h5xx_hal.h" #include #include class TaskHelper { public: template static void WaitFor(Func func, int timeoutMilliseconds) { auto start = HAL_GetTick(); while (!func()) { uint32_t now = HAL_GetTick(); if ((now - start) > static_cast(timeoutMilliseconds)) { throw std::runtime_error("Operation timed out"); } } } };