• 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/blo­b/master/targetlibs/stm32f4/lib/stm32f4x­x_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 :/

About

Avatar for Gordon @Gordon started