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

[stm32] fix stm32 timer complementary channel #1016

Closed

Conversation

hshose
Copy link
Contributor

@hshose hshose commented May 5, 2023

Proposed fix for #1011

I'm not sure, for which STM32 to add this functionality. Since the configureOutputChannel function is also enabled for all advanced timers, I would propose doing the same...

@hshose hshose force-pushed the fix/stm32_timer_complementary_channel branch from f5b48c9 to 59e0846 Compare May 5, 2023 15:07
@rleh rleh added the fix 💎 label May 5, 2023
@rleh rleh added this to the 2023q2 milestone May 5, 2023
@rleh rleh linked an issue May 5, 2023 that may be closed by this pull request
@hshose
Copy link
Contributor Author

hshose commented May 5, 2023

Ok, seems that checking for signal beeing ChXn in signalToChannel and signalIsComplementaryChannel might be a stupid idea, since that is device dependent. Maybe for now include only whitelist, aka:

%% if taget.family == "g4"
if constexpr ((Signal::Signal == Gpio::Signal::Ch1) || (Signal::Signal == Gpio::Signal::Ch1n)) {
%% else
if constexpr ((Signal::Signal == Gpio::Signal::Ch1) {
%% endif

@@ -275,11 +275,11 @@ protected:
signalToChannel()
{
modm::platform::detail::SignalConnection<Signal, p>{};
if constexpr (Signal::Signal == Gpio::Signal::Ch1) {
if constexpr ((Signal::Signal == Gpio::Signal::Ch1) || (Signal::Signal == Gpio::Signal::Ch1n)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This works for g4 and maybe some other families, but not for older f series cpus...

Copy link
Member

Choose a reason for hiding this comment

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

The inverted channel 4 only exists on G4, H5 and U5 devices. On others Gpio::Signal::Ch4n is not a valid expression.

@salkinium
Copy link
Member

Does this PR add more fixes than #1018? If not, please close :-P

@hshose hshose closed this May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

STM32G4: modm interface hides some of Timer features
4 participants