Skip to content

Remove blocking ctimer API support#533

Merged
jerrysxie merged 2 commits intoOpenDevicePartnership:mainfrom
jerrysxie:fix-blocking-countdown-ctimer
Dec 18, 2025
Merged

Remove blocking ctimer API support#533
jerrysxie merged 2 commits intoOpenDevicePartnership:mainfrom
jerrysxie:fix-blocking-countdown-ctimer

Conversation

@jerrysxie
Copy link
Contributor

@jerrysxie jerrysxie commented Dec 18, 2025

Removing blocking ctimer API support as there is no way to make this safe between different ctimer channels without interrupts and a blocking timer does not make a lot of sense. Plus the same functionality can be achieve using embassy timers.

This pull request removes the implementation of the CountingTimer for the Blocking mode from src/timer.rs. The main effect is that the blocking timer functionality, including the ability to create a blocking timer and wait synchronously for a countdown, is no longer available.

Removed blocking timer functionality:

  • Removed the impl<'p> CountingTimer<'p, Blocking> block, including the new_blocking constructor and the wait_us synchronous wait method, eliminating blocking mode support from the timer API.

@jerrysxie jerrysxie self-assigned this Dec 18, 2025
Copilot AI review requested due to automatic review settings December 18, 2025 03:15
@jerrysxie jerrysxie added the bug Something isn't working label Dec 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the blocking countdown timer implementation by enabling the stop-on-match hardware feature and updating the expiration detection logic accordingly.

  • Enables stop-on-match bits (mr0s, mr1s, mr2s, mr3s) in the MCR register so the timer automatically stops when the match condition is met
  • Changes expiration detection to check if the timer counter enable (cen) bit is cleared, which is a more reliable indicator after enabling stop-on-match
  • Renames count_timer_enable_interrupt to count_timer_enable to reflect that the function now configures both interrupt and stop-on-match behavior

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
src/timer.rs Renames timer enable function, adds stop-on-match configuration for all channels, and simplifies expiration check by monitoring the counter enable bit
examples/rt685s-evk/src/bin/timer.rs Fixes spelling error in comment and adds informational logging for timer start events

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

felipebalbi
felipebalbi previously approved these changes Dec 18, 2025
kurtjd
kurtjd previously approved these changes Dec 18, 2025
* Remove the blocking countdown timer implementation because it is not
  there is no safe way to implement sub timer channel in blocking mode
  without interrupts.
@jerrysxie jerrysxie dismissed stale reviews from kurtjd and felipebalbi via 25bbf55 December 18, 2025 18:23
@jerrysxie jerrysxie force-pushed the fix-blocking-countdown-ctimer branch from 70a11fa to 25bbf55 Compare December 18, 2025 18:23
@jerrysxie jerrysxie added the BREAKING CHANGE PR causes a breaking change label Dec 18, 2025
@jerrysxie jerrysxie changed the title Fix blocking countdown ctimer Remove blocking ctimer API support Dec 18, 2025
Copilot AI review requested due to automatic review settings December 18, 2025 18:25
@jerrysxie jerrysxie force-pushed the fix-blocking-countdown-ctimer branch from 25bbf55 to 5b2ae14 Compare December 18, 2025 18:25
felipebalbi
felipebalbi previously approved these changes Dec 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jerrysxie jerrysxie marked this pull request as ready for review December 18, 2025 18:40
@jerrysxie jerrysxie requested a review from a team as a code owner December 18, 2025 18:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jerrysxie
Copy link
Contributor Author

@jerrysxie jerrysxie merged commit 644bf24 into OpenDevicePartnership:main Dec 18, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING CHANGE PR causes a breaking change bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants