summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-07-31 14:21:53 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-07-31 14:21:53 +0200
commitb8928cbea8e44c0eb10b6dcc97172f338e76cc79 (patch)
tree74afaf7b663527c952bd33576f39fe7c887e64f0
parent84b10f0787095565e095d00501ecde1323ba72ed (diff)
downloaduca-ufo-b8928cbea8e44c0eb10b6dcc97172f338e76cc79.tar.gz
uca-ufo-b8928cbea8e44c0eb10b6dcc97172f338e76cc79.tar.bz2
uca-ufo-b8928cbea8e44c0eb10b6dcc97172f338e76cc79.tar.xz
uca-ufo-b8928cbea8e44c0eb10b6dcc97172f338e76cc79.zip
Make sensor width configurable
-rw-r--r--CMakeLists.txt14
-rw-r--r--uca-ufo-camera.c9
2 files changed, 15 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc840a3..20539a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,3 @@
-# --- Common ------------------------------------------------------------------
-
cmake_minimum_required(VERSION 2.6)
project(ucapco C)
@@ -17,12 +15,20 @@ pkg_check_modules(PCITOOL pcitool>=0.2.0 REQUIRED)
pkg_check_variable(libuca plugindir)
-# --- Plugin specific ---------------------------------------------------------
+if (NOT DEFINED CMOSIS_SENSOR_WIDTH)
+ set(CMOSIS_SENSOR_WIDTH "2048")
+endif ()
+
+set(CMOSIS_SENSOR_WIDTH ${CMOSIS_SENSOR_WIDTH} CACHE STRING "Width of the sensor")
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/config.h)
include_directories(
${UCA_INCLUDE_DIRS}
${PCITOOL_INCLUDE_DIRS}
- ${GIO2_INCLUDE_DIRS})
+ ${GIO2_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR})
add_library(ucaufo SHARED uca-ufo-camera.c)
diff --git a/uca-ufo-camera.c b/uca-ufo-camera.c
index cb23589..7f9690f 100644
--- a/uca-ufo-camera.c
+++ b/uca-ufo-camera.c
@@ -15,6 +15,8 @@
with this library; if not, write to the Free Software Foundation, Inc., 51
Franklin St, Fifth Floor, Boston, MA 02110, USA */
+#include "config.h"
+
#include <gio/gio.h>
#include <gmodule.h>
#include <stdlib.h>
@@ -59,7 +61,6 @@ G_DEFINE_TYPE_WITH_CODE (UcaUfoCamera, uca_ufo_camera, UCA_TYPE_CAMERA,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
uca_ufo_camera_initable_iface_init))
-static const guint SENSOR_WIDTH = 2048;
static const gdouble EXPOSURE_TIME_SCALE = 2.69e6;
/**
@@ -378,7 +379,7 @@ uca_ufo_camera_grab(UcaCamera *camera, gpointer data, GError **error)
pcilib_event_info_t event_info;
int err;
- const gsize size = SENSOR_WIDTH * priv->height * sizeof(guint16);
+ const gsize size = CMOSIS_SENSOR_WIDTH * priv->height * sizeof(guint16);
err = pcilib_get_next_event (priv->handle, PCILIB_TIMEOUT_INFINITE, &event_id, sizeof(pcilib_event_info_t), &event_info);
PCILIB_SET_ERROR_RETURN_FALSE (err, UCA_UFO_CAMERA_ERROR_NEXT_EVENT);
@@ -528,7 +529,7 @@ uca_ufo_camera_get_property(GObject *object, guint property_id, GValue *value, G
switch (property_id) {
case PROP_SENSOR_WIDTH:
- g_value_set_uint (value, SENSOR_WIDTH);
+ g_value_set_uint (value, CMOSIS_SENSOR_WIDTH);
break;
case PROP_SENSOR_HEIGHT:
g_value_set_uint (value, priv->height);
@@ -588,7 +589,7 @@ uca_ufo_camera_get_property(GObject *object, guint property_id, GValue *value, G
g_value_set_uint (value, 0);
break;
case PROP_ROI_WIDTH:
- g_value_set_uint (value, SENSOR_WIDTH);
+ g_value_set_uint (value, CMOSIS_SENSOR_WIDTH);
break;
case PROP_ROI_HEIGHT:
g_value_set_uint (value, priv->height);