diff options
author | Arturs Artamonovs <dos21h@gmail.com> | 2023-03-22 22:55:37 +0000 |
---|---|---|
committer | Arturs Artamonovs <dos21h@gmail.com> | 2023-03-22 22:55:37 +0000 |
commit | e74679711bb9051080e7f11e16fe474fb6b56e60 (patch) | |
tree | bc64b1027e1c38e01334a5523d4a71ef291b8ea1 /airspyhf/airspyhf.py | |
parent | 9c7aa6dc844b92c93734fd62bb0cde561998012a (diff) | |
download | pyairspyhf-e74679711bb9051080e7f11e16fe474fb6b56e60.tar.gz pyairspyhf-e74679711bb9051080e7f11e16fe474fb6b56e60.zip |
airspyhf_waterfall shows first signs of working
Diffstat (limited to 'airspyhf/airspyhf.py')
-rw-r--r-- | airspyhf/airspyhf.py | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/airspyhf/airspyhf.py b/airspyhf/airspyhf.py index 562d8e5..5a26fa3 100644 --- a/airspyhf/airspyhf.py +++ b/airspyhf/airspyhf.py @@ -5,6 +5,7 @@ class AirSpyHF: dev_p = airspyhf_device_t_p(None) sample_rates = [] initalized = False + cur_freq = 0 def __init__(self,): #self.dev_p = airspyhf_device_t_p(None) pass @@ -54,6 +55,7 @@ class AirSpyHF: def set_samplerate(self, samplerate:int): if not self.initalized: + print("airspy not initalized") return -1 if self.sample_rates == []: self.get_samplerates() @@ -70,42 +72,66 @@ class AirSpyHF: def set_hf_agc(self,flag): if not self.initalized: + print("airspy not initalized") return -1 ret = libairspyhf.airspyhf_set_hf_agc(self.dev_p, flag) return ret def set_hf_agc_threshold(self,flag): if not self.initalized: + print("airspy not initalized") return -1 ret = libairspyhf.airspyhf_set_hf_agc_threshold(self.dev_p, flag) return ret def set_hf_att(self, value): if not self.initalized: + print("airspy not initalized") return -1 ret = libairspyhf.airspyhf_set_hf_att(self.dev_p, value) return ret def set_hf_lna(self,flag): if not self.initalized: + print("airspy not initalized") return -1 ret = libairspyhf.airspyhf_set_hf_lna(self.dev_p, flag) return ret - def start(self, read_samples): + def set_frequency(self,freq:int): if not self.initalized: + print("airspy not initalized") return -1 - ret = libairspyhf.airspyhf_start(self.dev_p, airspyhf_sample_block_cb_fn(read_samples), None) + ret = libairspyhf.airspyhf_set_freq(self.dev_p, int(freq)) + if ret != 0: + return -1 + self.cur_freq = int(freq) + return 0 + + #def get_frequency(self,freq:int): + # return self.cur_freq + + def start(self, read_samples_cb): + if not self.initalized: + print("airspy not initalized") + return -1 + #read_samples() + #ret = libairspyhf.airspyhf_start(self.dev_p, airspyhf_sample_block_cb_fn(read_samples), None) + ret = libairspyhf.airspyhf_start(self.dev_p, read_samples_cb, None) if ret != 0: print(f"airspyhf_start ret={ret}") + return -1 + return 0 def is_streaming(self): if not self.initalized: + print("airspy not initalized") return -1 return libairspyhf.airspyhf_is_streaming(self.dev_p) def stop(self): if not self.initalized: + print("airspy not initalized") return -1 ret = libairspyhf.airspyhf_stop(self.dev_p) if ret != 0: @@ -115,6 +141,7 @@ class AirSpyHF: def close(self): if not self.initalized: + print("airspy not initalized") return -1 ret = libairspyhf.close(self.dev_p) if ret != 0: |