The following steps have to be taken in order to create a custom wrapper library. See also flink-eeros or comedi-eeros.
find_package(EEROS REQUIRED) include_directories(${EEROS_INCLUDE_DIR}) link_directories(${EEROS_LIB_DIR})
find_package()
to search for the library: find_package(flink REQUIRED) include_directories(${FLINK_INCLUDE_DIR}) link_directories(${FLINK_LIB_DIR})
If you have no CMake Package you have to search for an installed header file or add it as additional include and library directory.
find_path(COMEDI_INCLUDE_DIR NAMES comedi.h comedilib.h) if(COMEDI_INCLUDE_DIR) include_directories(${COMEDI_INCLUDE_DIR}) endif() find_library(COMEDI_LIBRARY comedi) if(COMEDI_LIBRARY) message(STATUS "-> libcomedi available") set(COMEDI_LIBRARY_DIR ${COMEDI_LIBRARY_DIR} comedi) endif()
/includes/eeros/hal
. This allows you to access the member functions of the derived classes when they are loaded dynamically over the configuration file.set()
and get()
functions have to access the hardware library and write or read from hardware according to their functionality.scale
and offset
(member variables of ScalableIn- and ScalableOutput) have to be taken into account. Calculate the effective output value set to the hardware with these values. Check AnalogOut of comedi-eeros for an example. Scale and offset describe the scaling factors of the connected hardware. So you have to divide the output value by scale.createType
, which will be called dynamically from EEROS for every supported type. This function has to create an object of the corresponding type and returns a pointer to it.open
, close
, …). Create a factory for the device. On every creation of a channel there will be an access to getDevice()
and you have to make sure that the device is opened only once.