Permalink
Browse files

Update rtlsdr/rtlsdr.py

Added get and set for frequency correction.
  • Loading branch information...
superkuh committed Sep 2, 2012
1 parent 8ed885d commit ffba3611cf0071dee7e1efec5c1a582e1e344c61
Showing with 23 additions and 0 deletions.
  1. +23 −0 rtlsdr/rtlsdr.py
View
@@ -104,6 +104,29 @@ def get_center_freq(self):
return center_freq
def set_freq_correction(self, err_ppm):
''' Set frequency offset of tuner (in PPM). '''
freq = int(err_ppm)
result = librtlsdr.rtlsdr_set_freq_correction(self.dev_p, err_ppm)
if result < 0:
self.close()
raise IOError('Error code %d when setting freq. offset to %d ppm'\
% (result, err_ppm))
return
def get_freq_correction(self):
''' Get frequency offset of tuner (in PPM). '''
result = librtlsdr.rtlsdr_get_freq_correction(self.dev_p)
if result < 0:
self.close()
raise IOError('Error code %d when getting freq. offset in ppm.'\
% (result))
return
def set_sample_rate(self, rate):
''' Set sample rate of tuner (in Hz).
Use get_sample_rate() to see the precise sample rate used. '''

0 comments on commit ffba361

Please sign in to comment.