Buisness Code

Blocks

namespace blocks

Typedefs

using CBlockHAL_Parent = entities::EntitySharedHardware<CBlockHAL>
using CTRLBlockHAL_Parent = entities::EntitySharedHardware<CTRLBlockHALBase>
using IBlockHAL_Parent = entities::EntitySharedHardware<IBlockHAL>
using MIntBlockHAL_Parent = entities::EntitySharedHardware<MIntBlockHAL>
using MMulBlockHAL_Parent = entities::EntitySharedHardware<MMulBlockHAL>
using SHBlockHAL_Parent = entities::EntitySharedHardware<SHBlockHAL>
using UBlockHAL_Parent = entities::EntitySharedHardware<UBlockHAL>
class CBlockHAL_Common : public entities::EntitySharedHardware<CBlockHAL>
#include <cblock.h>

Subclassed by blocks::CBlockHAL_V_1_0_X, blocks::CBlockHAL_V_1_1_X

Public Functions

CBlockHAL_Common(bus::addr_t block_address, bus::addr_t temperature_sensor_address, std::array<const uint8_t, 32> f_coeffs_cs)
bool write_factor(uint8_t idx, float value) override

Public Static Functions

static std::array<functions::AD5452, 32> make_f_coeffs(bus::addr_t block_address, std::array<const uint8_t, 32> f_coeffs_cs)
class CBlockHAL_V_1_0_X : public blocks::CBlockHAL_Common
#include <cblock.h>

Public Functions

explicit CBlockHAL_V_1_0_X(bus::addr_t block_address)
class CBlockHAL_V_1_1_X : public blocks::CBlockHAL_Common
#include <cblock.h>

Public Functions

explicit CBlockHAL_V_1_1_X(bus::addr_t block_address)
class CTRLBlockHAL_V_1_0_2 : public entities::EntitySharedHardware<CTRLBlockHALBase>
#include <ctrlblock.h>

Public Functions

CTRLBlockHAL_V_1_0_2(bus::addr_t block_address)
bool write_adc_bus_muxers(ADCBus adc_bus) override
bool write_sync_id(uint8_t id) override
class DummyCBlockHAL : public CBlockHAL
#include <cblock.h>

Public Functions

inline DummyCBlockHAL(std::array<const uint8_t, 32> f_coeffs_cs)
bool write_factor(uint8_t idx, float value) override
inline metadata::eui_t get_entity_eui() const override
class DummyCTRLBlockHAL : public CTRLBlockHALBase
#include <ctrlblock.h>

Public Functions

inline DummyCTRLBlockHAL()
bool write_adc_bus_muxers(ADCBus adc_bus) override
bool write_sync_id(uint8_t id) override
inline metadata::eui_t get_entity_eui() const override
class DummyIBlockHAL : public IBlockHAL
#include <iblock.h>

Public Functions

inline explicit DummyIBlockHAL()
bool write_outputs(const std::array<uint32_t, 16> &outputs) override
bool write_upscaling(std::bitset<32> upscaling) override
inline metadata::eui_t get_entity_eui() const override
class DummyMIntBlockHAL : public MIntBlockHAL
#include <mblock_int.h>

Public Functions

inline explicit DummyMIntBlockHAL()
inline bool init() override
inline bool write_ic(uint8_t idx, float ic) override
inline bool write_time_factor_switches(std::bitset<8> switches) override
inline std::bitset<8> read_overload_flags() override
inline void reset_overload_flags() override
inline metadata::eui_t get_entity_eui() const override
class DummyMMulBlockHAL : public MMulBlockHAL
#include <mblock_mul.h>

Public Functions

inline explicit DummyMMulBlockHAL()
inline metadata::eui_t get_entity_eui() const override
bool init() override
bool write_calibration_input_offsets(uint8_t idx, uint16_t offset_x, uint16_t offset_y) override
bool write_calibration_output_offset(uint8_t idx, uint16_t offset_z) override
std::bitset<8> read_overload_flags() override
void reset_overload_flags() override

Public Static Functions

static inline float raw_to_float_calibration(uint16_t raw)

Takes in DAC raw value, returns voltage recieved by multiplier.

Public Static Attributes

static float MIN_OFFSET = -0.1f
static float MAX_OFFSET = +0.1f
class DummySHBlockHAL : public SHBlockHAL
#include <shblock.h>

