|
REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
|
The DAC60508 is the 12-Bit 8-channel DAC, used in the MInt-Block for the initial conditions and for calibration on the MMul-Block. More...
#include <DAC60508.h>


Public Member Functions | |
| DAC60508 (bus::addr_t address, uint8_t alt_function_idx, float reference_voltage=2.5f) | |
| 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 |
| DataFunction (bus::addr_t address, uint8_t alt_function_idx, const SPISettings &spiSettings) | |
Public Member Functions inherited from functions::DataFunction | |
| DataFunction (bus::addr_t address, uint8_t alt_function_idx, const SPISettings &spiSettings) | |
| void | begin_communication () const |
| void | end_communication () const |
| void | transfer (const void *mosi_buf, void *miso_buf, size_t count) const |
| uint8_t | transfer8 (uint8_t data_in) const |
| uint16_t | transfer16 (uint16_t data_in) const |
| uint32_t | transfer32 (uint32_t data_in) const |
Public Member Functions inherited from functions::Function | |
| Function (bus::addr_t address) | |
Static Public Member Functions | |
| static constexpr uint8_t | REG_DAC (const uint8_t i) |
Static Public Attributes | |
| static constexpr uint8_t | REG_NOOP = 0 |
| static constexpr uint8_t | REG_DEVICE_ID = 1 |
| static constexpr uint8_t | REG_SYNC = 2 |
| static constexpr uint8_t | REG_CONFIG = 3 |
| static constexpr uint8_t | REG_GAIN = 4 |
| static constexpr uint8_t | REG_TRIGGER = 5 |
| static constexpr uint8_t | REG_BROADCAST = 6 |
| static constexpr uint8_t | REG_STATUS = 7 |
| static constexpr uint16_t | RAW_ZERO = 0x0 |
| static constexpr uint16_t | RAW_MAX = 0x0FFF |
| static const SPISettings | DEFAULT_SPI_SETTINGS {4'000'000, MSBFIRST, SPI_MODE2} |
Additional Inherited Members | |
Public Attributes inherited from functions::DataFunction | |
| const SPISettings & | spi_settings |
Public Attributes inherited from functions::Function | |
| const bus::addr_t | address |
Static Protected Member Functions inherited from functions::DataFunction | |
| static SPIClass & | get_raw_spi () |
Protected Attributes inherited from functions::DataFunction | |
| bus::addr_t | alt_function_address |
| bool | use_csel = false |
Detailed Description
The DAC60508 is the 12-Bit 8-channel DAC, used in the MInt-Block for the initial conditions and for calibration on the MMul-Block.
This class encapsulates the SPI programming access to the chip.
Definition at line 17 of file DAC60508.h.
Constructor & Destructor Documentation
◆ DAC60508()
|
explicit |
Definition at line 33 of file DAC60508.cpp.
References functions::Function::address, DataFunction(), and DEFAULT_SPI_SETTINGS.
Member Function Documentation
◆ DataFunction()
| functions::DataFunction::DataFunction | ( | bus::addr_t | address, |
| uint8_t | alt_function_idx, | ||
| const SPISettings & | spiSettings ) |
Definition at line 68 of file functions.cpp.
Referenced by DAC60508().
◆ float_to_raw()
| uint16_t functions::DAC60508::float_to_raw | ( | float | value | ) | const |
Value gets clamped to min and max values.
Definition at line 36 of file DAC60508.cpp.
References RAW_MAX, and RAW_ZERO.
Referenced by set_channel().
◆ init()
| bool functions::DAC60508::init | ( | ) | const |
Definition at line 58 of file DAC60508.cpp.
References REG_CONFIG, and REG_GAIN.
◆ raw_to_float()
| float functions::DAC60508::raw_to_float | ( | uint16_t | value | ) | const |
Definition at line 44 of file DAC60508.cpp.
◆ REG_DAC()
|
inlinestaticconstexpr |
Definition at line 28 of file DAC60508.h.
Referenced by set_channel(), and set_channel_raw().
◆ set_channel()
| bool functions::DAC60508::set_channel | ( | uint8_t | idx, |
| float | value ) const |
Definition at line 54 of file DAC60508.cpp.
References float_to_raw(), and REG_DAC().
◆ set_channel_raw()
| bool functions::DAC60508::set_channel_raw | ( | uint8_t | idx, |
| uint16_t | value ) const |
Raw value can be between RAW_ZERO and RAW_MAX.
Definition at line 48 of file DAC60508.cpp.
◆ set_double_gain() [1/2]
| bool functions::DAC60508::set_double_gain | ( | bool | set = true | ) | const |
Definition at line 90 of file DAC60508.cpp.
References REG_GAIN.
◆ set_double_gain() [2/2]
| bool functions::DAC60508::set_double_gain | ( | uint8_t | idx, |
| bool | set = true ) const |
Definition at line 77 of file DAC60508.cpp.
References REG_GAIN.
◆ set_external_reference()
| bool functions::DAC60508::set_external_reference | ( | bool | set = true | ) | const |
Definition at line 68 of file DAC60508.cpp.
References REG_CONFIG.
Member Data Documentation
◆ DEFAULT_SPI_SETTINGS
|
static |
Definition at line 7 of file DAC60508.h.
Referenced by DAC60508().
◆ RAW_MAX
|
staticconstexpr |
Definition at line 31 of file DAC60508.h.
Referenced by float_to_raw(), blocks::MMDRBlockHAL_V_1_0_X::float_to_raw_calibration(), blocks::MMulBlockHAL_V_1_0_X::float_to_raw_calibration(), blocks::MMDRBlockHAL_V_1_0_X::raw_to_float_calibration(), blocks::MMulBlockHAL_V_1_0_X::raw_to_float_calibration(), and set_channel_raw().
◆ RAW_ZERO
|
staticconstexpr |
Definition at line 30 of file DAC60508.h.
Referenced by float_to_raw(), blocks::MMDRBlockHAL_V_1_0_X::float_to_raw_calibration(), blocks::MMulBlockHAL_V_1_0_X::float_to_raw_calibration(), blocks::MMDRBlockHAL_V_1_0_X::raw_to_float_calibration(), and blocks::MMulBlockHAL_V_1_0_X::raw_to_float_calibration().
◆ REG_BROADCAST
|
staticconstexpr |
Definition at line 25 of file DAC60508.h.
◆ REG_CONFIG
|
staticconstexpr |
Definition at line 22 of file DAC60508.h.
Referenced by init(), and set_external_reference().
◆ REG_DEVICE_ID
|
staticconstexpr |
Definition at line 20 of file DAC60508.h.
◆ REG_GAIN
|
staticconstexpr |
Definition at line 23 of file DAC60508.h.
Referenced by init(), set_double_gain(), and set_double_gain().
◆ REG_NOOP
|
staticconstexpr |
Definition at line 19 of file DAC60508.h.
◆ REG_STATUS
|
staticconstexpr |
Definition at line 26 of file DAC60508.h.
◆ REG_SYNC
|
staticconstexpr |
Definition at line 21 of file DAC60508.h.
◆ REG_TRIGGER
|
staticconstexpr |
Definition at line 24 of file DAC60508.h.
The documentation for this class was generated from the following files:
- lib/hardware/src/chips/DAC60508.h
- lib/hardware/src/chips/DAC60508.cpp
Public Member Functions inherited from