Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Pololu Tic Focuser into INDI drivers #883

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ option(WITH_PLAYERONE "Install Player One Astronomy's Camera Driver" On)
option(WITH_WEEWX_JSON "Install Weewx JSON Driver" On)
option(WITH_ROLLOFFINO "Install RollOff ino Dome Driver" On)
option(WITH_ASTROASIS "Install Astroasis Driver" On)
option(WITH_TICFOCUSER "Install Pololu TicFocuser Driver" On)

# FFMPEG required for INDI Webcam driver
find_package(FFmpeg)
Expand Down Expand Up @@ -768,6 +769,11 @@ SET(LIBRARIES_FOUND FALSE)
endif(ASTROASIS_FOUND)
endif(WITH_ASTROASIS)

# Pololu Tic Focuser
if (WITH_TICFOCUSER)
add_subdirectory(indi-ticfocuser)
endif(WITH_TICFOCUSER)

# Check if libraries are found. If not, we must build them, install them, THEN run CMake again to build and instal the drivers. If all the libraraies are installed, then we build and install the drivers only now.
if (LIBRARIES_FOUND)
message(STATUS "############################################################################")
Expand Down
55 changes: 55 additions & 0 deletions cmake_modules/FindGPIOD.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# - Try to find GPIOD
# Once done this will define
#
# GPIOD_FOUND - system has libgpiod
# GPIOD_INCLUDE_DIR - the libgpiod include directory
# GPIOD_LIBRARIES - Link these to use libgpiod
#
# N.B. This is for C++ only, you need to include
#
#include <gpiod.hpp>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

if (GPIOD_INCLUDE_DIR AND GPIOD_LIBRARIES)

# in cache already
set(GPIOD_FOUND TRUE)
message(STATUS "Found libgpiod: ${GPIOD_LIBRARIES}")

else (GPIOD_INCLUDE_DIR AND GPIOD_LIBRARIES)

find_path(GPIOD_INCLUDE_DIR gpiod.hpp
${_obIncDir}
${GNUWIN32_DIR}/include
/usr/local/include
)

find_library(GPIOD_LIBRARIES NAMES gpiodcxx
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
/usr/local/lib
)

if(GPIOD_INCLUDE_DIR AND GPIOD_LIBRARIES)
set(GPIOD_FOUND TRUE)
else (GPIOD_INCLUDE_DIR AND GPIOD_LIBRARIES)
set(GPIOD_FOUND FALSE)
endif(GPIOD_INCLUDE_DIR AND GPIOD_LIBRARIES)


if (GPIOD_FOUND)
if (NOT GPIOD_FIND_QUIETLY)
message(STATUS "Found GPIOD: ${GPIOD_LIBRARIES}")
endif (NOT GPIOD_FIND_QUIETLY)
else (GPIOD_FOUND)
if (GPIOD_FIND_REQUIRED)
message(FATAL_ERROR "libgpiod not found. Please install libgpiod-dev")
endif (GPIOD_FIND_REQUIRED)
endif (GPIOD_FOUND)

mark_as_advanced(GPIOD_INCLUDE_DIR GPIOD_LIBRARIES)

endif (GPIOD_INCLUDE_DIR AND GPIOD_LIBRARIES)
70 changes: 70 additions & 0 deletions cmake_modules/FindLIBBLUETOOTH.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# - Find libbluetooth
# Find the Bluez Linux Bluetooth library
#
# LIBBLUETOOTH_INCLUDE_DIR - where to find bluetooth.h etc.
# LIBBLUETOOTH_LIBRARIES - List of libraries when using libbluetooth.
# LIBBLUETOOTH_FOUND - True if libbluetooth was found.


# [License]
# The Ariba-Underlay Copyright
#
# Copyright (c) 2008-2012, Institute of Telematics, UniversitÀt Karlsruhe (TH)
#
# Institute of Telematics
# UniversitÀt Karlsruhe (TH)
# Zirkel 2, 76128 Karlsruhe
# Germany
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation
# are those of the authors and should not be interpreted as representing
# official policies, either expressed or implied, of the Institute of
# Telematics.
# [License]


# Look for the header files.
find_path(LIBBLUETOOTH_INCLUDE_DIR NAMES bluetooth/bluetooth.h)
mark_as_advanced(LIBBLUETOOTH_INCLUDE_DIR)


# Look for the library.
find_library(LIBBLUETOOTH_LIBRARY NAMES bluetooth
DOC "The path to the Bluez Linux Bluetooth library"
)
mark_as_advanced(LIBBLUETOOTH_LIBRARY)


# handle the QUIETLY and REQUIRED arguments and set LIBBLUETOOTH_FOUND to TRUE
# if all listed variables are TRUE
find_package(PackageHandleStandardArgs)
find_package_handle_standard_args(LibBluetooth DEFAULT_MSG
LIBBLUETOOTH_LIBRARY
LIBBLUETOOTH_INCLUDE_DIR
)

