libyggdrasil  v1.0.0
bsp::mid::drv::TimerChannel< Context, Channel, Size > Struct Template Reference

Timer channel implementation for Midgard. More...

#include <timer.hpp>

Public Member Functions

ALWAYS_INLINE bool startPwm () const noexcept
 Start PWM generation for the channel. More...
 
ALWAYS_INLINE bool stopPwm () const noexcept
 Stop PWM generation for the channel. More...
 
ALWAYS_INLINE bool setPolarityHigh (bool highActive=true) const noexcept
 Start set pwm polarity. More...
 
ALWAYS_INLINE bool setDutyCycle (float dutyCycle) const noexcept
 Set the duty cycle as a float value. More...
 

Detailed Description

template<auto Context, u8 Channel, typename Size>
struct bsp::mid::drv::TimerChannel< Context, Channel, Size >

Timer channel implementation for Midgard.

Warning
Do not use this on its own!
Template Parameters
ContextTimer context
ChannelTimer channel number
SizeTimer width (16 bit or 32 bit)

Member Function Documentation

◆ setDutyCycle()

template<auto Context, u8 Channel, typename Size >
ALWAYS_INLINE bool bsp::mid::drv::TimerChannel< Context, Channel, Size >::setDutyCycle ( float  dutyCycle) const
inlinenoexcept

Set the duty cycle as a float value.

Parameters
dutyCycleDuty cycle in % [0 100]
Returns
Success

◆ setPolarityHigh()

template<auto Context, u8 Channel, typename Size >
ALWAYS_INLINE bool bsp::mid::drv::TimerChannel< Context, Channel, Size >::setPolarityHigh ( bool  highActive = true) const
inlinenoexcept

Start set pwm polarity.

Parameters
highActiveSet channel to high active when true
Returns
Success

◆ startPwm()

template<auto Context, u8 Channel, typename Size >
ALWAYS_INLINE bool bsp::mid::drv::TimerChannel< Context, Channel, Size >::startPwm ( ) const
inlinenoexcept

Start PWM generation for the channel.

Note
A duty cycle should be set with setDuty()
Returns
Success

◆ stopPwm()

template<auto Context, u8 Channel, typename Size >
ALWAYS_INLINE bool bsp::mid::drv::TimerChannel< Context, Channel, Size >::stopPwm ( ) const
inlinenoexcept

Stop PWM generation for the channel.

Note
This function disables the counter when no PWM channel is active
Returns
Success

The documentation for this struct was generated from the following file: