diff --git a/AUTHORS b/AUTHORS index 7c89c1171..ac9ddde39 100644 --- a/AUTHORS +++ b/AUTHORS @@ -107,8 +107,11 @@ C: Thomas Beierlein, DL1JBE [kenwood: R-5000] M: Mark J. Fine +[kenwood: tmd700] +M: Charles Suprin, AA1VS + [kenwood: thg71,tmv7,tmd700] -M: Thierry Leconte, F4DWV +C: Thierry Leconte, F4DWV [kenwood: thg71,tmv7] M: Andrew McNamara @@ -214,6 +217,10 @@ C: Francois Retief [fodtrack] M: Luc Langehegermann, LX2GT +[amsat/if-100] +M: Stephane Fillod, F8CFE +C: Patrick Strasser, OE6PSE + [heathkit:HD 1780 Intellirotor] M: Rob Frohne, KL7NA @@ -306,6 +313,7 @@ Kamal Mostafa, KA6MAL, Jaime Robles, EA4TV, Wolfgang Buesser, DK1BW, Magne Mæhre, LA1BFA, +Charles Suprin, AA1VS, Robert Steinhäußer, DL1NC, James Watson, HZ1JW, Juergen Rinas, DC3BW, diff --git a/Makefile.am b/Makefile.am index 5ca88b849..14026970c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,7 @@ DIST_SUBDIRS = macros include lib $(subdirs) src c++ bindings tests doc \ icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc \ rpcrig winradio easycomm fodtrack rpcrot drake rotorez \ flexradio sartek lowe rft rs tapr kit skanti prm80 wj racal tuner \ - gs232a heathkit spid ars m2 + gs232a heathkit spid ars m2 amsat rpm: Makefile dist $(RPMBUILD) -ta $(PACKAGE)-$(VERSION).tar.gz diff --git a/amsat/Makefile.am b/amsat/Makefile.am new file mode 100644 index 000000000..c45861b52 --- /dev/null +++ b/amsat/Makefile.am @@ -0,0 +1,7 @@ + +pkglib_LTLIBRARIES = hamlib-amsat.la +hamlib_amsat_la_SOURCES = if100.c +hamlib_amsat_la_LDFLAGS = -no-undefined -module -avoid-version +hamlib_amsat_la_LIBADD = $(top_builddir)/lib/libmisc.la \ + $(top_builddir)/src/libhamlib.la + diff --git a/amsat/if100.c b/amsat/if100.c new file mode 100644 index 000000000..958ae0d8b --- /dev/null +++ b/amsat/if100.c @@ -0,0 +1,124 @@ +/* + * Hamlib Rotator backend - IF-100 parallel port + * Copyright (c) 2011 by Stephane Fillod + * + * + * 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 +#include /* String function definitions */ +#include /* UNIX standard function definitions */ +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#include "hamlib/rotator.h" +#include "parallel.h" +#include "misc.h" +#include "register.h" + + +static int +if100_set_position(ROT *rot, azimuth_t az, elevation_t el) +{ + hamlib_port_t *port = &rot->state.rotport; + int retval; + int az_i; + int el_i; + int dataout, i; + + rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el); + + if (rot->state.max_az - rot->state.min_az >= 450) + az_i = az * 0.70833; + else + az_i = (az + 45) * 0.56667; + + el_i = el * 1.4166; + + dataout = ((el_i & 0xff) << 8) + (az_i & 0xff); + +#define DAT0 0x01 +#define CLK 0x02 +#define TRACK 0x08 + + rig_debug(RIG_DEBUG_TRACE, "%s: shifting dataout 0x%04x to parallel port\n", __func__, dataout); + + retval = par_lock (port); + if (retval != RIG_OK) + return retval; + + for (i = 0; i < 16; i++) { + if (dataout & 0x8000) { + par_write_data(port, TRACK|DAT0); + par_write_data(port, TRACK|DAT0|CLK); + par_write_data(port, TRACK|DAT0); + } else { + par_write_data(port, TRACK); + par_write_data(port, TRACK|CLK); + par_write_data(port, TRACK); + } + dataout = (dataout << 1) & 0xffff; + } + + par_write_data(port, TRACK); + par_unlock (port); + + return RIG_OK; +} + + +/** IF-100 implements essentially only the set position function. + */ +const struct rot_caps if100_rot_caps = { + .rot_model = ROT_MODEL_IF100, + .model_name = "IF-100", + .mfg_name = "AMSAT", + .version = "0.1", + .copyright = "LGPL", + .status = RIG_STATUS_UNTESTED, + .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 = 360, + .min_el = 0, + .max_el = 180, + + .set_position = if100_set_position, +}; + + +/* ************************************************************************* */ + +DECLARE_INITROT_BACKEND(amsat) +{ + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + rot_register(&if100_rot_caps); + + return RIG_OK; +} + diff --git a/bindings/ignore.swg b/bindings/ignore.swg index 6f3967531..fe370f14d 100644 --- a/bindings/ignore.swg +++ b/bindings/ignore.swg @@ -89,6 +89,8 @@ %ignore ROT_BACKEND_M2; %ignore ROT_ARS; %ignore ROT_BACKEND_ARS; +%ignore ROT_AMSAT; +%ignore ROT_BACKEND_AMSAT; %ignore PRIfreq; %ignore SCNfreq; diff --git a/configure.ac b/configure.ac index 6ba885ff9..e8b0d657d 100644 --- a/configure.ac +++ b/configure.ac @@ -256,7 +256,7 @@ AC_SUBST(RIGMATRIX) BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc drake lowe rft rs kit skanti prm80 tapr flexradio wj racal tuner" -ROT_BACKEND_LIST="dummy easycomm fodtrack gs232a heathkit kit rotorez sartek spid ars m2" +ROT_BACKEND_LIST="dummy easycomm fodtrack gs232a heathkit kit rotorez sartek spid ars m2 amsat" BINDINGS="" BINDING_ALL="" BINDING_CHECK="" @@ -535,6 +535,7 @@ doc/hamlib.cfg rotorez/Makefile flexradio/Makefile m2/Makefile +amsat/Makefile hamlib.pc hamlib.spec] ) diff --git a/include/hamlib/rotlist.h b/include/hamlib/rotlist.h index 578ac4d93..8754fffd8 100644 --- a/include/hamlib/rotlist.h +++ b/include/hamlib/rotlist.h @@ -1,6 +1,6 @@ /* * Hamlib Interface - list of known rotators - * Copyright (c) 2000-2010 by Stephane Fillod + * Copyright (c) 2000-2011 by Stephane Fillod * Copyright (c) 2000-2002 by Frank Singleton * * @@ -243,6 +243,17 @@ #define ROT_MODEL_RCI_AZEL ROT_MAKE_MODEL(ROT_ARS, 1) #define ROT_MODEL_RCI_AZ ROT_MAKE_MODEL(ROT_ARS, 2) +/*! \def ROT_MODEL_IF100 + * \brief A macro that returns the model number of the IF-100 backend. + * + * The AMSAT backend can be used with rotators that support, + * among other, the IF-100 interface. + */ +#define ROT_AMSAT 12 +#define ROT_BACKEND_AMSAT "amsat" +#define ROT_MODEL_IF100 ROT_MAKE_MODEL(ROT_AMSAT, 1) + + /*! \typedef typedef int rot_model_t \brief Convenience type definition for rotator model. */ @@ -268,6 +279,7 @@ typedef int rot_model_t; { ROT_SPID, ROT_BACKEND_SPID }, \ { ROT_M2, ROT_BACKEND_M2 }, \ { ROT_ARS, ROT_BACKEND_ARS }, \ + { ROT_AMSAT, ROT_BACKEND_AMSAT }, \ { 0, NULL }, /* end */ \ }