SoDaRadio-12.2.0-cut_dependencies:6c82803
Loading...
Searching...
No Matches
SoDa::PlutoRX Class Reference

#include <PlutoRX.hxx>

Inheritance diagram for SoDa::PlutoRX:
SoDa::RadioRX SoDa::Thread SoDa::Base SoDa::Debug

Public Member Functions

 ~PlutoRX ()
void setNCOFreq (double freq) override
 Update the IF NCO frequency used by the complex mixer.
bool downConvert () override
 Refill the IIO buffer (2.5 MSPS), resample to 625 kSPS, mix, and publish 30000-sample CBufs to rx_stream.
void startStream () override
 Arm the streaming flag so downConvert() publishes samples.
void stopStream () override
 Disarm the streaming flag; IIO DMA continues draining silently.
bool streamEnabled () override
 test the processing stream flag
void enableIFStreamer (bool enable) override
 Control whether raw RF samples are forwarded to the IF stream.
Public Member Functions inherited from SoDa::RadioRX
 RadioRX (ParamsPtr params)
 Constructor Build a RadioRX thread.
void run () final
 start the thread
virtual void init ()
 perform initialization.
Public Member Functions inherited from SoDa::Thread
void registerThread (SoDa::ThreadPtr me)
void operator() ()
void start ()
 Execute the thread's run loop.
void join ()
 more properly "Wait for this thread to exit its run loop".
void execCommand (CommandPtr cmd)
 Execute (dispatch) a message removed from the command stream to one of the basic Command handler functions.
virtual void shutDown ()
 optional method that performs cleanup – may not delete.
void sleep_ms (unsigned int milliseconds)
void sleep_us (unsigned int microseconds)
uint32_t getID ()
 Get the process/thread ID for this thread – helps with figuring out who caused a segfault.
Public Member Functions inherited from SoDa::Base
 Base (const std::string &oname)
 The constructor – pass a name for the object.
void registerSelf (BasePtr ptr)
std::string & getObjName ()
 get the name of this object
BasePtr findSoDaObject (const std::string &oname)
 find a SoDa Object by name.
double getTime ()
 Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typically < 100nS).
BasePtr getSelfPtr ()
 get a pointer to myself.
Public Member Functions inherited from SoDa::Debug
 Debug (std::string _unit_name=std::string("UNKNOWN"))
 Debug (const char *_unit_name_cstr)
 Debug (unsigned int _debug_level, std::string _unit_name=std::string("UNKNOWN"))
 Debug (unsigned int _debug_level, const char *_unit_name_cstr)
void debugMsg (const std::string &msg, unsigned int threshold=1)
void debugMsg (const SoDa::Format &fmt, unsigned int threshold=1)
void debugMsg (const char *msg, unsigned int threshold=1)
void setDebugLevel (unsigned int v)
unsigned int getDebugLevel ()

Static Public Member Functions

static PlutoRXPtr make (ParamsPtr params)
Static Public Member Functions inherited from SoDa::Debug
static void setDefaultLevel (unsigned int v)
static unsigned int getDefaultLevel ()
static void setGlobalLevel (unsigned int v)
static unsigned int getGlobalLevel ()

Protected Member Functions

 PlutoRX (ParamsPtr params)
Protected Member Functions inherited from SoDa::RadioRX
virtual void execGetCommand (CommandPtr cmd) final
 Parse an incoming GET command and dispatch.
virtual void execSetCommand (CommandPtr cmd) final
 Parse an incoming SET command and dispatch.
virtual void execRepCommand (CommandPtr cmd) final
 Parse an incoming REPort command and dispatch.
double getTime ()
 get the number of seconds since the "Epoch"
virtual void subscribeToMailBoxes (const std::vector< MailBoxBasePtr > &mailboxes) final
 SoDa Threads must subscribe to at least the control mailbox.
Protected Member Functions inherited from SoDa::Thread
 Thread (const std::string &oname, const std::string &version=std::string("12.2.0"))
 make the thread object.
Protected Member Functions inherited from SoDa::Debug
std::string curDateTime ()

Private Member Functions

void doMixer (std::vector< std::complex< float > > &buf)

Private Attributes

iio_context * ctx
iio_device * dev
 cf-ad9361-lpc
iio_channel * rx_i_chan
 voltage0 (input) — I component
iio_channel * rx_q_chan
 voltage1 (input) — Q component
iio_buffer * rxbuf
unsigned int hw_buf_size
 IIO buffer size in samples (at 2.5 MSPS)
unsigned int rs_out_size
 hw_resampler output size (at 625 kSPS)
unsigned int rf_buf_size
 publish chunk size for BaseBandRX (30000)
double rx_sample_rate
 625 kSPS — used for IF NCO phase increment
bool streaming
 true after startStream(); samples published
bool if_streaming_enabled
 true → push raw RF copies to if_stream
SoDa::ReSamplerPtr hw_resampler
 2.5 MSPS → 625 kSPS
std::vector< std::complex< float > > hw_cf
 SC16→float conversion (hw_buf_size)
std::vector< std::complex< float > > rs_out
 resampler output (rs_out_size)
std::vector< std::complex< float > > accu
 accumulator for 30000-sample publish
QuadratureOscillator IF_osc
std::weak_ptr< PlutoRXself

Additional Inherited Members

Static Public Attributes inherited from SoDa::Debug
static std::mutex debug_msg_mutex
Protected Attributes inherited from SoDa::RadioRX
ParamsPtr params
CDatMBoxPtr rx_stream
CDatMBoxPtr if_stream
CmdMBoxPtr cmd_stream
CmdMBox::Subscription cmd_subs
double current_IF_tuning
 current IF NCO frequency
