Skip to content

✨ STM32F1 Timer #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 30, 2025
Merged

✨ STM32F1 Timer #129

merged 5 commits into from
May 30, 2025

Conversation

50xp50
Copy link
Contributor

@50xp50 50xp50 commented May 21, 2025

Resolves #6

  • Implemented 'hal::timer` stm32_generic helper class
  • Implemented hal::stm32f1::timer interface
  • Updated hal::stm32f1::pwm
    • Removed now redundant static availability member variable to track pins
    • Updated demo to include old_pwm version
  • Updated libhal-arm-mcu/stm32f1/timer
    • Updated advanced timer and general purpose timer manager classes
      • Added manager_data member variable to track timer state information
        • Tracks current timer usage and throws if a conflicting resource is attempted to be acquired
        • Tracks amount of acquired resources
        • If manager was previously being used but is no longer, gets released to acquire other resources
      • Fixed general_purpose_timer to use general_purpose_timer/general_purpose_timer_manager style
      • Fixed private acquire functions by making them protected
  • Updated libhal-arm-mcu/stm32f1/interrupt
    • Added is_interrupt_enabled function to check if an interrupt vector is already being used
  • Updated libhal-arm-mcu/stm32f1/power
    • Added reset_peripheral function to allow resets for peripherals
  • Updated and fixed documentation

@50xp50 50xp50 changed the title STM32F1 Timer ✨ STM32F1 Timer May 21, 2025
@50xp50 50xp50 requested a review from kammce May 21, 2025 03:42
Copy link
Member

@kammce kammce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few things to fix up in some wording. And ignore the things I recommended you change for the demos. We can add that in the next change. Otherwise, everything looks great!

@kammce kammce marked this pull request as ready for review May 28, 2025 19:21
50xp50 added 4 commits May 30, 2025 12:54
- Added timer interface for stm32f1 series
- Added a working demo for the stm32f1 timer
- Added generic timer helper/interface for STM32 MCUs
- Updated general_purpose_timer to use a manager
Note: This is an unpolished, but working commit. Will improve it.
- Updated demo to rename it and clean it up
- Added new function to check if a specific interrupt vector is enabled
- Improved and cleaned up commenting
- Fixed schedule timing calculation to accomodate edge cases
- Removed remnants of basic_timer to be added in separate PR
- Moved some manager functions from protected to public
- Updated timer managers to track resource allocation. Prevents
reusing of same timer for incompatible features such as callbacks
& pwm.
-  Tested and working copy for both the callback functionality as
well as pwm generation.
@50xp50 50xp50 force-pushed the STM32F1_Timer branch 2 times, most recently from 2676704 to 968232f Compare May 30, 2025 20:01
- Updated and fixed documentation
- Removed now redundant static pwm availability variable
- Updated resource_count to just raw count instead of bit mask
- Added reset_peripheral function to power.cpp
@50xp50 50xp50 requested a review from kammce May 30, 2025 20:18
@kammce kammce merged commit 03fd406 into libhal:main May 30, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add hal::stm32f1::timer
2 participants