Yeah, that code is using ST's API rather than poking registers (mostly!).
You'll need to look at the ST reference manual, check out the registers, and what stuff like timer.Init.CounterMode = TIM_COUNTERMODE_CENTERALIGNED3 actually corresponds to.
timer.Init.CounterMode = TIM_COUNTERMODE_CENTERALIGNED3
It might help to cheat and look at what ST's API does itself: https://github.com/espruino/Espruino/blob/master/targetlibs/stm32f4/lib/stm32f4xx_tim.c#L302
Note that ST tend to change their API quite a lot and I got fed up chasing them a few years ago, so Espruino's libraries are old. HAL_TIM_Base_Init will be pretty much the same as TIM_TimeBaseInit - they just randomly changed the name to make it painful for everyone :/
© Espruino, powered by microcosm.
Report a problem