REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches

The DAC60508 is the 12-Bit 8-channel DAC, used in the MInt-Block for the initial conditions. More...

#include <DAC60508.h>

Inheritance diagram for functions::DAC60508:
Collaboration diagram for functions::DAC60508:

Public Member Functions

 DAC60508 (bus::addr_t address, 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, const SPISettings &spiSettings)
 
- Public Member Functions inherited from functions::DataFunction
 DataFunction (bus::addr_t address, const SPISettings &spiSettings)
 
void begin_communication () const
 
void end_communication () 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
 
- Protected Member Functions inherited from functions::DataFunction
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
 
- Static Protected Member Functions inherited from functions::DataFunction
static SPIClass & get_raw_spi ()
 

Detailed Description

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.

Definition at line 17 of file DAC60508.h.

Constructor & Destructor Documentation

◆ DAC60508()

functions::DAC60508::DAC60508 ( bus::addr_t address,
float reference_voltage = 2.5f )
explicit

Definition at line 33 of file DAC60508.cpp.

Member Function Documentation

◆ DataFunction()

functions::DataFunction::DataFunction ( bus::addr_t address,
const SPISettings & spiSettings )

Definition at line 63 of file functions.cpp.

◆ 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.

◆ 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()

static constexpr uint8_t functions::DAC60508::REG_DAC ( const uint8_t i)
inlinestaticconstexpr

Definition at line 28 of file DAC60508.h.

◆ set_channel()

bool functions::DAC60508::set_channel ( uint8_t idx,
float value ) const

Definition at line 54 of file DAC60508.cpp.

◆ 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.

◆ 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.

◆ set_external_reference()

bool functions::DAC60508::set_external_reference ( bool set = true) const

Definition at line 68 of file DAC60508.cpp.

Member Data Documentation

◆ DEFAULT_SPI_SETTINGS

const SPISettings functions::DAC60508::DEFAULT_SPI_SETTINGS {4'000'000, MSBFIRST, SPI_MODE2}
static

Definition at line 7 of file DAC60508.h.

◆ RAW_MAX

uint16_t functions::DAC60508::RAW_MAX = 0x0FFF
staticconstexpr

◆ RAW_ZERO

uint16_t functions::DAC60508::RAW_ZERO = 0x0
staticconstexpr

◆ REG_BROADCAST

uint8_t functions::DAC60508::REG_BROADCAST = 6
staticconstexpr

Definition at line 25 of file DAC60508.h.

◆ REG_CONFIG

uint8_t functions::DAC60508::REG_CONFIG = 3
staticconstexpr

Definition at line 22 of file DAC60508.h.

Referenced by init().

◆ REG_DEVICE_ID

uint8_t functions::DAC60508::REG_DEVICE_ID = 1
staticconstexpr

Definition at line 20 of file DAC60508.h.

◆ REG_GAIN

uint8_t functions::DAC60508::REG_GAIN = 4
staticconstexpr

Definition at line 23 of file DAC60508.h.

Referenced by init().

◆ REG_NOOP

uint8_t functions::DAC60508::REG_NOOP = 0
staticconstexpr

Definition at line 19 of file DAC60508.h.

◆ REG_STATUS

uint8_t functions::DAC60508::REG_STATUS = 7
staticconstexpr

Definition at line 26 of file DAC60508.h.

◆ REG_SYNC

uint8_t functions::DAC60508::REG_SYNC = 2
staticconstexpr

Definition at line 21 of file DAC60508.h.

◆ REG_TRIGGER

uint8_t functions::DAC60508::REG_TRIGGER = 5
staticconstexpr

Definition at line 24 of file DAC60508.h.


The documentation for this class was generated from the following files: