18 lines
468 B
Python
18 lines
468 B
Python
|
from hackrf import *
|
||
|
|
||
|
def open_hackrf(num):
|
||
|
# Opens the desired number of HackRFs
|
||
|
|
||
|
hackrf = [None] * int(num) #Declare empty list
|
||
|
for i in range(int(num)):
|
||
|
print()
|
||
|
try:
|
||
|
hackrf[i] = HackRF(device_index = i)
|
||
|
except Exception as e:
|
||
|
print(e)
|
||
|
print(f"Error opening device: {i}")
|
||
|
hackrf = hackrf[:-1] # Decrease list size
|
||
|
else:
|
||
|
print(f"device {i} opened")
|
||
|
print(hackrf[i].get_serial_no())
|
||
|
return(hackrf) #return list of opened HackRFs
|