[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10642 - gnuradio/branches/developers/eb/t348/gr-usrp/
From: |
eb |
Subject: |
[Commit-gnuradio] r10642 - gnuradio/branches/developers/eb/t348/gr-usrp/apps |
Date: |
Wed, 18 Mar 2009 23:23:57 -0600 (MDT) |
Author: eb
Date: 2009-03-18 23:23:57 -0600 (Wed, 18 Mar 2009)
New Revision: 10642
Modified:
gnuradio/branches/developers/eb/t348/gr-usrp/apps/usrp_siggen.cc
gnuradio/branches/developers/eb/t348/gr-usrp/apps/usrp_siggen.h
Log:
Added -N <nsamples> option to C++ usrp_siggen. If allowed to exit
normally both usrp_siggen.cc and test_usrp_standard_tx.cc work OK, and
there is no carrier transmitted after exiting.
Modified: gnuradio/branches/developers/eb/t348/gr-usrp/apps/usrp_siggen.cc
===================================================================
--- gnuradio/branches/developers/eb/t348/gr-usrp/apps/usrp_siggen.cc
2009-03-19 05:20:04 UTC (rev 10641)
+++ gnuradio/branches/developers/eb/t348/gr-usrp/apps/usrp_siggen.cc
2009-03-19 05:23:57 UTC (rev 10642)
@@ -60,20 +60,20 @@
usrp_siggen_sptr make_usrp_siggen(int which, usrp_subdev_spec spec,
double rf_freq, int interp, double wfreq,
int waveform, float amp, float gain,
- float offset)
+ float offset, long long nsamples)
{
return gnuradio::get_initial_sptr(new usrp_siggen(which, spec,
rf_freq, interp, wfreq,
waveform, amp, gain,
- offset));
+ offset, nsamples));
}
// Hierarchical block constructor, with no inputs or outputs
usrp_siggen::usrp_siggen(int which, usrp_subdev_spec spec,
double rf_freq, int interp, double wfreq,
int waveform, float amp, float gain,
- float offset) :
- gr_top_block("usrp_siggen")
+ float offset, long long nsamples)
+ : gr_top_block("usrp_siggen")
{
usrp_sink_c_sptr usrp = usrp_make_sink_c(which, interp);
@@ -126,7 +126,14 @@
siggen->set_waveform((gr_waveform_t)waveform);
- connect(source, 0, usrp, 0);
+ if (nsamples > 0){
+ gr_block_sptr head = gr_make_head(sizeof(gr_complex), nsamples);
+ connect(source, 0, head, 0);
+ connect(head, 0, usrp, 0);
+ }
+ else {
+ connect(source, 0, usrp, 0);
+ }
}
int main(int argc, char *argv[])
@@ -140,6 +147,7 @@
float gain = -1; // set the d'board PGA gain
float offset = 0; // set waveform offset
int waveform;
+ double nsamples = 0; // set the number of samples to transmit
(0 -> inf)
po::options_description cmdconfig("Program options");
cmdconfig.add_options()
@@ -158,6 +166,7 @@
("amplitude,a", po::value<float>(&), "set amplitude")
("gain,g", po::value<float>(&gain), "set output gain to GAIN")
("offset,o", po::value<float>(&offset), "set waveform offset to OFFSET")
+ ("nsamples,N", po::value<double>(&nsamples), "number of samples to send
[default=+inf]")
;
po::variables_map vm;
@@ -199,14 +208,15 @@
waveform = GR_SIN_WAVE;
}
- printf("which: %d\n", which);
- printf("interp: %d\n", interp);
- printf("rf_freq: %g\n", rf_freq);
- printf("amp: %f\n", amp);
+ printf("which: %d\n", which);
+ printf("interp: %d\n", interp);
+ printf("rf_freq: %g\n", rf_freq);
+ printf("amp: %f\n", amp);
+ printf("nsamples: %g\n", nsamples);
usrp_siggen_sptr top_block = make_usrp_siggen(which, spec, rf_freq,
interp, wfreq, waveform,
- amp, gain, offset);
+ amp, gain, offset, (long long)
nsamples);
top_block->run();
Modified: gnuradio/branches/developers/eb/t348/gr-usrp/apps/usrp_siggen.h
===================================================================
--- gnuradio/branches/developers/eb/t348/gr-usrp/apps/usrp_siggen.h
2009-03-19 05:20:04 UTC (rev 10641)
+++ gnuradio/branches/developers/eb/t348/gr-usrp/apps/usrp_siggen.h
2009-03-19 05:23:57 UTC (rev 10642)
@@ -31,7 +31,7 @@
usrp_siggen_sptr make_usrp_siggen(int which, usrp_subdev_spec spec,
double rf_freq, int interp, double wfreq,
int waveform, float amp, float gain,
- float offset);
+ float offset, long long nsamples);
class usrp_siggen : public gr_top_block
{
@@ -39,11 +39,12 @@
usrp_siggen(int which, usrp_subdev_spec spec,
double rf_freq, int interp, double wfreq,
int waveform, float amp, float gain,
- float offset);
+ float offset, long long nsamples);
friend usrp_siggen_sptr make_usrp_siggen(int which, usrp_subdev_spec spec,
double rf_freq, int interp, double
wfreq,
int waveform, float amp, float
gain,
- float offset);
+ float offset,
+ long long nsamples);
public:
gr_block_sptr source;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10642 - gnuradio/branches/developers/eb/t348/gr-usrp/apps,
eb <=