From f898f665950150d187eebd295c5bd77b49bc627b Mon Sep 17 00:00:00 2001
From: Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
Date: Tue, 4 Aug 2015 09:40:31 +0200
Subject: Simplify adc_resolution to bits conversion

---
 uca-ufo-camera.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

(limited to 'uca-ufo-camera.c')

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;
 }
-- 
cgit v1.2.3