summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Daniel <cd@maintech.de>2013-02-07 19:36:29 +0100
committerChristian Daniel <cd@maintech.de>2013-02-07 19:36:29 +0100
commit5ee4d33c02239f4b46dabe2dd1ba1e252d49f3c3 (patch)
tree38fc4d4c0b54c66023c4c06d8d41ff24dd2c5b8b
parentc0383b32a3c54ab233399a5d858a5b1eb7c0eece (diff)
libosmosdr: add call to configure E4K DC offset
-rw-r--r--software/libosmosdr/include/osmosdr.h2
-rw-r--r--software/libosmosdr/src/libosmosdr.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/software/libosmosdr/include/osmosdr.h b/software/libosmosdr/include/osmosdr.h
index 7246a78..11f2fff 100644
--- a/software/libosmosdr/include/osmosdr.h
+++ b/software/libosmosdr/include/osmosdr.h
@@ -139,6 +139,8 @@ OSMOSDR_API int osmosdr_set_tuner_mixer_gain(osmosdr_dev_t *dev, int gain);
OSMOSDR_API int osmosdr_set_tuner_mixer_enh(osmosdr_dev_t *dev, int enh);
/* set IF stages gain */
OSMOSDR_API int osmosdr_set_tuner_if_gain(osmosdr_dev_t *dev, int stage, int gain);
+/* set DC offset registers */
+OSMOSDR_API int osmosdr_set_tuner_dc_offset(osmosdr_dev_t *dev, int iofs, int qofs);
/*!
* Get a list of sample rates supported by the device.
diff --git a/software/libosmosdr/src/libosmosdr.c b/software/libosmosdr/src/libosmosdr.c
index afa21d2..f08ec40 100644
--- a/software/libosmosdr/src/libosmosdr.c
+++ b/software/libosmosdr/src/libosmosdr.c
@@ -419,6 +419,19 @@ int osmosdr_set_tuner_if_gain(osmosdr_dev_t *dev, int stage, int gain)
buffer, sizeof(buffer), CTRL_TIMEOUT);
}
+int osmosdr_set_tuner_dc_offset(osmosdr_dev_t *dev, int iofs, int qofs)
+{
+ osmosdr_dev_t* devt = (osmosdr_dev_t*)dev;
+ uint8_t buffer[2];
+
+ buffer[0] = iofs;
+ buffer[1] = qofs;
+
+ return libusb_control_transfer(devt->devh, CTRL_OUT, 0x07,
+ FUNC(3, 0x08), 0,
+ buffer, sizeof(buffer), CTRL_TIMEOUT);
+}
+
/* two raised to the power of n */
#define TWO_POW(n) (1ULL<<(n))