Modify STM32F10x_StdPeriph_Lib_V3.5.0 to Add GPIO_ToggleBits Fuction

GPIO_ToggleBits

When designing the Blinking experiment, I found that it’s not very convenient to drive the leds on/off in a brief way. The original method is to define a LEDx(ON/OFF) function to drive the leds on and off seperately, Because there is no toggle-bit function in STM32F10x_StdPeriph_Lib_V3.5.0. I guess that’s why in Fire’s manual, a self defined function is used.

Fire's Method

Finally I noticed that there is “GPIO_ToggleBits” Function in “stm32f4xx_gpio.c” of stm32f4_dsp_stdperiph_lib_v1.8.0. So I tried to transplant it into “stm32f10x_gpio.c” and “stm32f10x.h”, and it works. Method follows:

Function in stm32f10x_gpio.c

Declaration in stm32f10x_gpio.h

Declaration in bsp_led.h

Simulation in Proteus

Not real time running, just like always.¯\_(ツ)_/¯

Author: Epiapoq
Link: http://epiapoq.github.io/2021/08/11/ToggleBits/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.