REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
|
The Lucidac U-Block (U for Voltage) is represented by this class. More...
#include <ublock.h>


Public Types | |
using | Transmission_Mode = UBlockHAL::Transmission_Mode |
using | Reference_Magnitude = UBlockHAL::Reference_Magnitude |
Public Member Functions | |
UBlock (UBlockHAL *hardware) | |
UBlock () | |
metadata::eui_t | get_entity_eui () const override |
void | reset (entities::ResetAction action) override |
void | reset_connections () |
bool | connect (const uint8_t input, const uint8_t output, const bool force=false) |
Connects a block input to a block output. | |
bool | connect_alternative (Transmission_Mode signal_type, const uint8_t output, const bool force=false, bool use_a_side=false) |
Connects an alternative input / non block input specified by signal_mode from the a- or b-side to a block output. | |
bool | disconnect (const uint8_t input, const uint8_t output) |
Disconnect an input from an output, if they are connected. Both input and output are zero-based indizes. | |
bool | disconnect (const uint8_t output) |
Disconnect all inputs from an output. Fails for invalid arguments. | |
bool | is_connected (const uint8_t input, const uint8_t output) const |
Check whether an chip input is connected to an chip / block output. | |
bool | is_output_connected (const uint8_t output) const |
Check whether an chip / block output is connected to any chip input. | |
bool | is_input_connected (const uint8_t input) const |
Check whether an chip input is connected to any output. | |
bool | is_anything_connected () const |
utils::status | write_to_hardware () override |
returns true in case of success | |
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) |
virtual bool | init () |
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 UBlock * | from_entity_classifier (entities::EntityClassifier classifier, bus::addr_t block_address) |
static constexpr std::array< uint8_t, NUM_OF_INPUTS > | INPUT_IDX_RANGE () |
static constexpr std::array< uint8_t, NUM_OF_OUTPUTS > | OUTPUT_IDX_RANGE () |
Static Public Attributes | |
static constexpr auto | CLASS_ = entities::EntityClass::U_BLOCK |
static constexpr uint8_t | TYPE = 1 |
static constexpr uint8_t | BLOCK_IDX = bus::U_BLOCK_IDX |
static constexpr uint8_t | NUM_OF_INPUTS = 16 |
static constexpr uint8_t | NUM_OF_OUTPUTS = 32 |
Protected Member Functions | |
void | change_a_side_transmission_mode (const Transmission_Mode mode) |
Changes the transmission mode of the regular ublock switches. | |
void | change_b_side_transmission_mode (const Transmission_Mode mode) |
Changes the transmission mode of the alternative ublock switches. | |
void | change_all_transmission_modes (const Transmission_Mode mode) |
Changes the transmission mode for all ublock switches. | |
void | change_all_transmission_modes (const std::pair< Transmission_Mode, Transmission_Mode > modes) |
Changes the transmission mode for all ublock switches. | |
Reference_Magnitude | get_reference_magnitude () |
void | change_reference_magnitude (Reference_Magnitude ref) |
void | reset_reference_magnitude () |
std::pair< Transmission_Mode, Transmission_Mode > | get_all_transmission_modes () const |
bool | _is_connected (const uint8_t input, const uint8_t output) const |
Check whether an input is connected to an output, without sanity checks. | |
void | _connect (const uint8_t input, const uint8_t output) |
Connects output with given input, without sanity checks or disconnection prevention. | |
void | _disconnect (const uint8_t output) |
Disconnects output, without sanity checks. | |
bool | _is_output_connected (const uint8_t output) const |
Check whether an output is connected to any input, without sanity checks. | |
bool | _is_input_connected (const uint8_t input) const |
void | config_self_to_json (JsonObject &cfg) override |
Serialize the configuration of this entity to a JsonObject. | |
utils::status | _config_outputs_from_json (const JsonVariantConst &cfg) |
utils::status | _config_constants_from_json (const JsonVariantConst &cfg) |
![]() | |
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. | |
Static Protected Member Functions | |
static bool | _i_sanity_check (const uint8_t input) |
static bool | _o_sanity_check (const uint8_t output) |
static bool | _io_sanity_check (const uint8_t input, const uint8_t output) |
Protected Attributes | |
UBlockHAL * | hardware |
std::array< int8_t, NUM_OF_OUTPUTS > | output_input_map |
Reference_Magnitude | ref_magnitude = Reference_Magnitude::ONE |
Transmission_Mode | a_side_mode = Transmission_Mode::ANALOG_INPUT |
Transmission_Mode | b_side_mode = Transmission_Mode::ANALOG_INPUT |
![]() | |
std::string | entity_id |
EntityClassifier | classifier |
Friends | |
class | ::platform::Cluster |
class | ::blocks::MBlock |
class | ::blocks::MMulBlock |
class | ::blocks::MIntBlock |
class | ::blocks::MIntBlock_V_1_1_X |
Detailed Description
The Lucidac U-Block (U for Voltage) is represented by this class.
This class provides an in-memory representation of the XBAR bit matrix, neat way of manipulating it and flushing it out to the hardware.
As a Lucidac can only have a single U-Block, this is kind of a singleton. Typical usage happens via the Lucidac class.
@TODO: Should ensure that there is no more then one bit per line, cf. https://lab.analogparadigm.com/lucidac/firmware/hybrid-controller/-/issues/8
Member Typedef Documentation
◆ Reference_Magnitude
◆ Transmission_Mode
Constructor & Destructor Documentation
◆ UBlock() [1/2]
FLASHMEM blocks::UBlock::UBlock | ( | UBlockHAL * | hardware | ) |
Definition at line 26 of file ublock.cpp.
References CLASS_, entities::Entity::classifier, and reset_connections().
◆ UBlock() [2/2]
Member Function Documentation
◆ _config_constants_from_json()
|
protected |
Definition at line 328 of file ublock.cpp.
References utils::status::success().
◆ _config_outputs_from_json()
|
protected |
Definition at line 278 of file ublock.cpp.
References utils::status::success().
◆ _connect()
|
protected |
Connects output with given input, without sanity checks or disconnection prevention.
Definition at line 46 of file ublock.cpp.
◆ _disconnect()
|
protected |
Disconnects output, without sanity checks.
Definition at line 138 of file ublock.cpp.
◆ _i_sanity_check()
|
staticprotected |
Definition at line 38 of file ublock.cpp.
◆ _io_sanity_check()
|
staticprotected |
Definition at line 42 of file ublock.cpp.
◆ _is_connected()
|
protected |
Check whether an input is connected to an output, without sanity checks.
Definition at line 159 of file ublock.cpp.
◆ _is_input_connected()
|
protected |
Definition at line 181 of file ublock.cpp.
◆ _is_output_connected()
|
protected |
Check whether an output is connected to any input, without sanity checks.
Definition at line 170 of file ublock.cpp.
◆ _o_sanity_check()
|
staticprotected |
Definition at line 40 of file ublock.cpp.
◆ change_a_side_transmission_mode()
|
protected |
Changes the transmission mode of the regular ublock switches.
Definition at line 201 of file ublock.cpp.
◆ change_all_transmission_modes() [1/2]
|
protected |
Changes the transmission mode for all ublock switches.
Definition at line 215 of file ublock.cpp.
◆ change_all_transmission_modes() [2/2]
|
protected |
Changes the transmission mode for all ublock switches.
Definition at line 209 of file ublock.cpp.
◆ change_b_side_transmission_mode()
|
protected |
Changes the transmission mode of the alternative ublock switches.
Definition at line 205 of file ublock.cpp.
Referenced by blocks::MMulBlock::calibrate().
◆ change_reference_magnitude()
|
protected |
Definition at line 229 of file ublock.cpp.
Referenced by blocks::MIntBlock_V_1_1_X::calibrate().
◆ 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 257 of file ublock.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 354 of file ublock.cpp.
◆ connect()
FLASHMEM bool blocks::UBlock::connect | ( | const uint8_t | input, |
const uint8_t | output, | ||
const bool | force = false ) |
Connects a block input to a block output.
If the current transmission mode would make the connection impossible but could be changed without consequences, the mode will be adjusted. If the specified output is already connected or the transmission mode can't be corrected, the function fails. If force is true the output will be overwritten and the transmission mode will be adjusted.
Definition at line 50 of file ublock.cpp.
◆ connect_alternative()
FLASHMEM bool blocks::UBlock::connect_alternative | ( | Transmission_Mode | signal_type, |
const uint8_t | output, | ||
const bool | force = false, | ||
bool | use_a_side = false ) |
Connects an alternative input / non block input specified by signal_mode from the a- or b-side to a block output.
a-side inputs will be mapped one to one on the chip input if possible. Fallback chip is input 0. If the current transmission mode would make the connection impossible but could be changed without consequences, the mode will be adjusted. If the specified output is already connected or the transmission mode can't be corrected, the function fails. If force is true the output will be overwritten and the transmission mode will be adjusted.
Note
Definition at line 80 of file ublock.cpp.
◆ disconnect() [1/2]
FLASHMEM bool blocks::UBlock::disconnect | ( | const uint8_t | input, |
const uint8_t | output ) |
Disconnect an input from an output, if they are connected. Both input and output are zero-based indizes.
Definition at line 140 of file ublock.cpp.
◆ disconnect() [2/2]
FLASHMEM bool blocks::UBlock::disconnect | ( | const uint8_t | output | ) |
Disconnect all inputs from an output. Fails for invalid arguments.
Definition at line 152 of file ublock.cpp.
◆ from_entity_classifier()
|
static |
Definition at line 392 of file ublock.cpp.
◆ get_all_transmission_modes()
|
protected |
Definition at line 221 of file ublock.cpp.
◆ get_entity_eui()
|
overridevirtual |
Implements entities::Entity.
Definition at line 32 of file ublock.cpp.
◆ get_reference_magnitude()
|
protected |
Definition at line 225 of file ublock.cpp.
◆ INPUT_IDX_RANGE()
|
inlinestaticconstexpr |
◆ is_anything_connected()
FLASHMEM bool blocks::UBlock::is_anything_connected | ( | ) | const |
Definition at line 194 of file ublock.cpp.
◆ is_connected()
FLASHMEM bool blocks::UBlock::is_connected | ( | const uint8_t | input, |
const uint8_t | output ) const |
Check whether an chip input is connected to an chip / block output.
Definition at line 163 of file ublock.cpp.
◆ is_input_connected()
FLASHMEM bool blocks::UBlock::is_input_connected | ( | const uint8_t | input | ) | const |
Check whether an chip input is connected to any output.
Definition at line 188 of file ublock.cpp.
◆ is_output_connected()
FLASHMEM bool blocks::UBlock::is_output_connected | ( | const uint8_t | output | ) | const |
Check whether an chip / block output is connected to any chip input.
Definition at line 174 of file ublock.cpp.
◆ OUTPUT_IDX_RANGE()
|
inlinestaticconstexpr |
◆ reset()
|
overridevirtual |
Reimplemented from entities::Entity.
Definition at line 246 of file ublock.cpp.
References entities::ResetAction::CIRCUIT_RESET, entities::ResetAction::has(), and entities::Entity::reset().
◆ reset_connections()
FLASHMEM void blocks::UBlock::reset_connections | ( | ) |
Definition at line 242 of file ublock.cpp.
Referenced by UBlock().
◆ reset_reference_magnitude()
|
protected |
Definition at line 407 of file ublock.cpp.
◆ write_to_hardware()
|
nodiscardoverridevirtual |
returns true in case of success
Reimplemented from entities::Entity.
Definition at line 233 of file ublock.cpp.
References utils::status::failure(), LOG, and utils::status::success().
Friends And Related Symbol Documentation
◆ ::blocks::MBlock
|
friend |
◆ ::blocks::MIntBlock
|
friend |
◆ ::blocks::MIntBlock_V_1_1_X
|
friend |
◆ ::blocks::MMulBlock
|
friend |
◆ ::platform::Cluster
|
friend |
Member Data Documentation
◆ a_side_mode
|
protected |
◆ b_side_mode
|
protected |
◆ BLOCK_IDX
|
staticconstexpr |
◆ CLASS_
|
staticconstexpr |
◆ hardware
◆ NUM_OF_INPUTS
◆ NUM_OF_OUTPUTS
|
staticconstexpr |
◆ output_input_map
|
protected |
◆ ref_magnitude
|
protected |
◆ TYPE
The documentation for this class was generated from the following files:
- lib/platform-lucidac/src/block/ublock.h
- lib/platform-lucidac/src/block/ublock.cpp