mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-12 11:10:33 +00:00
Fix formatting
This commit is contained in:
parent
e4f807e210
commit
a19d260281
@ -13,6 +13,7 @@
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
#include "ad936x_iio_custom.h"
|
||||
#include "display.h"
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <chrono>
|
||||
@ -22,7 +23,6 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "display.h"
|
||||
|
||||
#if USE_GLOG_AND_GFLAGS
|
||||
#include <glog/logging.h>
|
||||
@ -45,6 +45,7 @@ ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_)
|
||||
n_channels = 0;
|
||||
}
|
||||
|
||||
|
||||
ad936x_iio_custom::~ad936x_iio_custom()
|
||||
{
|
||||
// disable TX
|
||||
@ -60,11 +61,13 @@ void ad936x_iio_custom::set_gnsstime_queue(std::shared_ptr<Concurrent_Queue<Gnss
|
||||
GnssTime_queue = std::move(queue);
|
||||
}
|
||||
|
||||
|
||||
void ad936x_iio_custom::set_pps_samplestamp_queue(std::shared_ptr<Concurrent_Queue<PpsSamplestamp>> queue)
|
||||
{
|
||||
Pps_queue = std::move(queue);
|
||||
}
|
||||
|
||||
|
||||
bool ad936x_iio_custom::initialize_device(std::string pluto_device_uri, std::string board_type)
|
||||
{
|
||||
// Find devices
|
||||
@ -126,7 +129,6 @@ bool ad936x_iio_custom::initialize_device(std::string pluto_device_uri, std::str
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
phy = iio_context_find_device(ctx, "ad9361-phy");
|
||||
|
||||
if (phy == NULL)
|
||||
@ -329,7 +331,6 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_,
|
||||
configure_params(dds_dev, params_dds);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -346,6 +347,7 @@ bool ad936x_iio_custom::check_device()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m, std::string &value)
|
||||
{
|
||||
struct iio_channel *chn = 0;
|
||||
@ -387,6 +389,7 @@ bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ad936x_iio_custom::read_die_temp(double &temp_c)
|
||||
{
|
||||
std::string temp_mC_str;
|
||||
@ -411,6 +414,8 @@ bool ad936x_iio_custom::read_die_temp(double &temp_c)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_,
|
||||
long long sample_rate_,
|
||||
long long freq_,
|
||||
@ -426,7 +431,6 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_,
|
||||
double lo_attenuation_db_,
|
||||
bool high_side_lo_,
|
||||
int tx_lo_channel_)
|
||||
|
||||
{
|
||||
if (check_device() == false) return false;
|
||||
|
||||
@ -611,14 +615,12 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_,
|
||||
std::cerr << "Warning: rf_port_select write returned: " << ret << "\n";
|
||||
no_errors = false;
|
||||
}
|
||||
|
||||
// ret = iio_channel_attr_write_longlong(phy_ch, "rf_bandwidth", bandwidth_);
|
||||
// if (ret < 0)
|
||||
// {
|
||||
// std::cerr << "Warning: rf_bandwidth write returned: " << ret << "\n";
|
||||
// no_errors = false;
|
||||
// }
|
||||
|
||||
long long set_rf_bw;
|
||||
ret = iio_channel_attr_read_longlong(phy_ch, "rf_bandwidth", &set_rf_bw);
|
||||
if (ret < 0)
|
||||
@ -631,7 +633,6 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_,
|
||||
std::cerr << "Info: rf_bandwidth read returned: " << set_rf_bw << " Hz \n";
|
||||
}
|
||||
|
||||
|
||||
if (setRXGain(0, gain_mode_rx0_, rf_gain_rx0_) == false)
|
||||
{
|
||||
std::cerr << "Info: setRXGain read returned false \n";
|
||||
@ -663,14 +664,12 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_,
|
||||
std::cerr << "Warning: rf_port_select write returned: " << ret << "\n";
|
||||
no_errors = false;
|
||||
}
|
||||
|
||||
// ret = iio_channel_attr_write_longlong(phy_ch, "rf_bandwidth", bandwidth_);
|
||||
// if (ret < 0)
|
||||
// {
|
||||
// std::cerr << "Warning: rf_bandwidth write returned: " << ret << "\n";
|
||||
// no_errors = false;
|
||||
// }
|
||||
|
||||
long long set_rf_bw;
|
||||
ret = iio_channel_attr_read_longlong(phy_ch, "rf_bandwidth", &set_rf_bw);
|
||||
if (ret < 0)
|
||||
@ -703,6 +702,7 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_,
|
||||
return no_errors;
|
||||
}
|
||||
|
||||
|
||||
bool ad936x_iio_custom::set_rx_frequency(long long freq_hz)
|
||||
{
|
||||
if (check_device() == false) return false;
|
||||
@ -748,6 +748,7 @@ bool ad936x_iio_custom::get_rx_frequency(long long &freq_hz)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain_dB)
|
||||
{
|
||||
if (check_device() == false) return false;
|
||||
@ -780,6 +781,7 @@ bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double ad936x_iio_custom::get_rx_gain(int ch_num)
|
||||
{
|
||||
if (check_device() == false) return -1;
|
||||
@ -818,6 +820,7 @@ bool ad936x_iio_custom::calibrate([[maybe_unused]] int ch, [[maybe_unused]] doub
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ad936x_iio_custom::monitor_thread_fn()
|
||||
{
|
||||
uint32_t val;
|
||||
@ -850,7 +853,7 @@ void ad936x_iio_custom::monitor_thread_fn()
|
||||
// } else {
|
||||
if (val & 4)
|
||||
{
|
||||
std::cout
|
||||
std::cout
|
||||
<< TEXT_BOLD_RED
|
||||
<< "WARNING: IIO status register reported overflow!\n";
|
||||
LOG(WARNING) << "WARNING: IIO status register reported overflow!";
|
||||
@ -869,6 +872,7 @@ void ad936x_iio_custom::monitor_thread_fn()
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void ad936x_iio_custom::stop_record()
|
||||
{
|
||||
receive_samples = false;
|
||||
@ -917,6 +921,7 @@ void ad936x_iio_custom::PlutoTxEnable(bool txon)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ad936x_iio_custom::setPlutoGpo(int p)
|
||||
{
|
||||
char pins[11];
|
||||
@ -955,7 +960,6 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter)
|
||||
// 1 Enable
|
||||
// X Enable Mask if Identifier=0xF
|
||||
|
||||
|
||||
if (check_device() == false) return false;
|
||||
// int plutoGpo = 0;
|
||||
int ret;
|
||||
@ -1008,6 +1012,8 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ad936x_iio_custom::get_PPS_timestamp()
|
||||
{
|
||||
GnssTime tow;
|
||||
@ -1044,7 +1050,6 @@ void ad936x_iio_custom::get_PPS_timestamp()
|
||||
// record pps rise samplestamp associated to the absolute sample counter
|
||||
// PPS rising edge must be associated with the corresponding uBlox time message (tx once a second)
|
||||
|
||||
|
||||
if (GnssTime_queue->timed_wait_and_pop(tow, 2000) == false)
|
||||
{
|
||||
if (receive_samples == true)
|
||||
@ -1075,6 +1080,8 @@ void ad936x_iio_custom::get_PPS_timestamp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ad936x_iio_custom::start_sample_rx(bool ppsmode)
|
||||
{
|
||||
// using queues of smart pointers to preallocated buffers
|
||||
@ -1120,9 +1127,7 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode)
|
||||
// start sample overflow detector
|
||||
overflow_monitor_thread = std::thread(&ad936x_iio_custom::monitor_thread_fn, this);
|
||||
|
||||
|
||||
// start PPS and GNSS Time capture thread
|
||||
|
||||
if (ppsmode == true)
|
||||
{
|
||||
capture_time_thread = std::thread(&ad936x_iio_custom::get_PPS_timestamp, this);
|
||||
@ -1130,16 +1135,19 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ad936x_iio_custom::pop_sample_buffer(std::shared_ptr<ad936x_iio_samples> ¤t_buffer)
|
||||
{
|
||||
used_buffers.wait_and_pop(current_buffer);
|
||||
}
|
||||
|
||||
|
||||
void ad936x_iio_custom::push_sample_buffer(std::shared_ptr<ad936x_iio_samples> ¤t_buffer)
|
||||
{
|
||||
free_buffers.push(current_buffer);
|
||||
}
|
||||
|
||||
|
||||
void ad936x_iio_custom::capture(const std::vector<std::string> &channels)
|
||||
{
|
||||
if (check_device() == false) return;
|
||||
|
Loading…
Reference in New Issue
Block a user