diff --git a/Cpp/src/CMakeLists.txt b/Cpp/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..aca0c5aad217ba8338c0b6ed01871a4c2f4a300f --- /dev/null +++ b/Cpp/src/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(main example.cpp) \ No newline at end of file diff --git a/Cpp/src/example.cpp b/Cpp/src/example.cpp new file mode 100644 index 0000000000000000000000000000000000000000..161fe246f85c25a525fbbcd9c22a74225931c8c0 --- /dev/null +++ b/Cpp/src/example.cpp @@ -0,0 +1,77 @@ +#include <iostream> +#include <set> +#include "../lib/waveform.h" +#include "../lib/AWG.h" + +int main() { + auto sr = 614.4e6; + + auto wfm = ArrayWaveform(); + // idealy, waveform param setting here are loaded from + // another waveform via some sort of config file + wfm.setSamplingRate(sr); + wfm.setFreqResolution(1e3); + wfm.setFreqTone( + 105e6, + 1e6, + 5 + ); + wfm.setAmplitude(std::vector<double> (5, 2000)); + wfm.setPhase(std::vector<double> (5, 0)); + wfm.printParam(); + // generate waveform + auto wfmData = wfm.getStaticWaveform(); + + // auto awg = AWG(); + // awg.open(0); // open card at index 0 + // awg.setSampleRate(sr); // set card sampling rate + // awg.setActiveChannels(std::set<int> {0}); // set output channels + // awg.setChannel( // set channel output params + // 0, + // 2500, + // AWG::CHANNEL_STOPLVL::ZERO, + // true + // ); + // awg.setTrigMode( + // 0, + // AWG::TRIGGER_MODE::POS + // ); // set trigger channel 0 (EXT0) mode to be positve edge + // awg.setTrigMaskOr({ + // AWG::TRIGGER_MASK::EXT0, + // // AWG::TRIGGER_MASK::EXT1 + // }); // set the trigger engine to be OR and enable both + // // channel EXT0 and/or EXT1 + // awg.initReplayModeSeq(2); // intializes card for sequence replay mode + // // with two memory segments + // awg.writeSeqModeSegment( + // 0, + // wfmData.first, + // wfmData.second + // ); + // awg.writeSeqModeSegment( + // 1, + // wfmData.first, + // wfmData.second + // ); // load wfms onto both memory segements for simplicity, + // // a memory segment needs only be initialized with data + // // if it is configured as part of the step sequence below + // awg.setSeqModeStep( + // 0, + // 0, + // 1, + // 1, + // AWG::SEQ_LOOPCONDITION::ONTRIG + // ); + // awg.setSeqModeStep( + // 1, + // 1, + // 0, + // 1, + // AWG::SEQ_LOOPCONDITION::ONTRIG + // ); + // awg.cardRun(); + // awg.cardStop(); + // awg.close(); + + return 0; +} \ No newline at end of file