Skip to content

Commit

Permalink
add reg4 function
Browse files Browse the repository at this point in the history
  • Loading branch information
mroda88 committed Nov 22, 2024
1 parent 0bde737 commit 7c13618
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion schema/appmodel/PDS.schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

<oks-schema>

<info name="" type="" num-of-items="9" oks-format="schema" oks-version="862f2957270" created-by="mroda" created-on="theta.ph.liv.ac.uk" creation-time="20241011T123346" last-modified-by="maroda" last-modified-on="np04-srv-015.cern.ch" last-modification-time="20241122T174146"/>
<info name="" type="" num-of-items="9" oks-format="schema" oks-version="862f2957270" created-by="mroda" created-on="theta.ph.liv.ac.uk" creation-time="20241011T123346" last-modified-by="maroda" last-modified-on="np04-srv-015.cern.ch" last-modification-time="20241122T180722"/>

<include>
<file path="schema/confmodel/dunedaq.schema.xml"/>
Expand Down Expand Up @@ -119,6 +119,9 @@
<attribute name="low_resolution" description="true=12bit, false=14bit" type="bool" init-value="false" is-not-null="yes"/>
<attribute name="output_offset_binary" description="true=Offset Binary, false=2s complement" type="bool" init-value="true" is-not-null="yes"/>
<attribute name="MSB_first" description="Which Significant bit comes first, true=MSB, false=LSB" type="bool" init-value="true" is-not-null="yes"/>
<method name="get_reg4" description="">
<method-implementation language="c++" prototype="uint16_t get_reg4() const" body=""/>
</method>
</class>

<class name="DaphneV2AFE">
Expand Down
17 changes: 17 additions & 0 deletions src/DaphneApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
#include "appmodel/DaphneV2BoardConf.hpp"
#include "appmodel/DaphneV2Channel.hpp"
#include "appmodel/DaphneV2AFE.hpp"
#include "appmodel/DaphneV2ADC.hpp"
#include "appmodel/DaphneV2ControllerModule.hpp"
#include "appmodel/DaphneApplication.hpp"


#include <string>
#include <vector>
#include <bitset>
#include <iostream>
#include <fmt/core.h>

Expand Down Expand Up @@ -190,3 +192,18 @@ DaphneV2BoardConf::get_afe(size_t ch) const {

return *get_default_afe();
}


uint16_t
DaphneV2ADC::get_reg4() const {

// ADC, reg 4 has no parsing as it's all made of booleans
std::bitset<5> reg4;
// bits 0 and 2 are reserved
reg4[1] = get_low_resolution();
reg4[3] = get_output_offset_binary();
reg4[4] = get_MSB_first();
return reg4.to_ulong();
}


0 comments on commit 7c13618

Please sign in to comment.