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

Timer encoder implementation for Midgard. More...

#include <timer.hpp>

Public Types

enum  Direction : u8 { Direction::Clockwise, Direction::CounterClockwise }
 Last known turning direction of the encoder. More...
 
enum  Mode : u8 { Mode::_48StepsPerTurn, Mode::_96StepsPerTurn }
 Modes for the encoder, 48 odr 96 steps per turn are possible. More...
 

Public Member Functions

ALWAYS_INLINE bool enable () const noexcept
 Enable the encoder mode. More...
 
ALWAYS_INLINE bool disable () const noexcept
 Disable the encoder mode. More...
 
ALWAYS_INLINE Size getCount () const noexcept
 Get the counter value. More...
 
ALWAYS_INLINE void setCount (Size cnt) const noexcept
 Set the encoder counter value. More...
 
ALWAYS_INLINE Direction getDirection () const noexcept
 Get the direction of the last rotation. More...
 
ALWAYS_INLINE void setMode (Mode mode) const noexcept
 Set the mode of the encoder (48 or 96 counts per turn) More...
 
ALWAYS_INLINE bool init () const noexcept
 Initialization function for the encoder. More...
 

Detailed Description

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

Timer encoder implementation for Midgard.

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

Member Enumeration Documentation

◆ Direction

template<auto Context, typename Size >
enum bsp::asg_coproc::drv::TimerEncoder::Direction : u8
strong

Last known turning direction of the encoder.

Enumerator
Clockwise 
CounterClockwise 

◆ Mode

template<auto Context, typename Size >
enum bsp::asg_coproc::drv::TimerEncoder::Mode : u8
strong

Modes for the encoder, 48 odr 96 steps per turn are possible.

Enumerator
_48StepsPerTurn 
_96StepsPerTurn 

Member Function Documentation

◆ disable()

template<auto Context, typename Size >
ALWAYS_INLINE bool bsp::asg_coproc::drv::TimerEncoder< Context, Size >::disable ( ) const
inlinenoexcept

Disable the encoder mode.

Note
This does only work for timer with a encoder modul
Returns
Success

◆ enable()

template<auto Context, typename Size >
ALWAYS_INLINE bool bsp::asg_coproc::drv::TimerEncoder< Context, Size >::enable ( ) const
inlinenoexcept

Enable the encoder mode.

Note
This does only work for timer with a encoder modul
Returns
Success

◆ getCount()

template<auto Context, typename Size >
ALWAYS_INLINE Size bsp::asg_coproc::drv::TimerEncoder< Context, Size >::getCount ( ) const
inlinenoexcept

Get the counter value.

Note
This does only work for timer with a encoder modul
Returns
Actual timer count

◆ getDirection()

template<auto Context, typename Size >
ALWAYS_INLINE Direction bsp::asg_coproc::drv::TimerEncoder< Context, Size >::getDirection ( ) const
inlinenoexcept

Get the direction of the last rotation.

Note
This bit might not be accurate while turning the encoder
Returns
Direction

◆ init()

template<auto Context, typename Size >
ALWAYS_INLINE bool bsp::asg_coproc::drv::TimerEncoder< Context, Size >::init ( ) const
inlinenoexcept

Initialization function for the encoder.

Note
Default encoder mode is 96 steps per turn
Returns
Success

◆ setCount()

template<auto Context, typename Size >
ALWAYS_INLINE void bsp::asg_coproc::drv::TimerEncoder< Context, Size >::setCount ( Size  cnt) const
inlinenoexcept

Set the encoder counter value.

Parameters
cntNew counter value

◆ setMode()

template<auto Context, typename Size >
ALWAYS_INLINE void bsp::asg_coproc::drv::TimerEncoder< Context, Size >::setMode ( Mode  mode) const
inlinenoexcept

Set the mode of the encoder (48 or 96 counts per turn)

Parameters
modeMode selection

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