Public Functions

inline explicit DummySHBlockHAL()
inline metadata::eui_t get_entity_eui() const override
void compensate_hardware_offsets(uint32_t track_time, uint32_t inject_time)
void set_state(SHState state) const
class DummyUBlockHAL : public UBlockHAL
#include <ublock.h>

Public Functions

inline explicit DummyUBlockHAL()
bool write_outputs(std::array<int8_t, 32> outputs) override
bool write_transmission_modes_and_ref(std::pair<Transmission_Mode, Transmission_Mode> modes, Reference_Magnitude ref) override
void reset_transmission_modes_and_ref() override
inline metadata::eui_t get_entity_eui() const override
class IBlockHAL_V_1_2_X : public entities::EntitySharedHardware<IBlockHAL>
#include <iblock.h>

Public Functions

explicit IBlockHAL_V_1_2_X(bus::addr_t block_address)
bool write_outputs(const std::array<uint32_t, 16> &outputs) override
bool write_upscaling(std::bitset<32> upscaling) override
class MIntBlock_V_1_1_X : public MIntBlock
#include <mblock_int.h>

Public Functions

MIntBlock_V_1_1_X(SLOT slot, MIntBlockHAL_V_1_1_X *hardware)
utils::status write_to_hardware() override
void reset(entities::ResetAction action) override
const std::array<IntegratorCalibration, NUM_INTEGRATORS> &get_calibration() const
blocks::IntegratorCalibration get_calibration(uint8_t int_idx) const
utils::status write_calibration_to_hardware()
bool calibrate(platform::Cluster *cluster, carrier::Carrier *carrier) override
class MIntBlockHAL_V_1_0_X : public entities::EntitySharedHardware<MIntBlockHAL>
#include <mblock_int.h>

Subclassed by blocks::MIntBlockHAL_V_1_1_X

Public Functions

explicit MIntBlockHAL_V_1_0_X(bus::addr_t block_address)
bool init() override
bool write_ic(uint8_t idx, float ic) override
bool write_time_factor_switches(std::bitset<8> switches) override
std::bitset<8> read_overload_flags() override
void reset_overload_flags() override
class MIntBlockHAL_V_1_1_X : public blocks::MIntBlockHAL_V_1_0_X
#include <mblock_int.h>

Public Functions

explicit MIntBlockHAL_V_1_1_X(bus::addr_t block_address)
bool write_ic(uint8_t idx, float ic) override
bool write_time_factor_switches(std::bitset<8> switches) override
virtual bool write_limiters_enable(std::bitset<8> limiters)
virtual bool write_time_factor_switches_and_limiters_enable(std::bitset<8> switches, std::bitset<8> limiters)
virtual bool write_time_factor_gain(uint8_t idx, uint8_t gain)
class MMulBlock_FullAutoCalibration : public MMulBlock
#include <mblock_mul.h>

Public Functions

MMulBlock_FullAutoCalibration(SLOT slot, blocks::MMulBlockHAL_FullAutoCalibration *hardware)
bool calibrate(platform::Cluster *cluster, carrier::Carrier *carrier) override
utils::status write_calibration_to_hardware() override
class MMulBlockHAL_FullAutoCalibration : public MMulBlockHAL
#include <mblock_mul.h>

Subclassed by blocks::MMulBlockHAL_V_1_1_X, blocks::MMulBlockHAL_V_1_M1_X

Public Functions

virtual bool write_calibration_gain(uint8_t idx, uint8_t gain) = 0
class MMulBlockHAL_V_1_0_X : public entities::EntitySharedHardware<MMulBlockHAL>
#include <mblock_mul.h>

Subclassed by blocks::MMulBlockHAL_V_1_1_X, blocks::MMulBlockHAL_V_1_M1_X

Public Functions

explicit MMulBlockHAL_V_1_0_X(bus::addr_t block_address)
bool init() override
bool write_calibration_input_offsets(uint8_t idx, uint16_t offset_x, uint16_t offset_y) override
bool write_calibration_output_offset(uint8_t idx, uint16_t offset_z) override
std::bitset<8> read_overload_flags() override
void reset_overload_flags() override

Public Static Functions

static inline float raw_to_float_calibration(uint16_t raw)

