Files
Shmingo-HAL/Core/Include/SHAL_TIM.h
2025-08-28 20:56:51 -07:00

39 lines
644 B
C++

#ifndef SHAL_TIM_H
#define SHAL_TIM_H
#include "SHAL_TIM_REG.h"
#include "SHAL_TIM_CALLBACK.h"
class Timer {
public:
explicit Timer(Timer_Key t);
//Starts the counter
void start();
//Stops the counter
void stop();
//Set prescaler value
void setPrescaler(uint16_t presc);
//Set auto reload register
void setARR(uint16_t arr);
//Enable interrupts
void enableInterrupt();
//Set timer IRQ callback function
void setCallbackFunc(TimerCallback callback){
registerTimerCallback(timer, callback);
}
private:
Timer_Key timer;
volatile TIM_TypeDef* timer_reg;
};
#endif