LCOV - code coverage report
Current view: top level - timing/src - DACNode.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 22 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 7 0

            Line data    Source code
       1              : /**
       2              :  * @file DACNode.cpp
       3              :  *
       4              :  * This is part of the DUNE DAQ Software Suite, copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : 
       9              : #include "timing/DACNode.hpp"
      10              : 
      11              : namespace dunedaq {
      12              : namespace timing {
      13              : 
      14              : // uHAL Node registation
      15            0 : UHAL_REGISTER_DERIVED_NODE(DACNode)
      16              : 
      17              : //-----------------------------------------------------------------------------
      18            0 : DACSlave::DACSlave(const I2CMasterNode* i2c_master, uint8_t address) // NOLINT(build/unsigned)
      19            0 :   : I2CSlave(i2c_master, address)
      20            0 : {}
      21              : //-----------------------------------------------------------------------------
      22              : 
      23              : //-----------------------------------------------------------------------------
      24              : void
      25            0 : DACSlave::set_interal_ref(bool internal_ref) const
      26              : {
      27            0 :   this->write_i2cArray(0x38, { 0x0, internal_ref });
      28            0 : }
      29              : //-----------------------------------------------------------------------------
      30              : 
      31              : //-----------------------------------------------------------------------------
      32              : void
      33            0 : DACSlave::set_dac(uint8_t channel, uint32_t code) const // NOLINT(build/unsigned)
      34              : {
      35              : 
      36            0 :   if (channel > 7) {
      37            0 :     throw DACChannelOutOfRange(ERS_HERE, std::to_string(channel));
      38              :   }
      39              : 
      40            0 :   if (code > 0xffff) {
      41            0 :     throw DACValueOutOfRange(ERS_HERE, std::to_string(code));
      42              :   }
      43              : 
      44            0 :   uint32_t address = 0x18 + (channel & 0x7); // NOLINT(build/unsigned)
      45              : 
      46            0 :   this->write_i2cArray(address, { (uint8_t)((code >> 8) & 0xff), (uint8_t)(code & 0xff) }); // NOLINT(build/unsigned)
      47            0 : }
      48              : //-----------------------------------------------------------------------------
      49              : 
      50              : //-----------------------------------------------------------------------------
      51            0 : DACNode::DACNode(const uhal::Node& node)
      52              :   : I2CMasterNode(node)
      53            0 :   , DACSlave(this, this->get_slave_address("i2caddr"))
      54            0 : {}
      55              : //-----------------------------------------------------------------------------
      56              : 
      57              : //-----------------------------------------------------------------------------
      58            0 : DACNode::DACNode(const DACNode& node)
      59              :   : I2CMasterNode(node)
      60            0 :   , DACSlave(this, this->get_slave_address("i2caddr"))
      61            0 : {}
      62              : //-----------------------------------------------------------------------------
      63              : 
      64              : //-----------------------------------------------------------------------------
      65            0 : DACNode::~DACNode() {}
      66              : //-----------------------------------------------------------------------------
      67              : 
      68              : } // namespace timing
      69              : } // namespace dunedaq
        

Generated by: LCOV version 2.0-1