Skip to content

Conversation

@MrAbhi19
Copy link

This PR introduces a simple demo in /Src/examples/stm32f4xx_hal_led.c that toggles an LED using STM32F4 HAL functions. The example is designed for beginners and includes clear comments explaining the underlying register-level operations (RCC_AHB1ENR, GPIOx_MODER, GPIOx_ODR, etc.).

Details:

  • Added new source file: /Src/examples/stm32f4xx_hal_led.c
  • Updated README.md with a section highlighting the example
  • Example assumes LED on GPIOD Pin 12 (STM32F4 Discovery board), but can be adapted to other pins/boards
  • Comments connect HAL abstractions with hardware registers for educational clarity

Motivation:
The goal is to make the repository more accessible to students and first-time contributors by providing a reproducible, beginner-friendly demo. This contribution aligns with the repo’s mission of offering HAL drivers and examples that bridge abstraction with hardware logic.

Impact:

  • Helps newcomers understand how HAL functions map to registers
  • Provides a ready-to-run LED blink demo for testing setup
  • Strengthens educational value of the STM32F4 HAL driver repo

Added beginner-friendly GPIO LED blink example with register explanations

This commit introduces a simple demo in /Src/examples/stm32f4xx_hal_led.c
that toggles an LED using STM32F4 HAL functions. Clear comments are
included to explain the underlying register-level operations (RCC_AHB1ENR,
GPIOx_MODER, GPIOx_ODR, etc.), making it easier for students to connect
HAL abstractions with hardware registers. The README is updated to
reference this example for newcomers.
Updated README with beginner-friendly GPIO LED blink example

This update adds a new section to the README highlighting the
stm32f4xx_hal_led.c demo in /Src/Examples. The section explains how
the example uses STM32F4 HAL functions alongside register-level
comments (RCC_AHB1ENR, GPIOx_MODER, GPIOx_ODR) to help beginners
connect HAL abstractions with hardware logic. This makes the repo
more accessible for students and first-time contributors.
@MrAbhi19
Copy link
Author

Thanks for reviewing this PR!
I’ve added a beginner-friendly GPIO LED blink example in /Src/examples with clear register-level notes.
The goal is to help students connect HAL functions with the underlying hardware logic.
Looking forward to your feedback!

@ALABSTM ALABSTM linked an issue Nov 28, 2025 that may be closed by this pull request
@ALABSTM ALABSTM added enhancement New feature or request hal HAL-LL driver-related issue or pull-request. gpio General Purpose Inputs and Outputs labels Nov 28, 2025
@ALABSTM
Copy link
Collaborator

ALABSTM commented Nov 28, 2025

Hello @MrAbhi19,

Thank you for this proposal. However, we already provide such a beginner-friendly example, like this, running on a STM32F410 Nucleo board. As you can see from the code snippet below, it toggles an LED using a while(1) loop and a delay function.

  /*##-3- Toggle PA05 IO in an infinite loop #################################*/  
  while (1)
  {
    HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
    
    /* Insert a 100ms delay */
    HAL_Delay(100);
  }

Moreover, this repository is solely dedicated to host the drivers. Examples are rather hosted in the firmware repository under the Projects folder here.

With regards,

@ALABSTM ALABSTM moved this from To do to Analyzed in stm32cube-mcu-hal-dashboard Nov 28, 2025
@ALABSTM
Copy link
Collaborator

ALABSTM commented Nov 28, 2025

Hello @MrAbhi19,

Please allow me to close this pull request. Thank you for your understanding and thank you again for this proposal.

With regards,

@ALABSTM ALABSTM closed this Nov 28, 2025
@github-project-automation github-project-automation bot moved this from Analyzed to Done in stm32cube-mcu-hal-dashboard Nov 28, 2025
@ALABSTM ALABSTM added the invalid This doesn't seem right label Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gpio General Purpose Inputs and Outputs hal HAL-LL driver-related issue or pull-request. invalid This doesn't seem right

Projects

Development

Successfully merging this pull request may close these issues.

Add beginner-friendly GPIO HAL example with register explanation

3 participants