REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches

A REDAC Math block (M-Block) is represented by this class. More...

#include <mblock.h>

Inheritance diagram for blocks::MBlock:
Collaboration diagram for blocks::MBlock:

Public Types

enum class  TYPES : uint8_t { UNKNOWN = 0 , M_INT8_BLOCK = 1 , M_MUL4_BLOCK = 2 }
 
enum class  SLOT : uint8_t { M0 = 0 , M1 = 1 }
 

Public Member Functions

bool is_entity_type (TYPES type_)
 
 MBlock (SLOT slot, MBlockHAL *hardware)
 
uint8_t slot_to_global_io_index (uint8_t local) const
 
virtual bool calibrate (platform::Cluster *cluster, carrier::Carrier *carrier)
 
void overload_flags_to_json (JsonArray msg_out) const
 
- Public Member Functions inherited from blocks::FunctionBlock
 FunctionBlock (std::string entity_id)
 
std::vector< Entity * > get_child_entities () override
 
Entityget_child_entity (const std::string &child_id) override
 
- Public Member Functions inherited from entities::Entity
 Entity ()=default
 
 Entity (std::string entityId)
 
const std::string & get_entity_id () const
 
void rename_entity (const std::string entityId)
 
EntityClassifier get_entity_classifier () const
 
EntityClass get_entity_class () const
 
uint8_t get_entity_type () const
 
Version get_entity_version () const
 
uint8_t get_entity_variant () const
 
virtual metadata::eui_t get_entity_eui () const =0
 
bool is_entity_class (EntityClass class_) const
 
bool is_entity_type (uint8_t type_) const
 
bool is_entity_version (Version version_) const
 
bool is_entity_variant (uint8_t variant_) const
 
Entityresolve_child_entity (std::string paths[], size_t len)
 
Entityresolve_child_entity (JsonArrayConstIterator begin, JsonArrayConstIterator end)
 
Entityresolve_child_entity (JsonArrayConst path)
 
virtual bool init ()
 returns true in case of success
 
virtual void reset (ResetAction action)
 
virtual utils::status write_to_hardware ()
 returns true in case of success
 
utils::status config_from_json (JsonObjectConst cfg)
 Deserialize a new configuration for this entity and all its children from a JsonObject.
 
void config_to_json (JsonObject &cfg, bool recursive=true)
 Serialize the configuration for this entity to a JsonObject.
 
utils::status user_set_config (JsonObjectConst msg_in, JsonObject &msg_out)
 
utils::status user_get_config (JsonObjectConst msg_in, JsonObject &msg_out)
 
utils::status user_reset_config (JsonObjectConst msg_in, JsonObject &msg_out)
 
void classifier_to_json (JsonObject &out)
 Provide recursive entity information in a tree.
 

Static Public Member Functions

static MBlockfrom_entity_classifier (entities::EntityClassifier classifier, bus::addr_t block_address)
 
static constexpr std::array< uint8_t, 8 > SLOT_INPUT_IDX_RANGE ()
 
static constexpr std::array< uint8_t, 8 > SLOT_OUTPUT_IDX_RANGE ()
 
template<int n>
static constexpr uint8_t M0_INPUT ()
 M0 input signal specifier for hard-coded usage, like MBlock::M0_INPUT<3>().
 
static constexpr uint8_t M0_INPUT (uint8_t idx)
 M0 input signal specifier for dynamic usage, like MBlock::M0_INPUT(variable).
 
template<int n>
static constexpr uint8_t M0_OUTPUT ()
 M0 output signal specifier for hard-coded usage, like MBlock::M0_OUTPUT<3>().
 
static constexpr uint8_t M0_OUTPUT (uint8_t idx)
 M0 output signal specifier for dynamic usage, like MBlock::M0_OUTPUT(variable).
 
template<int n>
static constexpr uint8_t M1_INPUT ()
 M1 input signal specifier for hard-coded usage, like MBlock::M1_INPUT<3>().
 
static constexpr uint8_t M1_INPUT (uint8_t idx)
 M1 input signal specifier for dynamic usage, like MBlock::M1_INPUT(variable).
 
template<int n>
static constexpr uint8_t M1_OUTPUT ()
 M1 output signal specifier for hard-coded usage, like MBlock::M1_OUTPUT<3>().
 
static constexpr uint8_t M1_OUTPUT (uint8_t idx)
 M1 output signal specifier for dynamic usage, like MBlock::M1_OUTPUT(variable).
 

Public Attributes

const SLOT slot
 
MBlockHALhardware
 

Static Public Attributes

static constexpr auto CLASS_ = entities::EntityClass::M_BLOCK
 
static constexpr uint8_t M0_IDX = bus::M0_BLOCK_IDX
 
static constexpr uint8_t M1_IDX = bus::M1_BLOCK_IDX
 

Additional Inherited Members

- Protected Member Functions inherited from entities::Entity
virtual utils::status config_self_from_json (JsonObjectConst cfg)=0
 Deserialize a new configuration for this entity from a JsonObject.
 
utils::status config_children_from_json (JsonObjectConst &cfg)
 Deserialize a new configuration for all child entities from a JsonObject.
 
virtual void config_self_to_json (JsonObject &cfg)
 Serialize the configuration of this entity to a JsonObject.
 
void config_children_to_json (JsonObject &cfg)
 Serialize the configuration of the child entities of this entity to a JsonObject.
 
- Protected Attributes inherited from entities::Entity
std::string entity_id
 
EntityClassifier classifier
 

Detailed Description

A REDAC Math block (M-Block) is represented by this class.

All variants of the M-Blocks are represented by instances of this class or a suitable subclass.

This base class provides convenient static functions to compute the correct index (for usage in the U and I block) for M block computing elements.

