timer: resolve a constructor issue
This commit is contained in:
parent
52c4ebb003
commit
17116e84ce
@ -70,6 +70,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
volatile std::atomic_int counter;
|
volatile std::atomic_int counter;
|
||||||
volatile std::atomic_int timer;
|
volatile std::atomic_int timer;
|
||||||
|
uint32_t freq;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* TIMER_H_ */
|
#endif /* TIMER_H_ */
|
||||||
|
|||||||
@ -17,12 +17,13 @@ extern "C"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer::Timer (uint32_t freq = 1000)
|
Timer::Timer (uint32_t freq) : freq (freq)
|
||||||
{
|
{
|
||||||
Chip_Clock_SetSysTickClockDiv (1);
|
Chip_Clock_SetSysTickClockDiv (1);
|
||||||
uint32_t sysTickRate = Chip_Clock_GetSysTickClockRate ();
|
uint32_t sysTickRate = Chip_Clock_GetSysTickClockRate ();
|
||||||
SysTick_Config (sysTickRate / freq);
|
SysTick_Config (sysTickRate / freq);
|
||||||
counter = 0;
|
counter = 0;
|
||||||
|
timer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer::~Timer ()
|
Timer::~Timer ()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user