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

#include <PlutoTX.hxx>

Inheritance diagram for SoDa::PlutoTX:
SoDa::RadioTX SoDa::Thread SoDa::Base SoDa::Debug

Public Member Functions

 ~PlutoTX ()
void init () override
 Some initialization must occurr after all the components are created.
bool transmitSwitch (bool tx_on) override
 Arm or disarm the IIO TX stream.
bool put (CBufPtr buf) override
 Accumulate complex<float> samples; when a full resampler block is available, interpolate 4:1 and push to the Pluto DAC.
RadioTXPtr getSelfPtr () override
Public Member Functions inherited from SoDa::RadioTX
 RadioTX (ParamsPtr params, const std::string &name)
 Constructor for RF Transmit/modulator process.
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 PlutoTXPtr 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

 PlutoTX (ParamsPtr params)
Protected Member Functions inherited from SoDa::RadioTX
virtual void subExecCommand (CommandPtr cmd)
 Some hardware radio modules might want to watch or publish to the command mailbox.
virtual void subExecGetCommand (CommandPtr cmd)
virtual void subExecSetCommand (CommandPtr cmd)
virtual void subExecRepCommand (CommandPtr cmd)
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 pushToHW (const std::vector< std::complex< float > > &block)
void flushZeros ()
void ioThreadFn ()
void enqueue (std::vector< std::complex< float > > block)

Private Attributes

iio_context * ctx
iio_device * dev
iio_channel * tx_i_chan
iio_channel * tx_q_chan
iio_buffer * txbuf
unsigned int hw_buf_size
unsigned int rs_in_size
SoDa::ReSamplerPtr hw_resampler
std::vector< std::complex< float > > accu
 625 kSPS accumulator
std::vector< std::complex< float > > rs_in
 resampler input block
std::vector< std::complex< float > > hw_cf
 resampler output (2.5 MSPS)
std::weak_ptr< PlutoTXself
std::thread io_thread
std::mutex tx_mutex
std::condition_variable tx_cv
std::deque< std::vector< std::complex< float > > > tx_queue
bool io_running {false}

Static Private Attributes

static constexpr unsigned int N_KERNEL_BUFS = 5
static constexpr unsigned int MAX_SW_QUEUE = 16

Additional Inherited Members

Static Public Attributes inherited from SoDa::Debug
static std::mutex debug_msg_mutex
Protected Attributes inherited from SoDa::RadioTX
bool tx_enabled
 if true, we're transmitting.
CBufPtr zero_buf
 envelope for dead silence.
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 68 of file PlutoTX.hxx.

Constructor & Destructor Documentation

◆ PlutoTX()

SoDa::PlutoTX::PlutoTX ( ParamsPtr params)
protected

Referenced by make().

◆ ~PlutoTX()

SoDa::PlutoTX::~PlutoTX ( )

Member Function Documentation

◆ enqueue()

void SoDa::PlutoTX::enqueue ( std::vector< std::complex< float > > block)
private

◆ flushZeros()

void SoDa::PlutoTX::flushZeros ( )
private

◆ getSelfPtr()

RadioTXPtr SoDa::PlutoTX::getSelfPtr ( )
inlineoverridevirtual

Implements SoDa::RadioTX.

Definition at line 99 of file PlutoTX.hxx.

References self.

◆ init()

void SoDa::PlutoTX::init ( )
overridevirtual

Some initialization must occurr after all the components are created.

Units may optionally implement this method to do that.

Reimplemented from SoDa::RadioTX.

◆ ioThreadFn()

void SoDa::PlutoTX::ioThreadFn ( )
private

◆ make()

PlutoTXPtr SoDa::PlutoTX::make ( ParamsPtr params)
inlinestatic

Definition at line 75 of file PlutoTX.hxx.

References PlutoTX().

◆ pushToHW()

void SoDa::PlutoTX::pushToHW ( const std::vector< std::complex< float > > & block)
private

◆ put()

bool SoDa::PlutoTX::put ( CBufPtr buf)
overridevirtual

Accumulate complex<float> samples; when a full resampler block is available, interpolate 4:1 and push to the Pluto DAC.

Returns
true always.

Implements SoDa::RadioTX.

◆ transmitSwitch()

bool SoDa::PlutoTX::transmitSwitch ( bool tx_on)
overridevirtual

Arm or disarm the IIO TX stream.

transmitSwitch(false) flushes the accumulator with zeros so the DAC goes quiet cleanly.

Returns
the new tx_enabled state.

Implements SoDa::RadioTX.

Member Data Documentation

◆ accu

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

625 kSPS accumulator

Definition at line 125 of file PlutoTX.hxx.

◆ ctx

iio_context* SoDa::PlutoTX::ctx
private

Definition at line 114 of file PlutoTX.hxx.

◆ dev

iio_device* SoDa::PlutoTX::dev
private

Definition at line 115 of file PlutoTX.hxx.

◆ hw_buf_size

unsigned int SoDa::PlutoTX::hw_buf_size
private

Definition at line 120 of file PlutoTX.hxx.

◆ hw_cf

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

resampler output (2.5 MSPS)

Definition at line 127 of file PlutoTX.hxx.

◆ hw_resampler

SoDa::ReSamplerPtr SoDa::PlutoTX::hw_resampler
private

Definition at line 123 of file PlutoTX.hxx.

◆ io_running

bool SoDa::PlutoTX::io_running {false}
private

Definition at line 137 of file PlutoTX.hxx.

◆ io_thread

std::thread SoDa::PlutoTX::io_thread
private

Definition at line 133 of file PlutoTX.hxx.

◆ MAX_SW_QUEUE

unsigned int SoDa::PlutoTX::MAX_SW_QUEUE = 16
staticconstexprprivate

Definition at line 111 of file PlutoTX.hxx.

◆ N_KERNEL_BUFS

unsigned int SoDa::PlutoTX::N_KERNEL_BUFS = 5
staticconstexprprivate

Definition at line 109 of file PlutoTX.hxx.

◆ rs_in

std::vector<std::complex<float> > SoDa::PlutoTX::rs_in
private

resampler input block

Definition at line 126 of file PlutoTX.hxx.

◆ rs_in_size

unsigned int SoDa::PlutoTX::rs_in_size
private

Definition at line 121 of file PlutoTX.hxx.

◆ self

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

Definition at line 129 of file PlutoTX.hxx.

Referenced by getSelfPtr().

◆ tx_cv

std::condition_variable SoDa::PlutoTX::tx_cv
private

Definition at line 135 of file PlutoTX.hxx.

◆ tx_i_chan

iio_channel* SoDa::PlutoTX::tx_i_chan
private

Definition at line 116 of file PlutoTX.hxx.

◆ tx_mutex

std::mutex SoDa::PlutoTX::tx_mutex
private

Definition at line 134 of file PlutoTX.hxx.

◆ tx_q_chan

iio_channel* SoDa::PlutoTX::tx_q_chan
private

Definition at line 117 of file PlutoTX.hxx.

◆ tx_queue

std::deque<std::vector<std::complex<float> > > SoDa::PlutoTX::tx_queue
private

Definition at line 136 of file PlutoTX.hxx.

◆ txbuf

iio_buffer* SoDa::PlutoTX::txbuf
private

Definition at line 118 of file PlutoTX.hxx.


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