Reconfigure display (and dac) driver

This commit is contained in:
Jan-Henrik 2020-02-23 11:30:52 +01:00
parent cc015fbdc8
commit 8315de5d05

View file

@ -55,16 +55,16 @@ void SysTick_Handler()
void TIM2_IRQHandler(void) void TIM2_IRQHandler(void)
{ {
// this will get called with 8kHz (foof)
if (TIM_GetITStatus(TIM2, TIM_IT_Update) == RESET) { if (TIM_GetITStatus(TIM2, TIM_IT_Update) == RESET) {
return; return;
} }
TIM_ClearITPendingBit(TIM2, TIM_IT_Update); TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
// this will get called with 8kHz (foof)
// which still is a lot (60fps would be enough tbh)
static uint8_t count = 0; static uint8_t count = 0;
count++; count++;
if (count % (192 * 2) == 0) { if (count % (8000L / 60) == 0) {
// refresh display with 60fps
ui.Flush(); ui.Flush();
count = 0; count = 0;
} }
@ -80,7 +80,7 @@ void InitTimers(void)
{ {
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
TIM_TimeBaseInitTypeDef timer_init; TIM_TimeBaseInitTypeDef timer_init;
timer_init.TIM_Period = F_CPU / (48000 * 4) - 1; timer_init.TIM_Period = F_CPU / (8000 * 1) - 1;
timer_init.TIM_Prescaler = 0; timer_init.TIM_Prescaler = 0;
timer_init.TIM_ClockDivision = TIM_CKD_DIV1; timer_init.TIM_ClockDivision = TIM_CKD_DIV1;
timer_init.TIM_CounterMode = TIM_CounterMode_Up; timer_init.TIM_CounterMode = TIM_CounterMode_Up;