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

Timer implementation for Midgard. More...

#include <timer.hpp>

Static Public Member Functions

static bool init ()
 Init function. More...
 
static bool deinit ()
 Deinit function. 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 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 constexpr auto Channel = TimerChannel<Context, Number, Size>()
 Timer channel. More...
 
static constexpr auto Encoder = TimerEncoder<Context, Size>()
 Timer in encoder mode. More...
 
static constexpr auto ProfileCounter = TimerProfileCounter<Context, Size>()
 Timer used as profile counter. More...
 

Detailed Description

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

Timer implementation for Midgard.

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

Member Function Documentation

◆ deinit()

template<auto Context, typename Size >
static bool bsp::asg_coproc::drv::Timer< Context, Size >::deinit ( )
inlinestatic

Deinit function.

Returns
Success

◆ disable()

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

Disable the counter.

◆ enable()

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

Enable the counter.

◆ getCount()

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

Get the counter value.

Returns
Actual timer count

◆ getPwmFrequency()

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

Get the pwm frequency.

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

◆ init()

template<auto Context, typename Size >
static bool bsp::asg_coproc::drv::Timer< Context, Size >::init ( )
inlinestatic

Init function.

Returns
Success

◆ setCount()

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

Set the counter value.

Parameters
cntNew timer value

◆ setPwmFrequency()

template<auto Context, typename Size >
static bool bsp::asg_coproc::drv::Timer< Context, 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
Implement a proper error handling, the function does not guarantee to be successful
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, typename Size >
template<u8 Number>
constexpr auto bsp::asg_coproc::drv::Timer< Context, Size >::Channel = TimerChannel<Context, Number, Size>()
staticconstexpr

Timer channel.

Template Parameters
NumberChannel number

◆ Encoder

template<auto Context, typename Size >
constexpr auto bsp::asg_coproc::drv::Timer< Context, Size >::Encoder = TimerEncoder<Context, Size>()
staticconstexpr

Timer in encoder mode.

◆ ProfileCounter

template<auto Context, typename Size >
constexpr auto bsp::asg_coproc::drv::Timer< Context, Size >::ProfileCounter = TimerProfileCounter<Context, Size>()
staticconstexpr

Timer used as profile counter.


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