Merge pull request #124 from juribeparada/master

Better way for sampling frequency calculation for MMDVM-Pi
nxdn
Jonathan Naylor 2017-10-16 09:23:58 +01:00 committed by GitHub
commit 8d7b4ef84d
1 changed files with 3 additions and 2 deletions

View File

@ -642,12 +642,13 @@ void CIO::startInt()
// TIM2 output frequency
#if defined(EXTERNAL_OSC) && !defined(STM32F4_PI)
timerInitStructure.TIM_Prescaler = (uint16_t) ((EXTERNAL_OSC/(2*SAMP_FREQ)) - 1);
timerInitStructure.TIM_Period = 1;
#else
timerInitStructure.TIM_Prescaler = (uint16_t) ((SystemCoreClock/(4*SAMP_FREQ)) - 1);
timerInitStructure.TIM_Prescaler = (uint16_t) ((SystemCoreClock/(6*SAMP_FREQ)) - 1);
timerInitStructure.TIM_Period = 2;
#endif
timerInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
timerInitStructure.TIM_Period = 1;
timerInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
timerInitStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM2, &timerInitStructure);