peary::utils::register_t

Class to represent a register configuration. More…

#include <peary/utils/datatypes.hpp>

Public Functions

Name
register_t() =defaultDefault constructor for register_t.
register_t(REG_T address)Constructor for register_t with address only.
register_t(REG_T address, bool readable, bool writable)Constructor for register_t with address, readable and writable flags.
register_t(REG_T address, MASK_T mask)Constructor for register_t with address and mask.
register_t(REG_T address, MASK_T mask, bool readable, bool writable, bool special =false)Constructor for register_t with address, mask, readable, writable and special flags.
register_t(REG_T address, MASK_T mask, MASK_T value, bool readable =true, bool writable =true, bool special =false)Constructor for register_t with address, mask, default value, readable, writable and special flags.
REG_T address() constGet the register address.
MASK_T mask() constGet the register mask.
MASK_T value() constGet the default value of the register.
bool hasValue() constCheck if the register has a default value.
bool special() constCheck if the register is special.
bool writable() constCheck if the register is writable.
bool readable() constCheck if the register is readable.
MASK_T shift() constGet the shift value of the register mask.

Friends

Name
std::ostream & operator«(std::ostream & os, const register_t< T1, T2 > & rg) Print the register information to an output stream.

Detailed Description

  template <typename REG_T  =uint8_t,
typename MASK_T  =REG_T>
class peary::utils::register_t;
  

Class to represent a register configuration.

Template Parameters:

  • REG_T The type of the register address, default is uint8_t
  • MASK_T The type of the register mask, default is REG_T

Public Functions Documentation

function register_t

  register_t() =default
  

Default constructor for register_t.

function register_t

  inline explicit register_t(
    REG_T address
)
  

Constructor for register_t with address only.

Parameters:

  • address The address of the register

function register_t

  inline register_t(
    REG_T address,
    bool readable,
    bool writable
)
  

Constructor for register_t with address, readable and writable flags.

Parameters:

  • address The address of the register
  • readable Flag indicating if the register is readable
  • writable Flag indicating if the register is writable

function register_t

  inline explicit register_t(
    REG_T address,
    MASK_T mask
)
  

Constructor for register_t with address and mask.

Parameters:

  • address The address of the register
  • mask The mask for the register

function register_t

  inline explicit register_t(
    REG_T address,
    MASK_T mask,
    bool readable,
    bool writable,
    bool special =false
)
  

Constructor for register_t with address, mask, readable, writable and special flags.

Parameters:

  • address The address of the register
  • mask The mask for the register
  • readable Flag indicating if the register is readable
  • writable Flag indicating if the register is writable
  • special Flag indicating if the register is special

function register_t

  inline explicit register_t(
    REG_T address,
    MASK_T mask,
    MASK_T value,
    bool readable =true,
    bool writable =true,
    bool special =false
)
  

Constructor for register_t with address, mask, default value, readable, writable and special flags.

Parameters:

  • address The address of the register
  • mask The mask for the register
  • value The default value for the register
  • readable Flag indicating if the register is readable
  • writable Flag indicating if the register is writable
  • special Flag indicating if the register is special

function address

  inline REG_T address() const
  

Get the register address.

Return: The address of the register

function mask

  inline MASK_T mask() const
  

Get the register mask.

Return: The mask of the register

function value

  inline MASK_T value() const
  

Get the default value of the register.

Return: The default value of the register

function hasValue

  inline bool hasValue() const
  

Check if the register has a default value.

Return: True if the register has a default value, false otherwise

function special

  inline bool special() const
  

Check if the register is special.

Return: True if the register is special, false otherwise

function writable

  inline bool writable() const
  

Check if the register is writable.

Return: True if the register is writable, false otherwise

function readable

  inline bool readable() const
  

Check if the register is readable.

Return: True if the register is readable, false otherwise

function shift

  inline MASK_T shift() const
  

Get the shift value of the register mask.

Return: The shift value of the register mask

Friends

friend operator«

  friend std::ostream & operator<<(
    std::ostream & os,

    const register_t< T1, T2 > & rg
);
  

Print the register information to an output stream.

Parameters:

  • os The output stream to print to
  • rg The register_t object to print

Template Parameters:

  • T1 The type of the register address
  • T2 The type of the register mask

This function is used to print the register information to an output stream.


Updated on 2025-11-28 at 17:53:40 +0100