Definition at line 43 of file mblock.h.

Member Enumeration Documentation

◆ SLOT

enum class blocks::MBlock::SLOT : uint8_t
strong
Enumerator
M0 
M1 

Definition at line 58 of file mblock.h.

◆ TYPES

enum class blocks::MBlock::TYPES : uint8_t
strong
Enumerator
UNKNOWN 
M_INT8_BLOCK 
M_MUL4_BLOCK 

Definition at line 48 of file mblock.h.

Constructor & Destructor Documentation

◆ MBlock()

FLASHMEM blocks::MBlock::MBlock ( SLOT slot,
MBlockHAL * hardware )
explicit

Definition at line 32 of file mblock.cpp.

References CLASS_, and entities::Entity::classifier.

Member Function Documentation

◆ calibrate()

virtual bool blocks::MBlock::calibrate ( platform::Cluster * cluster,
carrier::Carrier * carrier )
inlinevirtual

◆ from_entity_classifier()

FLASHMEM blocks::MBlock * blocks::MBlock::from_entity_classifier ( entities::EntityClassifier classifier,
bus::addr_t block_address )
static

◆ is_entity_type()

bool blocks::MBlock::is_entity_type ( TYPES type_)
inline

Definition at line 52 of file mblock.h.

References entities::Entity::is_entity_type().

◆ M0_INPUT() [1/2]

template<int n>
static constexpr uint8_t blocks::MBlock::M0_INPUT ( )
inlinestaticconstexpr

M0 input signal specifier for hard-coded usage, like MBlock::M0_INPUT<3>().

Definition at line 65 of file mblock.h.

◆ M0_INPUT() [2/2]

static constexpr uint8_t blocks::MBlock::M0_INPUT ( uint8_t idx)
inlinestaticconstexpr

M0 input signal specifier for dynamic usage, like MBlock::M0_INPUT(variable).

Definition at line 71 of file mblock.h.

◆ M0_OUTPUT() [1/2]

template<int n>
static constexpr uint8_t blocks::MBlock::M0_OUTPUT ( )
inlinestaticconstexpr

M0 output signal specifier for hard-coded usage, like MBlock::M0_OUTPUT<3>().

Definition at line 74 of file mblock.h.

◆ M0_OUTPUT() [2/2]

static constexpr uint8_t blocks::MBlock::M0_OUTPUT ( uint8_t idx)
inlinestaticconstexpr

M0 output signal specifier for dynamic usage, like MBlock::M0_OUTPUT(variable).

Definition at line 80 of file mblock.h.

◆ M1_INPUT() [1/2]

template<int n>
static constexpr uint8_t blocks::MBlock::M1_INPUT ( )
inlinestaticconstexpr

M1 input signal specifier for hard-coded usage, like MBlock::M1_INPUT<3>().

Definition at line 83 of file mblock.h.

◆ M1_INPUT() [2/2]

static constexpr uint8_t blocks::MBlock::M1_INPUT ( uint8_t idx)
inlinestaticconstexpr

M1 input signal specifier for dynamic usage, like MBlock::M1_INPUT(variable).

Definition at line 89 of file mblock.h.

◆ M1_OUTPUT() [1/2]

template<int n>
static constexpr uint8_t blocks::MBlock::M1_OUTPUT ( )
inlinestaticconstexpr

M1 output signal specifier for hard-coded usage, like MBlock::M1_OUTPUT<3>().

Definition at line 92 of file mblock.h.

◆ M1_OUTPUT() [2/2]

static constexpr uint8_t blocks::MBlock::M1_OUTPUT ( uint8_t idx)
inlinestaticconstexpr

M1 output signal specifier for dynamic usage, like MBlock::M1_OUTPUT(variable).

Definition at line 98 of file mblock.h.

◆ overload_flags_to_json()

FLASHMEM void blocks::MBlock::overload_flags_to_json ( JsonArray msg_out) const

Definition at line 82 of file mblock.cpp.

Referenced by carrier::Carrier::user_get_overload_status().

◆ SLOT_INPUT_IDX_RANGE()

static constexpr std::array< uint8_t, 8 > blocks::MBlock::SLOT_INPUT_IDX_RANGE ( )
inlinestaticconstexpr

Definition at line 60 of file mblock.h.

◆ SLOT_OUTPUT_IDX_RANGE()

static constexpr std::array< uint8_t, 8 > blocks::MBlock::SLOT_OUTPUT_IDX_RANGE ( )
inlinestaticconstexpr

Definition at line 62 of file mblock.h.

Referenced by carrier::Carrier::calibrate_mblock().

◆ slot_to_global_io_index()

FLASHMEM uint8_t blocks::MBlock::slot_to_global_io_index ( uint8_t local) const

Definition at line 37 of file mblock.cpp.

Referenced by carrier::Carrier::calibrate_mblock().

Member Data Documentation

◆ CLASS_

auto blocks::MBlock::CLASS_ = entities::EntityClass::M_BLOCK
staticconstexpr

Definition at line 46 of file mblock.h.

Referenced by MBlock(), and carrier::Carrier::user_get_overload_status().

◆ hardware

MBlockHAL* blocks::MBlock::hardware

Definition at line 102 of file mblock.h.

◆ M0_IDX

uint8_t blocks::MBlock::M0_IDX = bus::M0_BLOCK_IDX
staticconstexpr

Definition at line 55 of file mblock.h.

◆ M1_IDX

uint8_t blocks::MBlock::M1_IDX = bus::M1_BLOCK_IDX
staticconstexpr

Definition at line 56 of file mblock.h.

◆ slot

const SLOT blocks::MBlock::slot

Definition at line 101 of file mblock.h.


The documentation for this class was generated from the following files: