From 0967d6029802510f4925b6b13037d6e5f5f38464 Mon Sep 17 00:00:00 2001 From: David Michaeli Date: Wed, 31 Jan 2024 20:57:40 +0200 Subject: [PATCH] added gr read test with c api --- .../cariboulite_source_test/CMakeLists.txt | 41 +++++++ .../cariboulite_source_test.cpp | 44 ++++++++ .../cariboulite_source_test.hpp | 44 ++++++++ .../gr-caribouLite/examples/read_samples.grc | 104 ++++-------------- 4 files changed, 149 insertions(+), 84 deletions(-) create mode 100644 software/gr-caribouLite/examples/cariboulite_source_test/CMakeLists.txt create mode 100644 software/gr-caribouLite/examples/cariboulite_source_test/cariboulite_source_test.cpp create mode 100644 software/gr-caribouLite/examples/cariboulite_source_test/cariboulite_source_test.hpp diff --git a/software/gr-caribouLite/examples/cariboulite_source_test/CMakeLists.txt b/software/gr-caribouLite/examples/cariboulite_source_test/CMakeLists.txt new file mode 100644 index 0000000..038a98b --- /dev/null +++ b/software/gr-caribouLite/examples/cariboulite_source_test/CMakeLists.txt @@ -0,0 +1,41 @@ +# GNU Radio C++ Flow Graph CMakeLists.txt +# +# Title: Cariboulite Source Test +# Author: Alon and David +# GNU Radio version: v3.11.0.0git-604-gd7f88722 + + +cmake_minimum_required(VERSION 3.8) +set(CMAKE_CXX_STANDARD 14) + +project(cariboulite_source_test) + +find_package(Gnuradio "3.11" COMPONENTS + blocks + fec + fft + filter + analog + digital + dtv + audio + channels + qtgui + trellis + uhd + video-sdl + vocoder + wavelet + zeromq +) + + + + +find_package(gnuradio-caribouLite) +add_executable(cariboulite_source_test cariboulite_source_test.cpp) +target_link_libraries(cariboulite_source_test + gnuradio::gnuradio-blocks + gnuradio::gnuradio-caribouLite +) + diff --git a/software/gr-caribouLite/examples/cariboulite_source_test/cariboulite_source_test.cpp b/software/gr-caribouLite/examples/cariboulite_source_test/cariboulite_source_test.cpp new file mode 100644 index 0000000..cd96437 --- /dev/null +++ b/software/gr-caribouLite/examples/cariboulite_source_test/cariboulite_source_test.cpp @@ -0,0 +1,44 @@ +/******************** +GNU Radio C++ Flow Graph Source File + +Title: Cariboulite Source Test +Author: Alon and David +GNU Radio version: v3.11.0.0git-604-gd7f88722 +********************/ + +#include "cariboulite_source_test.hpp" + +using namespace gr; + + +cariboulite_source_test::cariboulite_source_test () { + + + this->tb = gr::make_top_block("Cariboulite Source Test"); + +// Blocks: + this->caribouLite_caribouLiteSource_0 = caribouLite::caribouLiteSource::make(0, false, 40.0, 2500000.0, 4000000.0, 900000000.0); + + this->blocks_null_sink_0 = blocks::null_sink::make(sizeof(gr_complex)*1); + + +// Connections: + this->tb->hier_block2::connect(this->caribouLite_caribouLiteSource_0, 0, this->blocks_null_sink_0, 0); +} + +cariboulite_source_test::~cariboulite_source_test () { +} + +// Callbacks: + +int main (int argc, char **argv) { + + cariboulite_source_test* top_block = new cariboulite_source_test(); + top_block->tb->start(); + std::cout << "Press Enter to quit: "; + std::cin.ignore(); + top_block->tb->stop(); + top_block->tb->wait(); + + return 0; +} diff --git a/software/gr-caribouLite/examples/cariboulite_source_test/cariboulite_source_test.hpp b/software/gr-caribouLite/examples/cariboulite_source_test/cariboulite_source_test.hpp new file mode 100644 index 0000000..e05c16b --- /dev/null +++ b/software/gr-caribouLite/examples/cariboulite_source_test/cariboulite_source_test.hpp @@ -0,0 +1,44 @@ +#ifndef CARIBOULITE_SOURCE_TEST_HPP +#define CARIBOULITE_SOURCE_TEST_HPP +/******************** +GNU Radio C++ Flow Graph Header File + +Title: Cariboulite Source Test +Author: Alon and David +GNU Radio version: v3.11.0.0git-604-gd7f88722 +********************/ + +/******************** +** Create includes +********************/ +#include +#include +#include + + + +using namespace gr; + + + +class cariboulite_source_test { + +private: + + + caribouLite::caribouLiteSource::sptr caribouLite_caribouLiteSource_0; + blocks::null_sink::sptr blocks_null_sink_0; + + + +public: + top_block_sptr tb; + cariboulite_source_test(); + ~cariboulite_source_test(); + + +}; + + +#endif + diff --git a/software/gr-caribouLite/examples/read_samples.grc b/software/gr-caribouLite/examples/read_samples.grc index 77cefd7..665584a 100644 --- a/software/gr-caribouLite/examples/read_samples.grc +++ b/software/gr-caribouLite/examples/read_samples.grc @@ -9,11 +9,11 @@ options: description: '' gen_cmake: 'On' gen_linking: dynamic - generate_options: qt_gui + generate_options: no_gui hier_block_src_path: '.:' id: cariboulite_source_test max_nouts: '0' - output_language: python + output_language: cpp placement: (0,0) qt_qss_theme: '' realtime_scheduling: '' @@ -33,6 +33,23 @@ options: state: enabled blocks: +- name: blocks_null_sink_0 + id: blocks_null_sink + parameters: + affinity: '' + alias: '' + bus_structure_sink: '[[0,],]' + comment: '' + num_inputs: '1' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [624, 256.0] + rotation: 0 + state: enabled - name: caribouLite_caribouLiteSource_0 id: caribouLite_caribouLiteSource parameters: @@ -54,90 +71,9 @@ blocks: coordinate: [296, 212.0] rotation: 0 state: enabled -- name: qtgui_freq_sink_x_0 - id: qtgui_freq_sink_x - parameters: - affinity: '' - alias: '' - alpha1: '1.0' - alpha10: '1.0' - alpha2: '1.0' - alpha3: '1.0' - alpha4: '1.0' - alpha5: '1.0' - alpha6: '1.0' - alpha7: '1.0' - alpha8: '1.0' - alpha9: '1.0' - autoscale: 'False' - average: '1.0' - axislabels: 'True' - bw: 4e6 - color1: '"blue"' - color10: '"dark blue"' - color2: '"red"' - color3: '"green"' - color4: '"black"' - color5: '"cyan"' - color6: '"magenta"' - color7: '"yellow"' - color8: '"dark red"' - color9: '"dark green"' - comment: '' - ctrlpanel: 'False' - fc: '0' - fftsize: '1024' - freqhalf: 'True' - grid: 'False' - gui_hint: '' - label: Relative Gain - label1: '' - label10: '''''' - label2: '''''' - label3: '''''' - label4: '''''' - label5: '''''' - label6: '''''' - label7: '''''' - label8: '''''' - label9: '''''' - legend: 'True' - maxoutbuf: '0' - minoutbuf: '0' - name: '""' - nconnections: '1' - norm_window: 'False' - showports: 'False' - tr_chan: '0' - tr_level: '0.0' - tr_mode: qtgui.TRIG_MODE_FREE - tr_tag: '""' - type: complex - units: dB - update_time: '0.10' - width1: '1' - width10: '1' - width2: '1' - width3: '1' - width4: '1' - width5: '1' - width6: '1' - width7: '1' - width8: '1' - width9: '1' - wintype: window.WIN_BLACKMAN_hARRIS - ymax: '10' - ymin: '-140' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [656, 236.0] - rotation: 0 - state: enabled connections: -- [caribouLite_caribouLiteSource_0, '0', qtgui_freq_sink_x_0, '0'] +- [caribouLite_caribouLiteSource_0, '0', blocks_null_sink_0, '0'] metadata: file_format: 1