optimisation: Timer constructor can be constexpr

Change in memory:
Flash: -206 bytes
SRAM: -16 bytes
This commit is contained in:
Guðni Már Gilbert 2023-08-20 19:39:38 +00:00
parent 2a71e681db
commit a89e06a54e
2 changed files with 4 additions and 12 deletions

View File

@ -6,17 +6,6 @@
#include "Timer.h"
#include "system_timer.h"
/**
* @brief construct Timer
*
* It is guaranteed, that construction is equivalent with zeroing all members.
* This property can be exploited in menu_data.
*/
template<typename T>
Timer<T>::Timer() : m_isRunning(false), m_started()
{
}
/**
* @brief Start timer
*/

View File

@ -17,7 +17,10 @@ template <class T>
class Timer
{
public:
Timer();
inline constexpr Timer()
: m_isRunning(false)
, m_started(0) {};
void start();
void stop(){m_isRunning = false;}
bool running()const {return m_isRunning;}