Unified all current peripheral implementation syntax with macros

This commit is contained in:
Ea-r-th
2025-09-15 01:20:33 -07:00
parent 25b56f9fcd
commit b2d10f5e5e
6 changed files with 45 additions and 12 deletions

View File

@@ -18,6 +18,11 @@ class Timer {
friend class TimerManager;
public:
///
/// \param prescaler The amount of times the base clock has to cycle before the timer adds one to the count
/// \param autoReload The number of timer counts before the count is reset and IRQ is called
void init(uint32_t prescaler, uint32_t autoReload);
//Starts the counter
void start();
@@ -49,12 +54,16 @@ private:
#define getTimer(timer_key) TimerManager::get(timer_key)
#define TIM(num) TimerManager::getTimerFromIndex(num)
//Manages all timers so user does not have to personally initialize
class TimerManager{
public:
static Timer& get(Timer_Key);
static Timer& getTimerFromIndex(uint8_t index){return timers[index];}
TimerManager() = delete;
private: