Further cmake conversion

This commit is contained in:
Markus Rosenstihl 2017-01-19 11:48:08 +00:00
parent f37932e1a7
commit acf0d04de2
7 changed files with 85 additions and 36 deletions

View File

@ -14,12 +14,12 @@ set(dummy_src_files
dummy/temperature_dummy.cpp
)
set(Eurotherm_src_files
#set(Eurotherm_src_files
# Eurotherm-2000Series/control.cpp
Eurotherm-2000Series/Eurotherm-2000Series.cpp
# Eurotherm-2000Series/Eurotherm-2000Series.cpp
# Eurotherm-2000Series/gnuplot_output.cpp
# Eurotherm-2000Series/test.cpp
)
#)
set(PTS_src_files
PTS-Synthesizer/PTS.cpp
@ -73,13 +73,16 @@ set(tiepie_src_files
include_directories(..)
# https://cmake.org/Wiki/CMake/Tutorials/Object_Library
add_library(AD5791 STATIC ${AD5791_src_files})
add_library(tempcont tempcont.cpp)
#add_library(Datel STATIC ${Datel_src_files})
add_library(dummy STATIC ${dummy_src_files})
add_library(Eurotherm-2000Series STATIC ${Eurotherm_src_files} tempcont.cpp)
add_library(PTS STATIC ${PTS_src_files})
add_library(Spectrum_M2i40xxSeries STATIC ${M2i40xx_src_files})
add_subdirectory(Eurotherm-2000Series)
add_subdirectory(PTS-Synthesizer)
add_subdirectory(Spectrum-M2i40xxSeries)
#add_library(Spectrum_M2i40xxSeries STATIC ${M2i40xx_src_files})
add_library(Spectrum_MI40xxSeries STATIC ${MI40xx_src_files})
add_subdirectory(SpinCore-PulseBlaster)
#add_library(PB STATIC ${general_src_files} SpinCore-PulseBlaster/SpinCore-PulseBlaster.cpp)
#add_library(PB_PROG STATIC ${general_src_files} SpinCore-PulseBlaster/PulseBlasterProgram.cpp)
add_library(PB24 STATIC ${PB24_src_files})

View File

@ -67,16 +67,15 @@ AD5791::AD5791(int myid) : id(myid) {
}
AD5791::~AD5791() {}
// This sets the dac_value
void AD5791::set_dac(signed dw) {
dac_value = dw;
}
void AD5791::set_latch_bit(int le_bit) {
void AD5791::set_latch_bit(int le_bit)
{
latch_bit = le_bit;
}
// This sets the DAC
void AD5791::set_dac(state &experiment) {
state_sequent *exp_sequence = dynamic_cast<state_sequent *>(&experiment);
@ -85,9 +84,10 @@ void AD5791::set_dac(state &experiment) {
throw pfg_exception("cannot work on a single state, sorry (todo: change interface)");
else {
for (state_sequent::iterator child_state = exp_sequence->begin();
child_state != exp_sequence->end(); ++child_state)
child_state != exp_sequence->end(); ++child_state) {
set_dac_recursive(*exp_sequence, child_state);
// std::cout << "first state"<< std::endl;
}
std::cout << "first state"<< std::endl;
// Set DAC to 0 at start of experiment
set_dac_to_zero(exp_sequence, exp_sequence->begin());
@ -98,35 +98,51 @@ void AD5791::set_dac(state &experiment) {
}
}
void AD5791::set_dac_to_zero(state_sequent *exp_sequence, state::iterator where) {
state_sequent* AD5791::tx_bit(unsigned int bit) {
state_sequent* tx = new state_sequent();
ttlout* ttl_state = new ttlout();
state s(TIMING);
s.push_back(ttl_state);
ttl_state->ttls = bit*(1<<DATA_BIT) + (1 << CLK_BIT);
tx->push_back(s.copy_new());
ttl_state->ttls = (1<<DATA_BIT);
tx->push_back(s.copy_new());
return tx;
}
void AD5791::set_dac_to_zero(state_sequent* exp_sequence, state::iterator where) {
// 0001 0000 0000 0000 0000 0000
state s(TIMING);
ttlout *ttl_state = new ttlout();
ttlout* ttl_state = new ttlout();
ttl_state->id = 0;
s.push_front(ttl_state);
state_sequent *rep_sequence = new state_sequent();
// test exp_sequence->insert(where, tx_bit(1));
exp_sequence->insert(where, tx_bit(1));
// 0
ttl_state->ttls = 0 + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
ttl_state->ttls = 0;
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
// 0
ttl_state->ttls = 0 + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
ttl_state->ttls = 0;
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
// 0
ttl_state->ttls = 0 + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
ttl_state->ttls = 0;
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
// 1
ttl_state->ttls = (1<<DATA_BIT) + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
ttl_state->ttls = (1<<DATA_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
// the rest
state_sequent *rep_sequence = new state_sequent();
rep_sequence->repeat = DAC_DATA_BITS;
ttl_state->ttls = 0 + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
@ -145,30 +161,30 @@ void AD5791::init_dac(state_sequent *exp_sequence, state::iterator where) {
ttlout *ttl_state = new ttlout();
ttl_state->id = 0;
s.push_front(ttl_state);
state_sequent *rep_sequence = new state_sequent();
// 0010 0000 0000 0000 0000 0000
// 0
ttl_state->ttls = 0 + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
ttl_state->ttls = 0;
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where,s.copy_new());
// 0
ttl_state->ttls = 0 + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
ttl_state->ttls = 0;
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
// 1
ttl_state->ttls = (1<<DATA_BIT) + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where,s.copy_new());
ttl_state->ttls = (1<<DATA_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where,s.copy_new());
// 0
ttl_state->ttls = 0 + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where, s.copy_new());
ttl_state->ttls = 0;
rep_sequence->push_back(s.copy_new());
exp_sequence->insert(where,s.copy_new());
// the rest
state_sequent *rep_sequence = new state_sequent();
rep_sequence->repeat = DAC_DATA_BITS;
ttl_state->ttls = 0 + (1 << CLK_BIT);
rep_sequence->push_back(s.copy_new());
@ -179,7 +195,8 @@ void AD5791::init_dac(state_sequent *exp_sequence, state::iterator where) {
//read in the word
ttl_state->ttls = 0;
exp_sequence->insert(where, s.copy_new());
ttl_state->ttls = (1 << latch_bit);
ttl_state->ttls = (1 << latch_bit) + (1<<CLK_BIT);
s.length = 180e-9;
exp_sequence->insert(where, s.copy_new());
}
@ -204,7 +221,9 @@ void AD5791::set_dac_recursive(state_sequent &the_sequence, state::iterator &the
// find an analogout section with suitable id
state::iterator pos = this_state->begin();
while (pos != this_state->end()) { // state members loop
analogout *aout = dynamic_cast<analogout *>(*pos); // initialize new analogout
analogout *aout = dynamic_cast<analogout *>(*pos); // initialize new analogout from state
if (aout != NULL)
std::cout << aout->id << std::endl;
// This is for me, analogout is != NULL (there is an analogout) and has my ID
if (aout != NULL && aout->id == id) {
if (dac_analog_out == NULL) {
@ -219,16 +238,17 @@ void AD5791::set_dac_recursive(state_sequent &the_sequence, state::iterator &the
// remove the analog out section
this_state->erase(pos++);
} else {
std::cout << "nope" << std::endl;
++pos;
}
} // state members loop
if (dac_analog_out != NULL) { // state modifications
//std::cout<<"found a analog out section, value="<<dac_analog_out->dac_value<<std::endl;
// check the length of the state
if (this_state->length < TIMING * (DAC_CONTROL_BITS + DAC_DATA_BITS) * 2 + 1)
throw pfg_exception("time is too short to save DAC information");
throw pfg_exception("AD5791: time is too short to save DAC information");
else {
// copy of original state
state *register_state = new state(*this_state);
@ -249,6 +269,7 @@ void AD5791::set_dac_recursive(state_sequent &the_sequence, state::iterator &the
int bit = dac_analog_out->dac_value & 1;
dac_word.push_back(bit);
dac_analog_out->dac_value >>= 1;
std::cout << bit;
}
// reverse the bit pattern (MSB first)
reverse(dac_word.begin(), dac_word.end());

View File

@ -6,6 +6,7 @@
#include "core/states.h"
#include "drivers/pfggen.h"
#include "../../core/states.h"
/**
* \ingroup drivers
@ -39,6 +40,8 @@ public:
void set_dac_to_zero(state_sequent* exp_sequence, state::iterator where);
void init_dac(state_sequent* exp_sequence, state::iterator where);
void set_dac_control(state_sequent* exp_sequence, state::iterator where, int input_shift_register);
state_sequent *tx_bit(unsigned int bit);
};
/*class pfg_exception: public std::string {

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.0)
add_library(Eurotherm-2000Series Eurotherm-2000Series.cpp)

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.0)
add_library(PTS PTS.cpp)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.0)
set( SPC_DRV drv_spcm_linux_drv_v214b5633.zip)
set(SPC_HEADERS
include/spcerr.h
include/regs.h
include/dlltyp.h
include/spcioctl.inc)
add_custom_command(OUTPUT ${SPC_HEADERS}
COMMAND ${CMAKE_COMMAND} -E unzip -u ${SPC_DRV} "*.h" "*.txt" "*.inc" -d include/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
COMMENT "Unpacking SPC headers"
VERBATIM)
add_library(Spectrum-M2i40xxSeries STATIC Spectrum-M2i40xxSeries.cpp GatedData.cpp)

View File

@ -36,7 +36,7 @@ set(SOURCE_FILES
add_executable(dummycore dummycore.cpp hardware.cpp)
target_link_libraries( dummycore pthread ${XERCES_LIBRARIES} core dummy Eurotherm-2000Series)
target_link_libraries( dummycore pthread ${XERCES_LIBRARIES} core dummy tempcont Eurotherm-2000Series)
add_executable(PFGcore PFGcore.cpp hardware.cpp)
target_link_libraries( PFGcore pthread ${XERCES_LIBRARIES} core Spectrum_MI40xxSeries PB PB24 PB_PROG PTS Tecmag-DAC20 )