Takes in DAC raw value, returns voltage recieved by multiplier.

static inline uint16_t float_to_raw_calibration(float value)

Takes in voltage recieved by multiplier, returns DAC raw value.

Public Static Attributes

static float MIN_OFFSET = -0.1f
static float MAX_OFFSET = +0.1f
static uint16_t RAW_ZERO = functions::DAC60508::RAW_ZERO
static uint16_t RAW_MAX = functions::DAC60508::RAW_MAX
class MMulBlockHAL_V_1_1_X : public blocks::MMulBlockHAL_V_1_0_X, public blocks::MMulBlockHAL_FullAutoCalibration
#include <mblock_mul.h>

Public Functions

explicit MMulBlockHAL_V_1_1_X(bus::addr_t block_address)
virtual bool write_calibration_gain(uint8_t idx, uint8_t gain) override
inline std::bitset<8> read_overload_flags() override
inline void reset_overload_flags() override
inline bool write_calibration_input_offsets(uint8_t idx, uint16_t offset_x, uint16_t offset_y) override
inline bool write_calibration_output_offset(uint8_t idx, uint16_t offset_z) override
inline float read_temperature() const override
class MMulBlockHAL_V_1_M1_X : public blocks::MMulBlockHAL_V_1_0_X, public blocks::MMulBlockHAL_FullAutoCalibration
#include <mblock_mul.h>

Public Functions

explicit MMulBlockHAL_V_1_M1_X(bus::addr_t block_address)
virtual bool write_calibration_gain(uint8_t idx, uint8_t gain) override
inline std::bitset<8> read_overload_flags() override
inline void reset_overload_flags() override
inline bool write_calibration_input_offsets(uint8_t idx, uint16_t offset_x, uint16_t offset_y) override
inline bool write_calibration_output_offset(uint8_t idx, uint16_t offset_z) override
inline float read_temperature() const override
class SHBlockHAL_V_0_1_X : public entities::EntitySharedHardware<SHBlockHAL>
#include <shblock.h>

Public Functions

explicit SHBlockHAL_V_0_1_X(bus::addr_t block_address)
void compensate_hardware_offsets(uint32_t track_time, uint32_t inject_time)
void set_state(SHState state) const
class UBlockHAL_Common : public entities::EntitySharedHardware<UBlockHAL>
#include <ublock.h>

Subclassed by blocks::UBlockHAL_V_1_2_X

Public Functions

explicit UBlockHAL_Common(bus::addr_t block_address, uint8_t f_umatrix_cs, uint8_t f_umatrix_sync_cs, uint8_t f_transmission_mode_register_cs, uint8_t f_transmission_mode_sync_cs, uint8_t f_transmission_mode_reset_cs)
bool write_outputs(std::array<int8_t, 32> outputs) override
bool write_transmission_modes_and_ref(std::pair<Transmission_Mode, Transmission_Mode> modes, Reference_Magnitude ref) override
void reset_transmission_modes_and_ref() override
class UBlockHAL_V_1_2_X : public blocks::UBlockHAL_Common
#include <ublock.h>

Public Functions

inline explicit UBlockHAL_V_1_2_X(const bus::addr_t block_address)

Platform

namespace platform
class Dummy_LUCIDAC_HAL : public LUCIDAC_HAL
#include <lucidac.h>

Public Functions

inline Dummy_LUCIDAC_HAL()
inline bool write_acl(std::array<ACL, 8> acl) override

Write bits to ACL shift register, from I-block input 24 (first element) to 31 (last element)

inline void reset_acl() override
inline bool write_adc_bus_mux(std::array<int8_t, 8> channels) override

Write channel selection to ADC bus muxer.

Each element in channels selects the input index for the n-th ADC bus output (-1 disables).

inline void reset_adc_bus_mux() override
class NativeLEDs : public LEDs
#include <leds.h>

Public Functions

NativeLEDs()
bool set(const uint8_t led, bool on) override

Sets specified front led to the specified value.

void set_all(const uint8_t states) override

Sets all eight front leds at once.

void reset() override

Disables all eight front leds.

uint8_t get_all() const override

Returns the current state of the front leds.

utils::status write_to_hardware() const override
class NativeSignalGenerator : public SignalGenerator
#include <signal_generator.h>

