Library 53- GPIO for STM32F4

GPIO is main thing when connecting your device with external things. As you know, ST started with HAL drivers and they want to remove STD periph drivers on which I’m working on this site.

So this is a next step, how to be independent of things you use. GPIO is used everywhere on my libs, and most problems will be with porting GPIO stuff to new system (when it will be need for that). I will start to migrate all my libs to my GPIO system (which will then be easily to port to HAL layer) so I will update my libs and you will be notified about that.

For start, I’ve update my USART library and it worked just great.

New system is more flexible to select which pins you want to use in your peripheral. I will update all my libs to this version.



  • Works with standard peripheral drivers
  • Works with HAL drivers
  • All GPIO functions included
  • Easy GPIO initialization
  • Version 1.1 – March 09, 2015
    • Added option to deinit GPIO pin


    • STM32F4xx
    • STM32F4xx RCC
    • STM32F4xx GPIO
  • TM
    • defines.h

Functions and enumerations

Below are listed all functions which can be used with GPIO.


  • Bottom example just toggles leds, depending on which board you have selected on my Keil project template


Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!