libyggdrasil  v1.0.0
bsp::drv::Timer< Context, TimerImpl, Size > Struct Template Reference

Base class for Timer abstraction. More...

#include <timer.hpp>

Public Types

using Impl = TimerImpl< Context, Size >
 

Public Member Functions

 Timer ()=delete
 
 Timer (const Timer &)=delete
 
 Timer (Timer &&)=delete
 

Static Public Member Functions

static auto init (auto ... args)
 Timer initialization. More...
 
static auto deinit (auto ... args)
 Timer deinitialization. More...
 
static void enable ()
 Enable the counter. More...
 
static void disable ()
 Disable the counter. More...
 
static Size getCount ()
 Get the counter value. More...
 
static void setCount (Size cnt)
 Set the counter value. More...
 
static void resetCount ()
 Set the counter value to 0. More...
 
static u32 getPwmFrequency ()
 Get the pwm frequency. More...
 
static bool setPwmFrequency (u32 f_hz, Size resolution=0)
 Set the pwm frequency and (optional) the maximal ticks within on cycle for all channels. More...
 

Static Public Attributes

template<u8 Number>
static auto & Channel = Impl::template Channel<Number>
 Timer channel. More...
 
static auto & Encoder = Impl::Encoder
 Timer in encoder mode. More...
 
static auto & ProfileCounter = Impl::ProfileCounter
 Timer used as profile counter. More...
 

Detailed Description

template<auto Context, template< auto, typename > typename TimerImpl, typename Size>
struct bsp::drv::Timer< Context, TimerImpl, Size >

Base class for Timer abstraction.

Template Parameters
ContextTimer context
TimerImplTimer implementation
SizeTimer counter register size (16 bit or 32 bit)

Member Typedef Documentation

◆ Impl

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
using bsp::drv::Timer< Context, TimerImpl, Size >::Impl = TimerImpl<Context, Size>

Constructor & Destructor Documentation

◆ Timer() [1/3]

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
bsp::drv::Timer< Context, TimerImpl, Size >::Timer ( )
delete

◆ Timer() [2/3]

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
bsp::drv::Timer< Context, TimerImpl, Size >::Timer ( const Timer< Context, TimerImpl, Size > &  )
delete

◆ Timer() [3/3]

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
bsp::drv::Timer< Context, TimerImpl, Size >::Timer ( Timer< Context, TimerImpl, Size > &&  )
delete

Member Function Documentation

◆ deinit()

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
static auto bsp::drv::Timer< Context, TimerImpl, Size >::deinit ( auto ...  args)
inlinestatic

Timer deinitialization.

Parameters
argsPlatform specific arguments
Returns
Success

◆ disable()

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
static void bsp::drv::Timer< Context, TimerImpl, Size >::disable ( )
inlinestatic

Disable the counter.

◆ enable()

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
static void bsp::drv::Timer< Context, TimerImpl, Size >::enable ( )
inlinestatic

Enable the counter.

◆ getCount()

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
static Size bsp::drv::Timer< Context, TimerImpl, Size >::getCount ( )
inlinestatic

Get the counter value.

Returns
Actual timer count

◆ getPwmFrequency()

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
static u32 bsp::drv::Timer< Context, TimerImpl, Size >::getPwmFrequency ( )
inlinestatic

Get the pwm frequency.

Note
The frequency is for all channels the same
Returns
Frequency in Hz

◆ init()

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
static auto bsp::drv::Timer< Context, TimerImpl, Size >::init ( auto ...  args)
inlinestatic

Timer initialization.

Parameters
argsPlatform specific arguments
Returns
Success

◆ resetCount()

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
static void bsp::drv::Timer< Context, TimerImpl, Size >::resetCount ( )
inlinestatic

Set the counter value to 0.

◆ setCount()

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
static void bsp::drv::Timer< Context, TimerImpl, Size >::setCount ( Size  cnt)
inlinestatic

Set the counter value.

Parameters
cntnew timer value

◆ setPwmFrequency()

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
static bool bsp::drv::Timer< Context, TimerImpl, Size >::setPwmFrequency ( u32  f_hz,
Size  resolution = 0 
)
inlinestatic

Set the pwm frequency and (optional) the maximal ticks within on cycle for all channels.

Note
The actual duty cycle for all channels will be restored after the changes
Parameters
f_hznew frequency in hz
resolutionof the pwm, for 0 the actual value will be used
Returns
true when the adjustment was possible, false when the parameter did not match

Member Data Documentation

◆ Channel

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
template<u8 Number>
auto& bsp::drv::Timer< Context, TimerImpl, Size >::Channel = Impl::template Channel<Number>
inlinestatic

Timer channel.

Template Parameters
NumberChannel number

◆ Encoder

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
auto& bsp::drv::Timer< Context, TimerImpl, Size >::Encoder = Impl::Encoder
inlinestatic

Timer in encoder mode.

◆ ProfileCounter

template<auto Context, template< auto, typename > typename TimerImpl, typename Size >
auto& bsp::drv::Timer< Context, TimerImpl, Size >::ProfileCounter = Impl::ProfileCounter
inlinestatic

Timer used as profile counter.


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