From the STM32 Firmware Library, the STM32 Firmware Library
The biggest difference between STM32 and general single-chip microcomputer/ARM7 is that it has many registers, and it is difficult for users to write down all of them. Therefore, ST officially provides a set of library function source code according to the specifications, you can directly operate the database functions to perform register operations.
The Firmware Library is a set of functions. The function of the Firmware Library is responsible for directly dealing with registers and providing APIs called by the user functions ).
In the previous 51 Single-Chip Microcomputer Development, we often directly operate on registers, such as controlling the I/O port status:
P0 = 0x11;
During the development of STM32, register operations are also performed:
GPIOx-> BRR = 0x0011;
To control the BRR register to implement level control, there is an officially encapsulated function, as shown below:
Void GPIO_ResetBits (GPIO_TypeDef * GPIO, uint16_t GPIO_Pin) {GPIO-> BRR = GPIO_Pin ;}
In this case, you do not need to directly operate the BRR register. You only need to know how to use the GPIO_ResetBits () function.