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.
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 is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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.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 asTIM_TimeBaseInit
- they just randomly changed the name to make it painful for everyone :/