summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-08-04 09:40:31 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-08-04 09:40:31 +0200
commitf898f665950150d187eebd295c5bd77b49bc627b (patch)
tree6b98ab913456971892201f1e3e11ddee239d5487
parent4cb4c615e9f6ebd880a55a3c694e2920834f5536 (diff)
downloaduca-ufo-f898f665950150d187eebd295c5bd77b49bc627b.tar.gz
uca-ufo-f898f665950150d187eebd295c5bd77b49bc627b.tar.bz2
uca-ufo-f898f665950150d187eebd295c5bd77b49bc627b.tar.xz
uca-ufo-f898f665950150d187eebd295c5bd77b49bc627b.zip
Simplify adc_resolution to bits conversion
-rw-r--r--uca-ufo-camera.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/uca-ufo-camera.c b/uca-ufo-camera.c
index a9c2502..5aa6829 100644
--- a/uca-ufo-camera.c
+++ b/uca-ufo-camera.c
@@ -219,8 +219,6 @@ update_properties (UcaUfoCameraPrivate *priv)
static gboolean
setup_pcilib (UcaUfoCameraPrivate *priv)
{
- guint adc_resolution;
-
priv->handle = pcilib_open("/dev/fpga0", "ipecamera");
if (priv->handle == NULL) {
@@ -232,24 +230,12 @@ setup_pcilib (UcaUfoCameraPrivate *priv)
pcilib_set_logger (PCILIB_LOG_INFO, &error_handler, NULL);
- priv->property_table = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL, g_free);
+ priv->property_table = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
N_PROPERTIES = update_properties (priv);
+
priv->height = read_register_value (priv->handle, "cmosis_number_lines_single");
priv->frequency = read_register_value (priv->handle, "control") >> 31;
- adc_resolution = read_register_value (priv->handle, "adc_resolution");
-
- switch (adc_resolution) {
- case 0:
- priv->n_bits = 10;
- break;
- case 1:
- priv->n_bits = 11;
- break;
- case 2:
- priv->n_bits = 12;
- break;
- }
+ priv->n_bits = read_register_value (priv->handle, "adc_resolution") + 10;
return TRUE;
}