aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder
diff options
context:
space:
mode:
Diffstat (limited to 'CAN-binder')
-rw-r--r--CAN-binder/low-can-binding/utils/timer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/CAN-binder/low-can-binding/utils/timer.cpp b/CAN-binder/low-can-binding/utils/timer.cpp
index 8c6215b..7edb0d5 100644
--- a/CAN-binder/low-can-binding/utils/timer.cpp
+++ b/CAN-binder/low-can-binding/utils/timer.cpp
@@ -57,7 +57,10 @@ frequency_clock_t::frequency_clock_t()
frequency_clock_t::frequency_clock_t(float frequency)
: unit_{1000000}, frequency_{frequency}, last_tick_{0}, time_function_{nullptr}
-{}
+{
+ if(frequency_ <= 0)
+ frequency_ = 1;
+}
/// @brief Return the period in ms given the frequency in hertz.
/// @param[in] frequency - Frequency to convert, in hertz