Skip to content
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

[fix] Remove unused template parameter from GeneralPurposeTimer::signalToChannel() #1142

Conversation

TomSaw
Copy link
Contributor

@TomSaw TomSaw commented Mar 10, 2024

Looks like @chris-durand left some dev artifacts in there.

@salkinium salkinium requested a review from chris-durand March 10, 2024 13:43
@salkinium salkinium added this to the 2024q1 milestone Mar 10, 2024
@TomSaw TomSaw force-pushed the fix/remove_unused_temp_par_from_signalToChannel branch from 17bea54 to 6206aeb Compare March 10, 2024 14:32
Copy link
Member

@salkinium salkinium left a comment

Choose a reason for hiding this comment

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

Thanks!

@salkinium salkinium added the ci:hal Triggers the exhaustive HAL compile CI jobs label Mar 12, 2024
Copy link
Member

@chris-durand chris-durand left a comment

Choose a reason for hiding this comment

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

The code removed here actually serves an important purpose. It prevents using a signal that belongs to a different timer.

For instance, trying to write Timer4::setCompareValue<GpioB7::Ch4>(0); on an STM32G474 is now correctly rejected with

modm/src/modm/platform/gpio/data.hpp:1410:26: error: static assertion failed: GpioB7::Ch4 only connects to Tim3!
 1410 |         static_assert((p == Peripheral::Tim3),"GpioB7::Ch4 only connects to Tim3!"); };
      |                       ~~~^~~~~~~~~~~~~~~~~~~~
modm/src/modm/platform/gpio/data.hpp:1410:26: note: '(modm::platform::Peripheral::Tim4 == modm::platform::Peripheral::Tim3)' evaluates to false

The signal GpioB7::Ch4 is channel 4 of another timer. With the change proposed here this would silently change the settings of another channel unrelated to that respective GPIO for the timer in question.

The static assert is triggered on construction of the empty SignalConnection object that is removed in this PR. No runtime code is emitted anyway. As the code works as expected, I'd recommend closing this PR.

@salkinium
Copy link
Member

Good catch! I completely forgot about how SignalConnection works…

@salkinium salkinium closed this Mar 12, 2024
@TomSaw TomSaw deleted the fix/remove_unused_temp_par_from_signalToChannel branch March 14, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:hal Triggers the exhaustive HAL compile CI jobs fix 💎
Development

Successfully merging this pull request may close these issues.

3 participants