From f34e58241cd8c4076cfed99ec53e7525302071b3 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Fri, 21 Oct 2022 14:23:18 +0200 Subject: [PATCH] :clown_face: (stubs): Kernel - Add addElapsedTimeToTickCount function This function allows to us to only give delay without caring about the present tick count --- tests/unit/stubs/stubs/mbed/Kernel.h | 2 ++ tests/unit/stubs/stubs/mbed/source/Kernel.cpp | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unit/stubs/stubs/mbed/Kernel.h b/tests/unit/stubs/stubs/mbed/Kernel.h index c1e80f17cd..6195ec6fdd 100644 --- a/tests/unit/stubs/stubs/mbed/Kernel.h +++ b/tests/unit/stubs/stubs/mbed/Kernel.h @@ -12,4 +12,6 @@ extern int64_t spy_kernel_tick_count; void spy_kernel_setTickCount(int64_t count); +void spy_kernel_addElapsedTimeToTickCount(std::chrono::milliseconds elapsed_time); + } // namespace leka diff --git a/tests/unit/stubs/stubs/mbed/source/Kernel.cpp b/tests/unit/stubs/stubs/mbed/source/Kernel.cpp index a1fa5e5fb9..598cfa903f 100644 --- a/tests/unit/stubs/stubs/mbed/source/Kernel.cpp +++ b/tests/unit/stubs/stubs/mbed/source/Kernel.cpp @@ -4,7 +4,7 @@ #include "../Kernel.h" -uint64_t rtos::Kernel::impl::get_tick_count() +auto rtos::Kernel::impl::get_tick_count() -> uint64_t { return leka::spy_kernel_tick_count; } @@ -18,4 +18,8 @@ void spy_kernel_setTickCount(int64_t count) spy_kernel_tick_count = count; } +void spy_kernel_addElapsedTimeToTickCount(std::chrono::milliseconds elapsed_time) +{ + spy_kernel_tick_count += elapsed_time.count(); +} } // namespace leka