HAL_GPIO_Init
//Initialize the working mode of the pins we need to use, including the working speed of the specific pin, whether to reuse mode, pull-up and pull-down and other parameters.
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
HAL_GPIO_DeInit
// Restore the pins after initialization to the default state - the value when each register is reset
void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
Example: HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
HAL_GPIO_ReadPin
// Read the level status of the pin we want to know, the function return value is 0 or 1.
GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
Example: pin_State = HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_9);
HAL_GPIO_WritePin
//Write 0 or 1 to a certain pin, but don't understand it as writing 1 means enabling. Writing 1 to some registers means erasing. void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin
, GPIO_PinState PinState)
example :HAL_GPIO_WritePin(GPIOF, GPIO_PIN_9,GPIO_PIN_RESET)
HAL_GPIO_TogglePin
// Flip the level state of a certain pin
void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
Example: HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_9);
HAL_GPIO_LockPin
// If the current status of a pin is 1, use the lock to read the pin value. When the pin level changes, the locked value is maintained until reset. HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef*
GPIOx, uint16_t GPIO_Pin)
Example:
HAL_StatusTypeDef hal_State;
hal_State = HAL_GPIO_LockPin(GPIOF, GPIO_PIN_9);
HAL_GPIO_EXTI_IRQHandler
// This function is an external interrupt service function, used to respond to the triggering of external interrupts. There are two functions in the function entity, 1 is to clear the interrupt flag bit, and 2 is to call the callback function introduced below.
What is actually called is the interrupt callback function void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin) below.
Example: HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3);
HAL_GPIO_EXTI_Callback
//Interrupt callback function can be understood as the specific action to be responded to by the interrupt function.
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
Example: HAL_GPIO_EXTI_Callback(GPIO_Pin);