added fodtrack rotator initial support

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1294 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.4
Stéphane Fillod, F8CFE 2002-11-28 22:24:10 +00:00
rodzic 91a7308dbc
commit 671fe70e40
6 zmienionych plików z 204 dodań i 2 usunięć

Wyświetl plik

@ -16,5 +16,5 @@ SUBDIRS = macros include lib libltdl src @BACKEND_LIST@ @ROT_BACKEND_LIST@ \
# tcl and perl subdir are no more distributed
DIST_SUBDIRS = macros include lib libltdl src c++ kylix bindings tests doc \
icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc \
rpcrig winradio easycomm rpcrot gnuradio drake
rpcrig winradio easycomm fodtrack rpcrot gnuradio drake

Wyświetl plik

@ -264,6 +264,8 @@ case "$host_os" in
linux-gnu*)
# Winradio only under Linux (until someone port it on other os)
BACKEND_LIST="$BACKEND_LIST winradio"
# TODO: support parallel port interface on other systems too
ROT_BACKEND_LIST="$ROT_BACKEND_LIST fodtrack"
;;
*)
esac
@ -372,6 +374,7 @@ jrc/Makefile
drake/Makefile
gnuradio/Makefile
easycomm/Makefile
fodtrack/Makefile
rpcrig/Makefile
rpcrot/Makefile
src/Makefile

Wyświetl plik

@ -0,0 +1,7 @@
lib_LTLIBRARIES = hamlib-fodtrack.la
hamlib_fodtrack_la_SOURCES = fodtrack.c
hamlib_fodtrack_la_LDFLAGS = -no-undefined -module -avoid-version
hamlib_fodtrack_la_LIBADD = $(top_builddir)/src/libhamlib.la
noinst_HEADERS = fodtrack.h

151
fodtrack/fodtrack.c 100644
Wyświetl plik

@ -0,0 +1,151 @@
/*
* Hamlib Rotator backend - Fodtrack parallel port
* Copyright (c) 2001,2002 by Stephane Fillod
*
* $Id: fodtrack.c,v 1.1 2002-11-28 22:24:10 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
/*
* So far, only supported on Linux platforms
*/
#ifdef HAVE_LINUX_PPDEV_H
#include <linux/parport.h>
#include <linux/ppdev.h>
#endif
#include <hamlib/rotator.h>
#include <serial.h>
#include <misc.h>
#include "fodtrack.h"
/* ************************************************************************* */
/** outputs an direction to the interface */
static int setDirection(int fodtrackfd, unsigned char outputvalue, int direction)
{
unsigned char outputstatus;
// set the data bits
ioctl(fodtrackfd, PPWDATA, &outputvalue);
// autofd=true --> azimuth otherwhise elevation
if(direction)
outputstatus = PARPORT_CONTROL_AUTOFD;
else
outputstatus=0;
ioctl(fodtrackfd, PPWCONTROL, &outputstatus);
// and now the strobe impulse
usleep(1);
if(direction)
outputstatus = PARPORT_CONTROL_AUTOFD | PARPORT_CONTROL_STROBE;
else
outputstatus = PARPORT_CONTROL_STROBE;
ioctl(fodtrackfd, PPWCONTROL, &outputstatus);
usleep(1);
if (direction)
outputstatus= PARPORT_CONTROL_AUTOFD;
else
outputstatus=0;
ioctl(fodtrackfd, PPWCONTROL, &outputstatus);
return RIG_OK;
}
static int
fodtrack_set_position(ROT *rot, azimuth_t az, elevation_t el)
{
int fd;
int retval;
rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __FUNCTION__, az, el);
fd = rot->state.rotport.fd;
retval = setDirection(fd, el/(float)rot->state.max_el*255.0, 0);
if (retval != RIG_OK)
return retval;
retval = setDirection(fd, az/(float)rot->state.max_az*255.0, 1);
if (retval != RIG_OK)
return retval;
return RIG_OK;
}
/* ************************************************************************* */
/*
* Fodtrack rotator capabilities.
*/
/** Fodtrack implement essentially only the set position function.
*/
const struct rot_caps fodtrack_rot_caps = {
.rot_model = ROT_MODEL_FODTRACK,
.model_name = "Fodtrack",
.mfg_name = "XQ2FOD",
.version = "0.1",
.copyright = "LGPL",
.status = RIG_STATUS_NEW,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_PARALLEL,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.retry = 3,
.min_az = 0,
.max_az = 450,
.min_el = 0,
.max_el = 180,
.priv = NULL, /* priv */
.set_position = fodtrack_set_position,
};
/* ************************************************************************* */
int initrots_fodtrack(void *be_handle)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__);
rot_register(&fodtrack_rot_caps);
return RIG_OK;
}
/* ************************************************************************* */
/* end of file */

Wyświetl plik

@ -0,0 +1,30 @@
/*
* Hamlib Rotator backend - Fodtrack interface protocol
* Copyright (c) 2001,2002 by Stephane Fillod
*
* $Id: fodtrack.h,v 1.1 2002-11-28 22:24:10 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _ROT_FODTRACK_H
#define _ROT_FODTRACK_H 1
extern const struct rot_caps fodtrack_rot_caps;
extern BACKEND_EXPORT(int) initrots_fodtrack(void *be_handle);
#endif /* _ROT_FODTRACK_H */

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - list of known rotators
* Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
*
* $Id: rotlist.h,v 1.5 2002-11-12 00:11:54 fillods Exp $
* $Id: rotlist.h,v 1.6 2002-11-28 22:24:10 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -92,6 +92,16 @@
#define ROT_MODEL_EASYCOMM1 ROT_MAKE_MODEL(ROT_EASYCOMM, 1)
#define ROT_MODEL_EASYCOMM2 ROT_MAKE_MODEL(ROT_EASYCOMM, 2)
/*! \def ROT_MODEL_FODTRACK
* \brief A macro that returns the model number of the Fodtrack backend.
*
* The Fodtrack backend can be used with rotators that support the
* FODTRACK Standard.
*/
#define ROT_FODTRACK 3
#define ROT_BACKEND_FODTRACK "fodtrack"
#define ROT_MODEL_FODTRACK ROT_MAKE_MODEL(ROT_FODTRACK, 1)
/*! \typedef typedef int rot_model_t
\brief Convenience type definition for rotator model.
@ -110,6 +120,7 @@ typedef int rot_model_t;
{ ROT_DUMMY, ROT_BACKEND_DUMMY }, \
{ ROT_RPC, ROT_BACKEND_RPC }, \
{ ROT_EASYCOMM, ROT_BACKEND_EASYCOMM }, \
{ ROT_FODTRACK, ROT_BACKEND_FODTRACK }, \
{ 0, NULL }, /* end */ \
}