generated from Template/H563ZI-HAL-CMake-Template
TaskHelper int 修改为 uint32_t
All checks were successful
Build and Upload Artifact / build and upload-artifact (push) Successful in 19m51s
All checks were successful
Build and Upload Artifact / build and upload-artifact (push) Successful in 19m51s
This commit is contained in:
@@ -7,13 +7,13 @@
|
||||
class TaskHelper {
|
||||
public:
|
||||
template <typename Func>
|
||||
static void WaitFor(Func func, int timeoutMilliseconds) {
|
||||
static void WaitFor(Func func, uint32_t timeoutMilliseconds) {
|
||||
auto start = HAL_GetTick();
|
||||
while (!func()) {
|
||||
uint32_t now = HAL_GetTick();
|
||||
if ((now - start) > static_cast<uint32_t>(timeoutMilliseconds)) {
|
||||
if ((now - start) > timeoutMilliseconds) {
|
||||
throw std::runtime_error("Operation timed out");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user