H7 working
This commit is contained in:
@@ -34,19 +34,19 @@ void Timer::start() {
|
||||
enableInterrupt();
|
||||
}
|
||||
|
||||
void Timer::stop() {
|
||||
void Timer::stop() const {
|
||||
auto rcc_reg = getTimerRCC(m_key);
|
||||
|
||||
SHAL_clear_bitmask(rcc_reg.reg,rcc_reg.enable_mask);
|
||||
}
|
||||
|
||||
void Timer::setPrescaler(const uint16_t presc) const {
|
||||
void Timer::setPrescaler(const uint32_t presc) const {
|
||||
auto prescalerReg = getTimerPrescalerRegister(m_key);
|
||||
|
||||
SHAL_set_bits(prescalerReg.reg,16,presc,0);
|
||||
}
|
||||
|
||||
void Timer::setARR(const uint16_t arr) const {
|
||||
void Timer::setARR(const uint32_t arr) const {
|
||||
auto autoReloadReg = getTimerAutoReloadRegister(m_key);
|
||||
|
||||
SHAL_set_bits(autoReloadReg.reg,16,arr,0);}
|
||||
@@ -56,7 +56,7 @@ void Timer::enableInterrupt() {
|
||||
NVIC_EnableIRQ(getIRQn(m_key));
|
||||
}
|
||||
|
||||
void Timer::init(uint16_t prescaler, uint16_t autoReload) {
|
||||
void Timer::init(uint32_t prescaler, uint32_t autoReload) {
|
||||
SHAL_TIM_RCC_Register rcc = getTimerRCC(m_key);
|
||||
|
||||
SHAL_apply_bitmask(rcc.reg,rcc.enable_mask);
|
||||
@@ -65,7 +65,7 @@ void Timer::init(uint16_t prescaler, uint16_t autoReload) {
|
||||
setARR(autoReload);
|
||||
}
|
||||
|
||||
void Timer::configurePWM(SHAL_Timer_Channel channel, uint16_t prescaler, uint16_t autoReload, uint16_t captureCompareThreshold) {
|
||||
void Timer::configurePWM(SHAL_Timer_Channel channel, uint32_t prescaler, uint32_t autoReload, uint32_t captureCompareThreshold) {
|
||||
|
||||
setPrescaler(prescaler);
|
||||
setARR(autoReload);
|
||||
@@ -76,7 +76,7 @@ void Timer::configurePWM(SHAL_Timer_Channel channel, uint16_t prescaler, uint16_
|
||||
setCaptureCompareValue(channel, captureCompareThreshold);
|
||||
}
|
||||
|
||||
void Timer::configureOneshot(SHAL_Timer_Channel channel, uint16_t prescaler, uint16_t autoReload, uint16_t captureCompareThreshold) {
|
||||
void Timer::configureOneshot(SHAL_Timer_Channel channel, uint32_t prescaler, uint32_t autoReload, uint32_t captureCompareThreshold) {
|
||||
|
||||
setPrescaler(prescaler);
|
||||
setARR(autoReload);
|
||||
@@ -87,7 +87,7 @@ void Timer::configureOneshot(SHAL_Timer_Channel channel, uint16_t prescaler, uin
|
||||
setCaptureCompareValue(channel, captureCompareThreshold);
|
||||
}
|
||||
|
||||
void Timer::setOutputCompareMode(SHAL_Timer_Channel channel, SHAL_TIM_Output_Compare_Mode outputCompareMode) {
|
||||
void Timer::setOutputCompareMode(SHAL_Timer_Channel channel, SHAL_TIM_Output_Compare_Mode outputCompareMode) const {
|
||||
|
||||
auto channelNum = static_cast<uint8_t>(channel);
|
||||
|
||||
@@ -114,7 +114,7 @@ void Timer::enableChannel(SHAL_Timer_Channel channel, SHAL_Timer_Channel_Main_Ou
|
||||
SHAL_set_bits(captureCompareEnableReg.reg,16,setValue,0);
|
||||
}
|
||||
|
||||
void Timer::setCaptureCompareValue(SHAL_Timer_Channel channel, uint16_t value) {
|
||||
void Timer::setCaptureCompareValue(SHAL_Timer_Channel channel, uint32_t value) const {
|
||||
auto captureCompareReg = getTimerCaptureCompareRegister(m_key,channel);
|
||||
|
||||
SHAL_set_bits(captureCompareReg.reg,16,value,0);
|
||||
|
||||
Reference in New Issue
Block a user