Low Level HAL
Digital Bus
Chip communication
-
namespace functions
namespace for internal helpers
The AD8402 is a two channel, 8 bit digital potentiometer.
Calculation of actual resistance values is a bit complicated and greatly depends on the hardware conditions. Writing raw values is sufficient for our uses in m block calibraiton.
-
class AD5452 : public functions::DataFunction
- #include <AD5452.h>
The AD5452 is the 12-Bit Multiplying DAC, used in the C-Block (one AD5452 per lane).
This class encapsulates the SPI programming access to the chip.
Public Functions
-
void set_scale(float scale)
Value gets clamped to min and max values.
-
void set_scale(uint16_t scale_raw)
-
void set_scale(float scale)
-
class AD8402 : public functions::DataFunction
- #include <AD840X.h>
Public Functions
-
bool write_channel_raw(uint8_t ch, uint8_t raw)
Channel can be 0 or 1. Will return false on invalid channels.
Public Static Attributes
-
static const SPISettings DEFAULT_SPI_SETTINGS = {4'000'000, MSBFIRST, SPI_MODE3}
-
bool write_channel_raw(uint8_t ch, uint8_t raw)
-
class AD8403 : public functions::DataFunction
- #include <AD840X.h>
The AD8403 is a four channel, 8 bit digital potentiometer.
Calculation of actual resistance values is a bit complicated and greatly depends on the hardware conditions. Writing raw values is sufficient for our uses in m block calibraiton.
Public Functions
-
bool write_channel_raw(uint8_t ch, uint8_t raw)
Channel can be beteen 0 and 3.
Will return false on invalid channels or on invalid readbacks in pedantic mode
Public Static Attributes
-
static const SPISettings DEFAULT_SPI_SETTINGS = {100'000, MSBFIRST, SPI_MODE0}
-
bool write_channel_raw(uint8_t ch, uint8_t raw)
-
class AD9834 : public functions::DataFunction
- #include <AD9834.h>
Public Functions
-
bool init()
Initialises the chip and puts it into sleep mode.
-
void write_frequency(float freq)
Sets the frequency of the sine / triangle output in Hz.
Note that the square output will always operate on half of the specified frequency.
-
void write_phase(float phase)
Sets the phase of the outputs synchronised to the reset pin. Possible values are mapped to [0, 2PI].
-
void write_wave_form(WaveForm wave_form)
Sets the wave form of the function generator output.
-
float get_real_frequency() const
Returns the actually set frequency, containing rounding errors.
-
float get_real_phase() const
Returns the actually set phase, containing rounding errors. Possible values are [0, 2PI].
-
void sleep()
Sets the sine / triangle output to zero. The square output will stay at high or low level.
-
void awake()
Resumes outputs to regular operation, according to the previously specified frequencies.
Public Static Attributes
-
static const SPISettings DEFAULT_SPI_SETTINGS = {4'000'000, MSBFIRST, SPI_MODE2}
-
static uint16_t REG_FREQ_0 = 0x4000
-
static uint16_t REG_FREQ_1 = 0x8000
-
static uint16_t REG_PHASE_0 = 0xC000
-
static uint16_t REG_PHASE_1 = 0xE000
-
static uint16_t REG_FREQ_MASK = 0x3FFF
-
static uint16_t REG_PHASE_MASK = 0x0FFF
-
static uint16_t CONTROL_B28 = 0x2000
-
static uint16_t CONTROL_HLB = 0x1000
-
static uint16_t CONTROL_FSEL = 0x0800
-
static uint16_t CONTROL_PSEL = 0x0400
-
static uint16_t CONTROL_PINSW = 0x0200
-
static uint16_t CONTROL_RESET = 0x0100
-
static uint16_t CONTROL_SLEEP1 = 0x0080
-
static uint16_t CONTROL_SLEEP12 = 0x0040
-
static uint16_t CONTROL_OPBITEN = 0x0020
-
static uint16_t CONTROL_SIGNPIB = 0x0010
-
static uint16_t CONTROL_DIV2 = 0x0008
-
static uint16_t CONTROL_MODE = 0x0002
-
static uint16_t ENABLE_SQUARE_WAVE = CONTROL_OPBITEN
-
static uint16_t ENABLE_TRIANGLE_WAVE = CONTROL_MODE
-
static float MASTER_CLK = 75000000.0f
-
bool init()
-
class DAC60508 : public functions::DataFunction
- #include <DAC60508.h>
The DAC60508 is the 12-Bit 8-channel DAC, used in the MInt-Block for the initial conditions.
This class encapsulates the SPI programming access to the chip.
Public Functions
-
uint16_t float_to_raw(float value) const
Value gets clamped to min and max values.
-
float raw_to_float(uint16_t value) const
-
bool set_channel_raw(uint8_t idx, uint16_t value) const
Raw value can be between RAW_ZERO and RAW_MAX.
-
bool set_channel(uint8_t idx, float value) const
-
bool init() const
-
bool set_external_reference(bool set = true) const
-
bool set_double_gain(uint8_t idx, bool set = true) const
-
bool set_double_gain(bool set = true) const
Public Static Functions
-
static inline uint8_t REG_DAC(const uint8_t i)
Public Static Attributes
-
static uint8_t REG_NOOP = 0
-
static uint8_t REG_DEVICE_ID = 1
-
static uint8_t REG_SYNC = 2
-
static uint8_t REG_CONFIG = 3
-
static uint8_t REG_GAIN = 4
-
static uint8_t REG_TRIGGER = 5
-
static uint8_t REG_BROADCAST = 6
-
static uint8_t REG_STATUS = 7
-
static uint16_t RAW_ZERO = 0x0
-
static uint16_t RAW_MAX = 0x0FFF
-
static const SPISettings DEFAULT_SPI_SETTINGS = {4'000'000, MSBFIRST, SPI_MODE2}
-
uint16_t float_to_raw(float value) const
-
class DataFunction : public functions::Function
- #include <functions.h>
A DataFunction class wraps SPI communication over the digital bus.
The communication is configured at constructor level, while the transfer functions basically decorate the Arduino/Teensyduino SPIClass access with hardware bus addressing.
Subclassed by metadata::MetadataMemory< 256 >, functions::AD5452, functions::AD8402, functions::AD8403, functions::AD9834, functions::DAC60508, functions::EEPROM25AA02, functions::SR74HC16X, functions::SR74HCT595, functions::SyncFunction, functions::TMP127Q1, functions::UMatrixFunction, metadata::MetadataMemory< dataSize >
Public Members
-
const SPISettings &spi_settings
-
const SPISettings &spi_settings
-
class EEPROM25AA02 : public functions::DataFunction
- #include <EEPROM25AA02.h>
Subclassed by metadata::MetadataEditor
Public Functions
-
size_t read(size_t address, size_t length, uint8_t *buffer) const
Reads the specified number of bytes starting at address into the specified buffer. Returns number of read bytes on success, 0 on failure.
-
bool read8(size_t address, uint8_t *data_out) const
Reads one byte at the specified address into the provided pointer. Returns 0 on failure.
-
bool read16(size_t address, uint16_t *data_out) const
Reads two bytes starting at the specified address into the provided pointer. Returns 0 on failure.
-
bool read32(size_t address, uint32_t *data_out) const
Reads four bytes starting at the specified address into the provided pointer. Returns 0 on failure.
-
size_t write(size_t address, size_t length, const uint8_t *buffer) const
Writes the specified number of bytes starting at address into the specified buffer. Returns number of written bytes on success, 0 on failure.
-
bool write8(size_t address, uint8_t data) const
Writes one byte at the specified address Returns 0 on failure.
-
bool write16(size_t address, uint16_t data) const
Writes two bytes starting at the specified address Returns 0 on failure.
-
bool write32(size_t address, uint32_t data) const
Writes four bytes starting at the specified address Returns 0 on failure.
Public Static Attributes
-
static const SPISettings DEFAULT_SPI_SETTINGS = {4'000'000, MSBFIRST, SPI_MODE0}
-
static uint8_t ADDRESS_UUID = 0xF8
-
class Status
- #include <EEPROM25AA02.h>
Public Functions
-
inline explicit Status(const uint8_t data_)
-
inline explicit operator uint8_t() const
-
inline bool is_write_in_progress() const
-
inline bool is_write_enabled() const
-
inline bool is_block_zero_protected() const
-
inline void set_block_zero_protection(bool on = true)
-
inline bool is_block_one_protected() const
-
inline void set_block_one_protection(bool on = true)
-
inline void set_block_protection(bool on = true)
-
inline void unset_block_protection()
-
inline bool is_any_block_protected() const
-
inline explicit Status(const uint8_t data_)
-
size_t read(size_t address, size_t length, uint8_t *buffer) const
-
class Function
- #include <functions.h>
Function classes encapsulate digital bus calls.
This base class stores the bus address while child classes may store additional configuration data or even communication states.
Subclassed by functions::DataFunction, functions::TriggerFunction
-
class ICommandRegisterFunction : public functions::SR74HCT595
- #include <icmd.h>
DataFunction to transfer 32bit of data to the I-Block matrix command registry.
Data is [8bit 4_* SR][8bit 3_* SR][8bit 2_* SR][8bit 1_* SR] -> [0-15 X 0-07][16-31 X 0-7][0-15 X 8-15][16-31 X 8-15] [ input X output ] matrix Each is [DATA Y2 Y1 Y0 X3 X2 X1 X0] Data bit comes first, most significant bit comes first (in SPI)
See chip_cmd_word and IBlock::write_to_hardware for more information and the actual calculation of the bitstream.
Public Functions
Public Static Functions
-
static uint8_t chip_cmd_word(uint8_t chip_input_idx, uint8_t chip_output_idx, bool connect = true)
Public Static Attributes
-
static const SPISettings DEFAULT_SPI_SETTINGS{4'000'000, MSBFIRST, SPI_MODE2}
-
static uint8_t chip_cmd_word(uint8_t chip_input_idx, uint8_t chip_output_idx, bool connect = true)
-
class SR74HC16X : public functions::DataFunction
- #include <SR74HC16X.h>
Public Static Attributes
-
static const SPISettings DEFAULT_SPI_SETTINGS{4'000'000, MSBFIRST, SPI_MODE3}
-
static const SPISettings DEFAULT_SPI_SETTINGS{4'000'000, MSBFIRST, SPI_MODE3}
-
class SR74HCT595 : public functions::DataFunction
- #include <SR74HCT595.h>
The SR74HCT595 is an 8-Bit Shift Register with 3-State Output Registers.
It is used for instance at the MIntBlock and the CBlock.
Subclassed by functions::ICommandRegisterFunction
-
class SyncFunction : public functions::DataFunction
- #include <functions.h>
-
class TMP127Q1 : public functions::DataFunction
- #include <TMP127Q1.h>
Public Static Functions
-
static int16_t raw_to_signed_raw(uint16_t raw)
-
static float raw_to_float(uint16_t raw)
Public Static Attributes
-
static const SPISettings DEFAULT_SPI_SETTINGS = {4'000'000, MSBFIRST, SPI_MODE0}
-
static int16_t raw_to_signed_raw(uint16_t raw)
-
class TriggerFunction : public functions::Function
- #include <functions.h>
A trigger function exploits the fact that setting an address on the bus triggers an action (TODO: Is that description right?)
-
class UMatrixFunction : public functions::DataFunction
- #include <ublock.h>
Public Functions
-
template<size_t num_of_outputs>
bool transfer(const std::array<int8_t, num_of_outputs> &outputs) const Convert an output array to data packets and transfer to chip.
Timing: ~5microseconds
Public Static Attributes
-
static const SPISettings DEFAULT_SPI_SETTINGS = {4'000'000, MSBFIRST, SPI_MODE2}
-
template<size_t num_of_outputs>
-
class AD5452 : public functions::DataFunction
Misc Digital IO
Warning
doxygennamespace: Cannot find namespace “io” in doxygen xml output for project “hybrid-controller” from directory: ../doxygen/xml/