Protected Attributes inherited from SoDa::Thread
std::weak_ptr< Threadself
 A pointer to ourself.
Protected Attributes inherited from SoDa::Debug
std::string unit_name
 the name of the unit reporting status
unsigned int debug_level
 the debug level (threshold) for messages
Static Protected Attributes inherited from SoDa::Debug
static unsigned int default_debug_level
static unsigned int global_debug_level

Detailed Description

Definition at line 66 of file PlutoRX.hxx.

Constructor & Destructor Documentation

◆ PlutoRX()

SoDa::PlutoRX::PlutoRX ( ParamsPtr params)
protected

References SoDa::RadioRX::params.

Referenced by make().

◆ ~PlutoRX()

SoDa::PlutoRX::~PlutoRX ( )

Member Function Documentation

◆ doMixer()

void SoDa::PlutoRX::doMixer ( std::vector< std::complex< float > > & buf)
private

◆ downConvert()

bool SoDa::PlutoRX::downConvert ( )
overridevirtual

Refill the IIO buffer (2.5 MSPS), resample to 625 kSPS, mix, and publish 30000-sample CBufs to rx_stream.

Blocks for approximately one hardware buffer period (~48 ms).

Implements SoDa::RadioRX.

◆ enableIFStreamer()

void SoDa::PlutoRX::enableIFStreamer ( bool enable)
overridevirtual

Control whether raw RF samples are forwarded to the IF stream.

Implements SoDa::RadioRX.

◆ make()

PlutoRXPtr SoDa::PlutoRX::make ( ParamsPtr params)
inlinestatic

Definition at line 73 of file PlutoRX.hxx.

References PlutoRX(), and SoDa::RadioRX::params.

◆ setNCOFreq()

void SoDa::PlutoRX::setNCOFreq ( double freq)
overridevirtual

Update the IF NCO frequency used by the complex mixer.

Called in response to SET RX_IF_FREQ from RadioControl.

Implements SoDa::RadioRX.

◆ startStream()

void SoDa::PlutoRX::startStream ( )
overridevirtual

Arm the streaming flag so downConvert() publishes samples.

Implements SoDa::RadioRX.

◆ stopStream()

void SoDa::PlutoRX::stopStream ( )
overridevirtual

Disarm the streaming flag; IIO DMA continues draining silently.

Implements SoDa::RadioRX.

◆ streamEnabled()

bool SoDa::PlutoRX::streamEnabled ( )
overridevirtual

test the processing stream flag

Returns
true if rx data should be down converted

Implements SoDa::RadioRX.

Member Data Documentation

◆ accu

std::vector<std::complex<float> > SoDa::PlutoRX::accu
private

accumulator for 30000-sample publish

Definition at line 127 of file PlutoRX.hxx.

◆ ctx

iio_context* SoDa::PlutoRX::ctx
private

Definition at line 108 of file PlutoRX.hxx.

◆ dev

iio_device* SoDa::PlutoRX::dev
private

cf-ad9361-lpc

Definition at line 109 of file PlutoRX.hxx.

◆ hw_buf_size

unsigned int SoDa::PlutoRX::hw_buf_size
private

IIO buffer size in samples (at 2.5 MSPS)

Definition at line 114 of file PlutoRX.hxx.

◆ hw_cf

std::vector<std::complex<float> > SoDa::PlutoRX::hw_cf
private

SC16→float conversion (hw_buf_size)

Definition at line 125 of file PlutoRX.hxx.

◆ hw_resampler

SoDa::ReSamplerPtr SoDa::PlutoRX::hw_resampler
private

2.5 MSPS → 625 kSPS

Definition at line 123 of file PlutoRX.hxx.

◆ IF_osc

QuadratureOscillator SoDa::PlutoRX::IF_osc
private

Definition at line 129 of file PlutoRX.hxx.

◆ if_streaming_enabled

bool SoDa::PlutoRX::if_streaming_enabled
private

true → push raw RF copies to if_stream

Definition at line 121 of file PlutoRX.hxx.

◆ rf_buf_size

unsigned int SoDa::PlutoRX::rf_buf_size
private

publish chunk size for BaseBandRX (30000)

Definition at line 116 of file PlutoRX.hxx.

◆ rs_out

std::vector<std::complex<float> > SoDa::PlutoRX::rs_out
private

resampler output (rs_out_size)

Definition at line 126 of file PlutoRX.hxx.

◆ rs_out_size

unsigned int SoDa::PlutoRX::rs_out_size
private

hw_resampler output size (at 625 kSPS)

Definition at line 115 of file PlutoRX.hxx.

◆ rx_i_chan

iio_channel* SoDa::PlutoRX::rx_i_chan
private

voltage0 (input) — I component

Definition at line 110 of file PlutoRX.hxx.

◆ rx_q_chan

iio_channel* SoDa::PlutoRX::rx_q_chan
private

voltage1 (input) — Q component

Definition at line 111 of file PlutoRX.hxx.

◆ rx_sample_rate

double SoDa::PlutoRX::rx_sample_rate
private

625 kSPS — used for IF NCO phase increment

Definition at line 118 of file PlutoRX.hxx.

◆ rxbuf

iio_buffer* SoDa::PlutoRX::rxbuf
private

Definition at line 112 of file PlutoRX.hxx.

◆ self

std::weak_ptr<PlutoRX> SoDa::PlutoRX::self
private

Definition at line 131 of file PlutoRX.hxx.

◆ streaming

bool SoDa::PlutoRX::streaming
private

true after startStream(); samples published

Definition at line 120 of file PlutoRX.hxx.


The documentation for this class was generated from the following file: