Skip to content

Instantly share code, notes, and snippets.

@stef
Created March 24, 2021 22:51
Show Gist options
  • Save stef/e7818dc85b48c06d98a333e01f3d526f to your computer and use it in GitHub Desktop.
Save stef/e7818dc85b48c06d98a333e01f3d526f to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.8)
project(clenabled-intel-racecond-trigger)
include_directories(
${GNURADIO_ALL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
set(GR_LIBRARIES
boost_system
gnuradio-blocks
gnuradio-filter
gnuradio-analog
gnuradio-audio
gnuradio-runtime
gnuradio-pmt
gnuradio-clenabled
log4cpp
)
add_executable(racecond racecond.cpp)
target_link_libraries(racecond ${GR_LIBRARIES})
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/throttle.h>
#include <gnuradio/analog/sig_source.h>
#include <clenabled/clMathOp.h>
using namespace gr;
int main(int argc, char** argv) {
int sample_rate = 1e6;
top_block_sptr top_block = make_top_block("cl racecond trigger");
analog::sig_source_c::sptr sig_source1 = analog::sig_source_c::make(sample_rate, gr::analog::GR_COS_WAVE, 0, 0);
analog::sig_source_c::sptr sig_source2 = analog::sig_source_c::make(sample_rate, gr::analog::GR_SIN_WAVE, 0, 0);
clenabled::clMathOp::sptr mul1 = clenabled::clMathOp::make(1,1,1,0,0,1,0);
clenabled::clMathOp::sptr mul2 = clenabled::clMathOp::make(1,1,1,0,0,1,0);
blocks::throttle::sptr throttle1 = blocks::throttle::make(sizeof(gr_complex), sample_rate, true);
blocks::throttle::sptr throttle2 = blocks::throttle::make(sizeof(gr_complex), sample_rate, true);
blocks::null_sink::sptr sink = blocks::null_sink::make (sizeof(gr_complex));
top_block->connect(sig_source1, 0, throttle1, 0);
top_block->connect(sig_source2, 0, throttle2, 0);
top_block->connect(throttle1, 0, mul1, 1);
top_block->connect(throttle1, 0, mul2, 1);
top_block->connect(throttle2, 0, mul1, 0);
top_block->connect(throttle2, 0, mul2, 0);
top_block->connect(mul1, 0, sink, 0);
top_block->connect(mul2, 0, sink, 1);
top_block->run();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment