emlabcpp
modern opinionated embedded C++ library
|
Register map is abstraction to work with registers of external devices. More...
#include <register_map.h>
Public Types | |
using | registers_tuple = std::tuple< Regs... > |
using | key_type = typename std::tuple_element_t< 0, registers_tuple >::key_type |
using | register_index = bounded< std::size_t, 0, registers_count - 1 > |
using | message_type = message< max_value_size > |
template<key_type Key> | |
using | reg_type = std::tuple_element_t< key_index< Key >, registers_tuple > |
template<key_type Key> | |
using | reg_value_type = typename reg_type< Key >::value_type |
template<key_type Key> | |
using | traits = typename reg_type< Key >::traits |
template<key_type Key> | |
using | reg_def_type = typename reg_type< Key >::def_type |
Public Member Functions | |
register_map ()=default | |
register_map (typename Regs::value_type &... args) | |
constexpr | register_map (Regs const &... regs) |
template<key_type Key> | |
reg_value_type< Key > | get_val () const |
template<key_type Key> | |
constexpr void | set_val (reg_value_type< Key > val) |
template<typename UnaryCallable > | |
constexpr void | setup_register (key_type key, UnaryCallable &&f) |
template<typename UnaryCallable > | |
constexpr auto | with_register (key_type key, UnaryCallable &&f) const |
template<typename UnaryCallable > | |
constexpr auto | with_register (key_type key, UnaryCallable &&f) |
Static Public Member Functions | |
static constexpr bool | contains (key_type key) |
static constexpr std::size_t | register_size (register_index i) |
static constexpr key_type | register_key (register_index i) |
static constexpr void | with_reg_type (key_type key, auto &&f) |
Static Public Attributes | |
static constexpr std::endian | endianess = Endianess |
static constexpr auto | max_key = std::max( { Regs::key... } ) |
static constexpr std::size_t | registers_count = sizeof...( Regs ) |
static constexpr std::size_t | max_value_size = std::max( { Regs::traits::max_size... } ) |
template<key_type Key> | |
static constexpr std::size_t | key_index = get_reg_index( Key ) |
template<key_type Key> | |
static constexpr bool | contains_key |
static constexpr std::array< key_type, registers_count > | keys = { Regs::key... } |
Friends | |
constexpr friend auto | operator<=> (register_map const &, register_map const &)=default |
Register map is abstraction to work with registers of external devices.
It stores values of serializable types that can be accessed based on key (usually enum representing address of register in the device).You can access the value based on the key itself, both at compile time and at runtime. You can also iterate over the values and there is handler that allows serialization and deserialization of bytes into the values defined in the map. This includes additional information that can be accessed about the map. This can also be used as simple table of configuration values.
using emlabcpp::protocol::register_map< Endianess, Regs >::key_type = typename std::tuple_element_t< 0, registers_tuple >::key_type |
using emlabcpp::protocol::register_map< Endianess, Regs >::message_type = message< max_value_size > |
using emlabcpp::protocol::register_map< Endianess, Regs >::reg_def_type = typename reg_type< Key >::def_type |
using emlabcpp::protocol::register_map< Endianess, Regs >::reg_type = std::tuple_element_t< key_index< Key >, registers_tuple > |
using emlabcpp::protocol::register_map< Endianess, Regs >::reg_value_type = typename reg_type< Key >::value_type |
using emlabcpp::protocol::register_map< Endianess, Regs >::register_index = bounded< std::size_t, 0, registers_count - 1 > |
using emlabcpp::protocol::register_map< Endianess, Regs >::registers_tuple = std::tuple< Regs... > |
using emlabcpp::protocol::register_map< Endianess, Regs >::traits = typename reg_type< Key >::traits |
|
default |
|
inlineexplicit |
|
inlineexplicitconstexpr |
|
inlinestaticconstexpr |
|
inline |
|
inlinestaticconstexpr |
References emlabcpp::select_index().
|
inlinestaticconstexpr |
References emlabcpp::select_index().
|
inlineconstexpr |
|
inlineconstexpr |
|
inlinestaticconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
friend |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |