REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
|
The Lucidac I-Block (I for Current; the Implicit Summing Block) is represented by this class. More...
#include <iblock.h>


Public Member Functions | |
IBlock (IBlockHAL *hardware) | |
IBlock () | |
metadata::eui_t | get_entity_eui () const override |
utils::status | write_to_hardware () override |
returns true in case of success | |
bool | init () override |
returns true in case of success | |
void | reset_outputs () |
void | reset (entities::ResetAction action) override |
const std::array< uint32_t, NUM_OUTPUTS > & | get_outputs () const |
void | set_outputs (const std::array< uint32_t, NUM_OUTPUTS > &outputs_) |
bool | connect (uint8_t input, uint8_t output, bool exclusive=false, bool allow_input_splitting=false) |
Connects an input line [0..31] to an output line [0..15] by setting an appropriate bit/switch in the respective position in the matrix. | |
bool | is_connected (uint8_t input, uint8_t output) const |
Whether an input is connected to an output. | |
bool | is_anything_connected () const |
bool | disconnect (uint8_t input, uint8_t output) |
Disconnect one input from an output. Fails for invalid arguments or if no input is connected. | |
bool | disconnect (uint8_t output) |
Disconnect all inputs from an output. Fails for invalid arguments. | |
bool | set_upscaling (uint8_t input, bool upscale) |
Sets the input scale of the corresponding output. | |
void | set_upscaling (std::bitset< NUM_INPUTS > scales) |
Sets all 32 input scales. | |
void | reset_upscaling () |
Sets all 32 input scales to the default 1.0. | |
bool | get_upscaling (uint8_t output) const |
Returns the input scale of the corresponding output. | |
const std::bitset< NUM_INPUTS > & | get_upscales () const |
Returns all input scales. A low bit indicates a factor of 1.0, a high bit indicates a factor of 10.0. | |
utils::status | config_self_from_json (JsonObjectConst cfg) override |
Deserialize a new configuration for this entity from a JsonObject. | |
![]() | |
FunctionBlock (std::string entity_id) | |
std::vector< Entity * > | get_child_entities () override |
Entity * | get_child_entity (const std::string &child_id) override |
![]() | |
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 |
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 |
Entity * | resolve_child_entity (std::string paths[], size_t len) |
Entity * | resolve_child_entity (JsonArrayConstIterator begin, JsonArrayConstIterator end) |
Entity * | resolve_child_entity (JsonArrayConst path) |
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 IBlock * | from_entity_classifier (entities::EntityClassifier classifier, bus::addr_t block_address) |
static constexpr uint32_t | INPUT_BITMASK (uint8_t input_idx) |
static constexpr std::array< uint8_t, NUM_INPUTS > | INPUT_IDX_RANGE () |
static constexpr std::array< uint8_t, NUM_OUTPUTS > | OUTPUT_IDX_RANGE () |
Static Public Attributes | |
static constexpr auto | CLASS_ = entities::EntityClass::I_BLOCK |
static constexpr uint8_t | BLOCK_IDX = bus::I_BLOCK_IDX |
static constexpr uint8_t | NUM_INPUTS = IBlockHAL::NUM_INPUTS |
static constexpr uint8_t | NUM_OUTPUTS = IBlockHAL::NUM_OUTPUTS |
Protected Member Functions | |
utils::status | _connect_from_json (const JsonVariantConst &input_spec, uint8_t output) |
utils::status | _config_outputs_from_json (const JsonVariantConst &cfg) |
utils::status | _config_upscaling_from_json (const JsonVariantConst &cfg) |
void | config_self_to_json (JsonObject &cfg) override |
Serialize the configuration of this entity to a JsonObject. | |
bool | _is_connected (uint8_t input, uint8_t output) const |
bool | _is_output_connected (uint8_t output) const |
![]() | |
utils::status | config_children_from_json (JsonObjectConst &cfg) |
Deserialize a new configuration for all child entities from a JsonObject. | |
void | config_children_to_json (JsonObject &cfg) |
Serialize the configuration of the child entities of this entity to a JsonObject. | |
Protected Attributes | |
IBlockHAL * | hardware |
std::array< uint32_t, NUM_OUTPUTS > | outputs |
std::bitset< NUM_INPUTS > | scaling_factors = 0 |
![]() | |
std::string | entity_id |
EntityClassifier | classifier |
Detailed Description
The Lucidac I-Block (I for Current; the Implicit Summing Block) is represented by this class.
This class provides an in-memory representation of the bit matrix. All operations are delayed and only take place when flushing out to the hardware, which is done via the corresponding HAL pointer.
One cluster can only have a single I-Block. Usage typically happens over the Cluster class, which itself can be accessed via the Carrier or LUCIDAC class.
Constructor & Destructor Documentation
◆ IBlock() [1/2]
|
explicit |
Definition at line 21 of file iblock.cpp.
References CLASS_, and entities::Entity::classifier.
◆ IBlock() [2/2]
blocks::IBlock::IBlock | ( | ) |
Definition at line 25 of file iblock.cpp.
Member Function Documentation
◆ _config_outputs_from_json()
|
protected |
Definition at line 125 of file iblock.cpp.
References utils::is_number(), and utils::status::success().
◆ _config_upscaling_from_json()
|
protected |
Definition at line 168 of file iblock.cpp.
References utils::status::success().
◆ _connect_from_json()
|
protected |
Definition at line 196 of file iblock.cpp.
References utils::status::success().
◆ _is_connected()
|
protected |
Definition at line 48 of file iblock.cpp.
◆ _is_output_connected()
|
protected |
Definition at line 52 of file iblock.cpp.
◆ config_self_from_json()
|
overridevirtual |
Deserialize a new configuration for this entity from a JsonObject.
Implementations shall not traverse to children,
- See also
- config_children_from_json() instead.
- Returns
- true in case of success, else false
Implements entities::Entity.
Definition at line 105 of file iblock.cpp.
References utils::status::success().
◆ config_self_to_json()
|
overrideprotectedvirtual |
Serialize the configuration of this entity to a JsonObject.
Implementations shall not traverse to children,
- See also
- config_children_to_json() instead.
Reimplemented from entities::Entity.
Definition at line 248 of file iblock.cpp.
◆ connect()
FLASHMEM bool blocks::IBlock::connect | ( | uint8_t | input, |
uint8_t | output, | ||
bool | exclusive = false, | ||
bool | allow_input_splitting = false ) |
Connects an input line [0..31] to an output line [0..15] by setting an appropriate bit/switch in the respective position in the matrix.
Note that this function only manipulates the in-memory representation and does not immediately write outs to hardware.
Note that calls to connect() only add bits to the existing configuration. Use reset() to reset the matrix.
The flag exlusive
disconnects all other inputs from the chosen output.
- Returns
- false in case of invalid input, true else.
Definition at line 67 of file iblock.cpp.
◆ disconnect() [1/2]
FLASHMEM bool blocks::IBlock::disconnect | ( | uint8_t | input, |
uint8_t | output ) |
Disconnect one input from an output. Fails for invalid arguments or if no input is connected.
Definition at line 215 of file iblock.cpp.
◆ disconnect() [2/2]
FLASHMEM bool blocks::IBlock::disconnect | ( | uint8_t | output | ) |
Disconnect all inputs from an output. Fails for invalid arguments.
Definition at line 223 of file iblock.cpp.
◆ from_entity_classifier()
|
static |
Definition at line 272 of file iblock.cpp.
◆ get_entity_eui()
|
overridevirtual |
Implements entities::Entity.
Definition at line 27 of file iblock.cpp.
◆ get_outputs()
FLASHMEM const std::array< uint32_t, blocks::IBlock::NUM_OUTPUTS > & blocks::IBlock::get_outputs | ( | ) | const |
Definition at line 291 of file iblock.cpp.
◆ get_upscales()
|
inline |
Returns all input scales. A low bit indicates a factor of 1.0, a high bit indicates a factor of 10.0.
Definition at line 201 of file iblock.h.
References scaling_factors.
◆ get_upscaling()
FLASHMEM bool blocks::IBlock::get_upscaling | ( | uint8_t | output | ) | const |
Returns the input scale of the corresponding output.
Definition at line 241 of file iblock.cpp.
◆ init()
|
overridevirtual |
returns true in case of success
Reimplemented from entities::Entity.
Definition at line 37 of file iblock.cpp.
References entities::Entity::init(), and LOG.
◆ INPUT_BITMASK()
|
inlinestaticconstexpr |
Definition at line 109 of file iblock.h.
References blocks::IBlockHAL::INPUT_BITMASK().
◆ INPUT_IDX_RANGE()
|
inlinestaticconstexpr |
Definition at line 114 of file iblock.h.
Referenced by platform::Cluster::calibrate_routes().
◆ is_anything_connected()
FLASHMEM bool blocks::IBlock::is_anything_connected | ( | ) | const |
Definition at line 60 of file iblock.cpp.
◆ is_connected()
FLASHMEM bool blocks::IBlock::is_connected | ( | uint8_t | input, |
uint8_t | output ) const |
Whether an input is connected to an output.
Definition at line 54 of file iblock.cpp.
◆ OUTPUT_IDX_RANGE()
|
inlinestaticconstexpr |
Definition at line 119 of file iblock.h.
Referenced by platform::Cluster::calibrate_routes().
◆ reset()
|
overridevirtual |
Reimplemented from entities::Entity.
Definition at line 96 of file iblock.cpp.
References entities::ResetAction::CIRCUIT_RESET, entities::ResetAction::has(), and entities::Entity::reset().
◆ reset_outputs()
FLASHMEM void blocks::IBlock::reset_outputs | ( | ) |
Definition at line 90 of file iblock.cpp.
◆ reset_upscaling()
FLASHMEM void blocks::IBlock::reset_upscaling | ( | ) |
Sets all 32 input scales to the default 1.0.
Definition at line 239 of file iblock.cpp.
◆ set_outputs()
FLASHMEM void blocks::IBlock::set_outputs | ( | const std::array< uint32_t, NUM_OUTPUTS > & | outputs_ | ) |
Definition at line 295 of file iblock.cpp.
◆ set_upscaling() [1/2]
FLASHMEM void blocks::IBlock::set_upscaling | ( | std::bitset< NUM_INPUTS > | scales | ) |
Sets all 32 input scales.
If the corresponding bit is false, a factor of 1.0 is applied, if true, a factor of 10.0 will be used.
Definition at line 237 of file iblock.cpp.
◆ set_upscaling() [2/2]
FLASHMEM bool blocks::IBlock::set_upscaling | ( | uint8_t | input, |
bool | upscale ) |
Sets the input scale of the corresponding output.
If upscale is false, a factor of 1.0 is applied, if upscale is true, a factor of 10.0 will be used.
Definition at line 230 of file iblock.cpp.
◆ write_to_hardware()
|
nodiscardoverridevirtual |
returns true in case of success
Reimplemented from entities::Entity.
Definition at line 33 of file iblock.cpp.
Member Data Documentation
◆ BLOCK_IDX
|
staticconstexpr |
◆ CLASS_
|
staticconstexpr |
◆ hardware
◆ NUM_INPUTS
|
staticconstexpr |
◆ NUM_OUTPUTS
|
staticconstexpr |
◆ outputs
|
protected |
◆ scaling_factors
|
protected |
Definition at line 137 of file iblock.h.
Referenced by get_upscales().
The documentation for this class was generated from the following files:
- lib/platform-lucidac/src/block/iblock.h
- lib/platform-lucidac/src/block/iblock.cpp