Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse file

Update rtlsdr/rtlsdr.py

Added get and set for frequency correction.
  • Loading branch information...
commit ffba3611cf0071dee7e1efec5c1a582e1e344c61 1 parent 8ed885d
superkuh authored
Showing with 23 additions and 0 deletions.
  1. +23 0 rtlsdr/rtlsdr.py
23 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. '''
Please sign in to comment.
Something went wrong with that request. Please try again.