Search code examples
coding-stylestm32hal

Why are public procedures in peripheral files prefixed with MX_***?


public names of procedures that CUBE generates have a prefix MX_***.

For example can.h:

/* USER CODE END Private defines */

void MX_CAN_Init(void);

/* USER CODE BEGIN Prototypes */

What does MX mean? I mean, how does MX stand for.

P.S. I know that from a functional point of view, it doesn't matter what the procedure is called. This is a codestyle question.


Solution

  • Notice that these functions don't have any parameters, still they magically configure the relevant modules. This is because they are not pre-defined library functions; instead their definitions are auto-generated by the STM32CubeMX during project generation, specifically for your project and configuration.

    For comparison, the pre-defined library functions start with HAL_ prefix.