Initial commit
This commit is contained in:
14
Source/Core/Src/timer.c
Normal file
14
Source/Core/Src/timer.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "timer.h"
|
||||
|
||||
void tim6_init()
|
||||
{
|
||||
RCC->APB1ENR1 |= RCC_APB1ENR1_TIM6EN;
|
||||
|
||||
TIM6->PSC = 16000 - 1; // 16 MHz / 16000 = 1000 Hz (1 ms)
|
||||
TIM6->ARR = 2 - 1; // 2 ms
|
||||
|
||||
TIM6->DIER |= TIM_DIER_UIE; // interrupt enable
|
||||
TIM6->CR1 |= TIM_CR1_CEN; // counter enable
|
||||
|
||||
NVIC_EnableIRQ(TIM6_DAC_IRQn);
|
||||
}
|
||||
Reference in New Issue
Block a user