Public Functions

NativeSignalGenerator()
bool init() override

Initializes the signal generator and puts it to sleep.

inline bool is_installed() const override

Returns wether an signal generator module is actually installed and active.

Writing to an uninstalled generator will result in fauilure

void set_frequency(float frequency) override

Sets the frequency of the sine / triangle output in Hz.

Note that the square output will always operate on half of the specified frequency. Returns the actually set frequency.

void set_phase(float phase) override

Sets the phase of the frequency outputs synchronised to the reset pin.

Possible values are [0, 2 PI]. Returns the actually set phase.

void set_wave_form(WaveForm wave_form) override

Sets the wave form of the function generator output.

bool set_amplitude(float amplitude) override

Sets the amplitude of the sine or triangle wave in machine units.

Possible values are: [0, 1]. The amplitude of the square output is not affected by this function.

bool set_square_voltage_levels(float low, float high) override

Sets the lower and upper value of the square output in machine units.

Possible values are: [-1, 1]. The amplitude of the sine / triangle output is not affected by this function.

bool set_square_voltage_low(float low) override

Sets the lower value of the square output in machine units.

Possible values are: [-1, 1]. The amplitude of the sine / triangle output is not affected by this function.

bool set_square_voltage_high(float high) override

Sets the upper value of the square output in machine units.

Possible values are: [-1, 1]. The amplitude of the sine / triangle output is not affected by this function.

bool set_offset(float offset) override

Sets the constant offset of the sine or triangle output in machine units.

The levels of the square output are not affected by this function.

float get_real_frequency() const override

Returns the actually set frequency of the function generator, containing rounding errors.

float get_real_phase() const override

Returns the actually set phase of the function generator, containing rounding errors.

Possible values are mapped to [0, 2PI].

float get_frequency() const override
float get_phase() const override
WaveForm get_wave_form() const override
float get_amplitude() const override
float get_square_voltage_low() const override
float get_square_voltage_high() const override
float get_offset() const override
bool get_sleep() const override
float get_dac_out0() const override
float get_dac_out1() const override
void sleep() override

Sets the sine / triangle output of the function generator to zero.

The square output will stay at high or low level.

void awake() override

Resumes outputs of the function generator to regular operation, according to the previously specified frequencies.

bool set_dac_out0(float value) override

Writes the DACout0 constant voltage output. Possible values are: [-2V, 2V].

bool set_dac_out1(float value) override

Writes the DACout1 constant voltage output. Possible values are: [-2V, 2V].

utils::status write_to_hardware() override
class Teensy_LUCIDAC_HAL : public LUCIDAC_HAL
#include <lucidac.h>

Public Functions

Teensy_LUCIDAC_HAL()
bool write_acl(std::array<ACL, 8> acl) override

Write bits to ACL shift register, from I-block input 24 (first element) to 31 (last element)

void reset_acl() override
bool write_adc_bus_mux(std::array<int8_t, 8> channels) override

Write channel selection to ADC bus muxer.

Each element in channels selects the input index for the n-th ADC bus output (-1 disables).

void reset_adc_bus_mux() override
inline float read_temperature() const override

Public Static Attributes

static uint8_t CARRIER_MADDR = 5
static uint8_t METADATA_FADDR = bus::METADATA_FUNC_IDX
static uint8_t TEMPERATURE_FADDR = 1
static uint8_t ADC_PRG_FADDR = 2
static uint8_t ADC_RESET_8816_FADDR = 3
static uint8_t ADC_RESET_SR_FADDR = 4
static uint8_t ADC_STROBE_FADDR = 5
static uint8_t ACL_PRG_FADDR = 6
static uint8_t ACL_UPD_FADDR = 7
static uint8_t ACL_CRL_FADDR = 8
class TeensyLEDs : public LEDs
#include <leds.h>

Public Functions

TeensyLEDs()
bool set(const uint8_t led, bool on) override

Sets specified front led to the specified value.

void set_all(const uint8_t states) override

Sets all eight front leds at once.

void reset() override

Disables all eight front leds.

uint8_t get_all() const override

Returns the current state of the front leds.

utils::status write_to_hardware() const override
class TeensySignalGenerator : public SignalGenerator
#include <signal_generator.h>

Public Functions

TeensySignalGenerator()
bool init() override

