Adding missing files from previous commit
This commit is contained in:
parent
d7d7aea15b
commit
cbab8e1814
@ -15,14 +15,9 @@ import numpy as np
|
||||
import filters
|
||||
import argparse
|
||||
import prefixed
|
||||
from formats import TYPES
|
||||
|
||||
|
||||
TYPES = {
|
||||
'CU8': np.uint8,
|
||||
'CS16': np.int16,
|
||||
'CF32': np.float32,
|
||||
}
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-v', '--verbose', help='Print additional informational output', action='store_true')
|
||||
parser.add_argument('-f', '--format', choices=list(TYPES.keys()), help='Input sample format', required=True)
|
||||
|
||||
18
formats.py
Normal file
18
formats.py
Normal file
@ -0,0 +1,18 @@
|
||||
import numpy as np
|
||||
from SoapySDR import SOAPY_SDR_CS16, SOAPY_SDR_CF32
|
||||
|
||||
FORMATS = {
|
||||
'CS16': SOAPY_SDR_CS16,
|
||||
'CF32': SOAPY_SDR_CF32,
|
||||
}
|
||||
|
||||
PACKINGS = {
|
||||
'CS16': '=%dh',
|
||||
'CF32': '=%df',
|
||||
}
|
||||
|
||||
TYPES = {
|
||||
'CU8': np.uint8,
|
||||
'CS16': np.int16,
|
||||
'CF32': np.float32,
|
||||
}
|
||||
@ -8,6 +8,7 @@ import argparse
|
||||
import prefixed
|
||||
from pprint import pprint
|
||||
from colorama import Fore, Style
|
||||
from formats import FORMATS, PACKINGS, TYPES
|
||||
|
||||
|
||||
FREQUENCY = 105500000
|
||||
@ -16,21 +17,6 @@ SAMPLE_RATE = 1000000
|
||||
SAMPLE_COUNT = 0
|
||||
BLOCK_SIZE = 16384
|
||||
|
||||
FORMATS = {
|
||||
'CS16': soapy.SOAPY_SDR_CS16,
|
||||
'CF32': soapy.SOAPY_SDR_CF32,
|
||||
}
|
||||
|
||||
PACKINGS = {
|
||||
soapy.SOAPY_SDR_CS16: '=%dh',
|
||||
soapy.SOAPY_SDR_CF32: '=%df',
|
||||
}
|
||||
|
||||
TYPES = {
|
||||
soapy.SOAPY_SDR_CS16: np.int16,
|
||||
soapy.SOAPY_SDR_CF32: np.float32,
|
||||
}
|
||||
|
||||
|
||||
def get_capabilities(device):
|
||||
def get_direction_capabilities(direction):
|
||||
@ -125,7 +111,6 @@ if args.d:
|
||||
format = args.format
|
||||
if format is None:
|
||||
format = sdr.getStreamFormats(soapy.SOAPY_SDR_RX, 0)[0]
|
||||
format = FORMATS[format]
|
||||
|
||||
if args.verbose:
|
||||
print(f"Frequency: {frequency} Hz", file=sys.stderr)
|
||||
@ -146,7 +131,7 @@ if args.d:
|
||||
#setup a stream
|
||||
samples = 1000
|
||||
buffer = np.array([0] * samples * 2, TYPES[format])
|
||||
stream = sdr.setupStream(soapy.SOAPY_SDR_RX, format)
|
||||
stream = sdr.setupStream(soapy.SOAPY_SDR_RX, FORMATS[format])
|
||||
sdr.activateStream(stream)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user