pothosware / SoapyBladeRF

Soapy SDR plugin for the Blade RF
https://github.com/pothosware/SoapyBladeRF/wiki
23 stars 20 forks source link

Use the full range for the CS16 data type #32

Closed fsphil closed 4 years ago

fsphil commented 5 years ago

The driver currently expects samples in the bladerf's native range of -2048-2047 when using the CS16 data type. This patch fixes this by adding a simple bit shift on RX and TX.

I'm only able to test the changes in writeStream() at the moment (with hacktv), I've no handy way of testing readStream().

guruofquality commented 5 years ago

fullScale in the getNatveStream format would also have to change to match

fsphil commented 5 years ago

The docs suggest that the value returned by getNativeStreamFormat does not apply when using read/writeStream():

"This is the format used by the underlying transport layer, and the direct buffer access API calls (when available).".

So CS16 / 2048 is still valid in this case. I may have misunderstood.

guruofquality commented 5 years ago

For example, soapyremote will use the native stream format to transport the samples over the network, and use the scaleFactor when scaling if the user requested floats; so this scale factor informs the caller how to scale the data.

fsphil commented 5 years ago

OK, change made. I see there is a CS12 type, it might be good to implement that here.