rtl_tcp: implement frequency correction control

This commit is contained in:
Dimitri Stolnikov 2012-05-07 23:02:36 +02:00
parent e38dc2f427
commit 9b9c5bfcf4
4 changed files with 14 additions and 2 deletions

View File

@ -51,6 +51,7 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) :
_freq = 0; _freq = 0;
_rate = 0; _rate = 0;
_gain = 0; _gain = 0;
_corr = 0;
_auto_gain = false; _auto_gain = false;
dict_t dict = params_to_dict(args); dict_t dict = params_to_dict(args);
@ -162,12 +163,16 @@ double rtl_tcp_source_c::get_center_freq( size_t chan )
double rtl_tcp_source_c::set_freq_corr( double ppm, size_t chan ) double rtl_tcp_source_c::set_freq_corr( double ppm, size_t chan )
{ {
_src->set_freq_corr( int(ppm) );
_corr = ppm;
return get_freq_corr( chan ); return get_freq_corr( chan );
} }
double rtl_tcp_source_c::get_freq_corr( size_t chan ) double rtl_tcp_source_c::get_freq_corr( size_t chan )
{ {
return 0; return _corr;
} }
std::vector<std::string> rtl_tcp_source_c::get_gain_names( size_t chan ) std::vector<std::string> rtl_tcp_source_c::get_gain_names( size_t chan )

View File

@ -75,7 +75,7 @@ public:
std::string get_antenna( size_t chan = 0 ); std::string get_antenna( size_t chan = 0 );
private: private:
double _freq, _rate, _gain; double _freq, _rate, _gain, _corr;
bool _auto_gain; bool _auto_gain;
rtl_tcp_source_f_sptr _src; rtl_tcp_source_f_sptr _src;
}; };

View File

@ -267,3 +267,9 @@ void rtl_tcp_source_f::set_gain(int gain)
struct command cmd = { 0x04, gain }; struct command cmd = { 0x04, gain };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0); send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
} }
void rtl_tcp_source_f::set_freq_corr(int ppm)
{
struct command cmd = { 0x05, ppm };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}

View File

@ -94,6 +94,7 @@ private:
void set_sample_rate(int sample_rate); void set_sample_rate(int sample_rate);
void set_gain_mode(int manual); void set_gain_mode(int manual);
void set_gain(int gain); void set_gain(int gain);
void set_freq_corr(int ppm);
}; };