if(LIBBLUETOOTH_FOUND)
set(LIBBLUETOOTH_LIBRARIES "${LIBBLUETOOTH_LIBRARY}")
endif()
49 changes: 49 additions & 0 deletions cmake_modules/FindLIBTIC1.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# - Find LIBTIC1
# Find the Pololu Tic Library

pkg_check_modules(LIBTIC1 QUIET libpololu-tic-1)

find_path(LIBTIC1_INCLUDE_DIR
NAMES
tic.h
HINTS
${LIBTIC1_INCLUDE_DIRS}
PATH_SUFFIXES
libpololu-tic-1
)

find_library(LIBTIC1_LIBRARY
NAMES
${LIBTIC1_LIBRARIES}
libpololu-tic-1
HINTS
${LIBTIC1_LIBRARY_DIRS}
)

set(LIBTIC1_INCLUDE_DIRS ${LIBTIC1_INCLUDE_DIR})
set(LIBTIC1_LIBRARIES ${LIBTIC1_LIBRARY})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBTIC1
FOUND_VAR
LIBTIC1_FOUND
REQUIRED_VARS
LIBTIC1_LIBRARY
LIBTIC1_INCLUDE_DIR
VERSION_VAR
PC_LIBLIBTIC1_VERSION
)

set(LIBTIC1_INCLUDE_DIRS ${LIBTIC1_INCLUDE_DIR})
set(LIBTIC1_LIBRARIES ${LIBTIC1_LIBRARY})

mark_as_advanced(LIBTIC1_INCLUDE_DIRS LIBTIC1_LIBRARIES)

IF(LIBTIC1_FOUND)
include(CheckCXXSourceCompiles)
include(CMakePushCheckState)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${LIBTIC1_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${LIBTIC1_LIBRARIES})
cmake_pop_check_state()
ENDIF(LIBTIC1_FOUND)
3 changes: 3 additions & 0 deletions indi-ticfocuser/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Radek Kaczorek (rkaczorek AT gmail DOT com)
Helge Kutzop
Sebastian Baberowski (sebastian AT baberowski DOT com)
98 changes: 98 additions & 0 deletions indi-ticfocuser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
cmake_minimum_required(VERSION 3.16)

if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

PROJECT(TicFocuserNG CXX)

set (TICFOCUSER_VERSION_MAJOR 1)
set (TICFOCUSER_VERSION_MINOR 0)

LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/")
include(GNUInstallDirs)

set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
set(INDI_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/indi")
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")


set(INDI_TICFOCUSER-NG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/TicFocuser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/UsbConnectionBase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/SerialConnection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/driver_interfaces/TiclibInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/TicBase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/TicDefs.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/StreamSerial.cpp
)

add_executable(indi_ticfocuser-ng)

find_package(INDI REQUIRED)
target_link_libraries( indi_ticfocuser-ng indidriver)

include_directories( ${CMAKE_CURRENT_BINARY_DIR})
include_directories( ${CMAKE_CURRENT_SOURCE_DIR})

include_directories(
{CMAKE_CURRENT_BINARY_DIR}
${INDI_INCLUDE_DIR} )

find_package(USB1)
if (USB1_FOUND)

list(APPEND INDI_TICFOCUSER-NG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/connection/LibUsbConnection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/TicUsb.cpp
)

include_directories(${USB1_INCLUDE_DIRS})
target_link_libraries( indi_ticfocuser-ng "${USB1_LIBRARIES}")

set(WITH_LIBUSB TRUE)
endif()

find_package(LIBBLUETOOTH)
if (LIBBLUETOOTH_FOUND)

list(APPEND INDI_TICFOCUSER-NG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/StreamBT.cpp ${CMAKE_CURRENT_SOURCE_DIR}/connection/BluetoothConnection.cpp
)

target_link_libraries( indi_ticfocuser-ng "${LIBBLUETOOTH_LIBRARIES}")

set(WITH_BLUETOOTH TRUE)
endif()


find_package(LIBTIC1)
if(LIBTIC1_FOUND)

list(APPEND INDI_TICFOCUSER-NG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/connection/driver_interfaces/PololuUsbInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/PololuUsbConnection.cpp
)
include_directories(${LIBTIC1_INCLUDE_DIR})
target_compile_options(indi_ticfocuser-ng PUBLIC ${LIBTIC1_CFLAGS})
target_link_libraries( indi_ticfocuser-ng "${LIBTIC1_LIBRARIES}")

set(WITH_LIBTIC TRUE)
endif()

target_sources(indi_ticfocuser-ng PUBLIC ${INDI_TICFOCUSER-NG_SRCS})

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/TicFocuser_config.h.in
${CMAKE_CURRENT_BINARY_DIR}/TicFocuser_config.h
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/indi_ticfocuser.xml.cmake
${CMAKE_CURRENT_BINARY_DIR}/indi_ticfocuser.xml
)

install(TARGETS indi_ticfocuser-ng RUNTIME DESTINATION bin )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_ticfocuser.xml DESTINATION ${INDI_DATA_DIR})

Loading
Loading