Skip to content

Commit 04b105a

Browse files
author
Sergey Pluzhnikov
committed
STM32 Timers: Add isComplementaryChannel() function
1 parent a3d21e3 commit 04b105a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/modm/platform/timer/stm32/general_purpose_base.hpp.in

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,26 @@ public:
269269
static uint16_t
270270
getCompareValue(uint32_t channel);
271271

272+
public:
273+
template< typename Signal>
274+
static consteval bool
275+
isComplementaryChannel()
276+
{
277+
%% for signal, number in signals if signal in ["Ch1n","Ch2n","Ch3n","Ch4n"]
278+
%% if loop.first
279+
if constexpr (Signal::Signal == Gpio::Signal::{{ signal }}) {
280+
return true;
281+
%% else
282+
} else if constexpr (Signal::Signal == Gpio::Signal::{{ signal }}) {
283+
return true;
284+
%% endif
285+
%% if loop.last and loop.length > 0
286+
}
287+
%% endif
288+
%% endfor
289+
return false;
290+
}
291+
272292
protected:
273293
template<Peripheral p, typename Signal>
274294
static consteval int

0 commit comments

Comments
 (0)