Initializes the signal generator and puts it to sleep.

inline bool is_installed() const override

Returns wether an signal generator module is actually installed and active.

Writing to an uninstalled generator will result in fauilure

void set_frequency(float frequency) override

Sets the frequency of the sine / triangle output in Hz.

Note that the square output will always operate on half of the specified frequency. Returns the actually set frequency.

void set_phase(float phase) override

Sets the phase of the frequency outputs synchronised to the reset pin.

Possible values are [0, 2 PI]. Returns the actually set phase.

void set_wave_form(WaveForm wave_form) override

Sets the wave form of the function generator output.

bool set_amplitude(float amplitude) override

Sets the amplitude of the sine or triangle wave in machine units.

Possible values are: [0, 1]. The amplitude of the square output is not affected by this function.

bool set_square_voltage_levels(float low, float high) override

Sets the lower and upper value of the square output in machine units.

Possible values are: [-1, 1]. The amplitude of the sine / triangle output is not affected by this function.

bool set_square_voltage_low(float low) override

Sets the lower value of the square output in machine units.

Possible values are: [-1, 1]. The amplitude of the sine / triangle output is not affected by this function.

bool set_square_voltage_high(float high) override

Sets the upper value of the square output in machine units.

Possible values are: [-1, 1]. The amplitude of the sine / triangle output is not affected by this function.

bool set_offset(float offset) override

Sets the constant offset of the sine or triangle output in machine units.

The levels of the square output are not affected by this function.

float get_real_frequency() const override

Returns the actually set frequency of the function generator, containing rounding errors.

float get_real_phase() const override

Returns the actually set phase of the function generator, containing rounding errors.

Possible values are mapped to [0, 2PI].

float get_frequency() const override
float get_phase() const override
WaveForm get_wave_form() const override
float get_amplitude() const override
float get_square_voltage_low() const override
float get_square_voltage_high() const override
float get_offset() const override
bool get_sleep() const override
float get_dac_out0() const override
float get_dac_out1() const override
void sleep() override

Sets the sine / triangle output of the function generator to zero.

The square output will stay at high or low level.

void awake() override

Resumes outputs of the function generator to regular operation, according to the previously specified frequencies.

bool set_dac_out0(float value) override

Writes the DACout0 constant voltage output. Possible values are: [-2V, 2V].

bool set_dac_out1(float value) override

Writes the DACout1 constant voltage output. Possible values are: [-2V, 2V].

utils::status write_to_hardware() override

Entity structure

namespace entities

Variables

EntityManager_ EntityManager
class EntityManager_
#include <entity_manager.h>

Public Functions

inline EntityClassifier read_classifier(bus::addr_t address)
inline void addEntity(bus::addr_t address, EntityClassifier classifier)
template<class Parent>
class EntitySharedHardware : public Parent
#include <hardware.h>

Subclassed by blocks::CBlockHAL_Common, blocks::CTRLBlockHAL_V_1_0_2, blocks::IBlockHAL_V_1_2_X, blocks::MIntBlockHAL_V_1_0_X, blocks::MMulBlockHAL_V_1_0_X, blocks::SHBlockHAL_V_0_1_X, blocks::UBlockHAL_Common

Public Functions

inline metadata::eui_t get_entity_eui() const
inline float read_temperature() const
namespace metadata
class MetadataEditor : public functions::EEPROM25AA02
#include <meta.h>

Public Functions

inline explicit MetadataEditor(bus::addr_t address)
inline entities::EntityClassifier read_entity_classifier() const
inline eui_t read_eui() const
inline bool write_entity_classifier(const entities::EntityClassifier &classifier) const
template<std::size_t dataSize>
class MetadataMemory : public functions::DataFunction
#include <metadata.h>

The abstract metadata memory class allows to represent different EEPROM sizes, for instance does the 25AA02E64 hold 256 bytes while 25AA02E32 holds only 128 bytes.

However, the extension rather looks into bigger then smaller EEPROMs.

Public Functions

inline explicit MetadataMemory(const unsigned short address, const SPISettings &spi_settings)
virtual size_t read_from_hardware(size_t byte_offset, size_t length, uint8_t *buffer) const = 0
inline size_t read_from_hardware()
template<class Layout_>
inline const Layout_ &as() const