I'm a newbie just starting to learn about stm32 and have some confusion with the HAL library, thank you so much for taking the time to help.
I used STM32 to generate code, in the MX_GPIO_Init() and then try to understand how these functions work but i don't fully understand. -Marco below initializes portC's clk, but why put it in a loop that is sure to run only once:
#define __HAL_RCC_GPIOC_CLK_ENABLE() do { \
__IO uint32_t tmpreg; \
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPCEN);\
/* Delay after an RCC peripheral clock enabling */\
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPCEN);\
UNUSED(tmpreg); \
} while(0U)
-i want to ask an other question, i understand this code is checking if the GPIOx is valid
assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
but:
#define assert_param(expr) ((void)0U);
As I understand, assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
will be replaced by ((void)0U)
, where did I misunderstand?
i know it is important to understand and able to build project from scratch. But in companies, will project use libraries like HAL?