modm API documentation
modm::Value< Parent, Width, Position > Struct Template Reference

#include <modm/architecture/interface/register.hpp>

Inheritance diagram for modm::Value< Parent, Width, Position >:
modm::FlagsOperators< Parent::EnumType, Parent::UnderlyingType > modm::Register< Parent::UnderlyingType >

Public Typedefs

typedef Parent::EnumType EnumType
 The enum type.
 

Public Member Functions

constexpr Value (UnderlyingType config)
 explicit constructor for the underlying type
 
constexpr Value (Value const &o) = default
 copy constructor
 
constexpr Value (Value &&o) = default
 move constructor
 
constexpr operator bool () const
 
constexpr bool operator! () const
 Returns true if value is zero.
 
constexpr FlagsOperators operator~ () const
 bitwise negation
 
constexpr FlagsOperators operator& (FlagsOperators const &o) const
 bitwise AND with multiple bits
 
constexpr FlagsOperators operator^ (FlagsOperators const &o) const
 bitwise XOR with multiple bits
 
constexpr FlagsOperators operator| (FlagsOperators const &o) const
 bitwise OR with multiple bits
 
FlagsOperatorsoperator&= (FlagsOperators const &o)
 bitwise AND with multiple bits
 
FlagsOperatorsoperator^= (FlagsOperators const &o)
 bitwise XOR with multiple bits
 
FlagsOperatorsoperator|= (FlagsOperators const &o)
 bitwise OR with multiple bits
 
FlagsOperatorsoperator&= (Parent::EnumType const &flag)
 bitwise AND with a single bit
 
FlagsOperatorsoperator^= (Parent::EnumType const &flag)
 bitwise XOR with a single bit
 
FlagsOperatorsoperator|= (Parent::EnumType const &flag)
 bitwise OR with a single bit
 

Static Public Member Functions

static constexpr Parent mask ()
 returns the shifted mask for this value
 
static void set (Parent &parent, UnderlyingType config)
 clears and sets a new value in a Flags register
 
static void reset (Parent &parent)
 clears the value in a Flags register
 
static constexpr UType get (Parent const &parent)
 returns the value from a Flags register
 

Public Attributes

UnderlyingType value
 The underlying integer value.
 

Detailed Description

template<typename Parent, typename Parent::UnderlyingType Width, typename Parent::UnderlyingType Position = 0>
struct modm::Value< Parent, Width, Position >

Class for accessing a numeric value in a register.

A value is a combination of bits which correspond to their numerical value. An example is a 3-bit wide bit field corresponding to the start-up delay in ms.

The value class is similar to the configuration class, but a lot simpler. No enum type is needed, instead the underlying type of the parent register class is used for setting and getting the value.

typedef Value< Control_t, 3, 1 > Delay_t;
Template Parameters
Parentthe Flags class to which this configuration belongs to
Widththe width in bits of the value in the register
Positionhow many bits the configuration values need to be shifted
Author
Niklas Hauser

Member Function Documentation

constexpr modm::Register< Parent::UnderlyingType >::operator bool ( ) const
inheritedinlineexplicitconstexpr

Returns true if value is non-zero

The compiler will allow implicit conversions to bool in the following contexts:

  • conditions of if, while, for, do-while statements
  • logical operators (&&, ||)
  • negation (operator !)
  • static_assert

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