added antenna switching...

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1885 7ae35d74-ebe9-4afe-98af-79ac388436b8
This commit is contained in:
Juergen Rinas, DC3BW 2004-11-28 21:06:40 +00:00
parent f9eff006f4
commit 3915cdb0a0

View File

@ -2,7 +2,7 @@
* Hamlib Kenwood backend - TS480 description
* Copyright (c) 2000-2004 by Stephane Fillod and Juergen Rinas
*
* $Id: ts480.c,v 1.1 2004-11-27 13:19:56 fillods Exp $
* $Id: ts480.c,v 1.2 2004-11-28 21:06:40 jrinas 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
@ -41,8 +41,7 @@
*
* set PTT with audio from data connector (NOT microphone!!!)
*/
static int
kenwood_ts480_set_ptt (RIG * rig, vfo_t vfo, ptt_t ptt)
static int kenwood_ts480_set_ptt (RIG * rig, vfo_t vfo, ptt_t ptt)
{
unsigned char ackbuf[16];
int ack_len = 0;
@ -51,6 +50,57 @@ kenwood_ts480_set_ptt (RIG * rig, vfo_t vfo, ptt_t ptt)
}
/*
* kenwood_ts480_set_ant
* Assumes rig!=NULL
*
* set the aerial/antenna to use
*/
static int kenwood_ts480_set_ant (RIG *rig, vfo_t vfo, ant_t ant)
{
unsigned char ackbuf[16];
int ack_len = 0;
if ( RIG_ANT_1==ant)
return kenwood_transaction (rig,"AN1;", 4, ackbuf, &ack_len);
if ( RIG_ANT_2==ant)
return kenwood_transaction (rig,"AN2;", 4, ackbuf, &ack_len);
return -RIG_EINVAL;
}
/*
* kenwood_ts480_get_ant
* Assumes rig!=NULL
*
* get the aerial/antenna in use
*/
static int kenwood_ts480_get_ant (RIG *rig, vfo_t vfo, ant_t * ant)
{
unsigned char ackbuf[16];
int ack_len=16;
int retval;
retval = kenwood_transaction (rig,"AN;", 3, ackbuf, &ack_len);
if (RIG_OK != retval)
return retval;
if (4!=ack_len)
return -RIG_EPROTO;
switch (ackbuf[2])
{
case '1':
*ant=RIG_ANT_1;
break;
case '2':
*ant=RIG_ANT_2;
break;
default:
/* can only be a protocol error since the ts480 has only two antenna connectors */
return -RIG_EPROTO;
}
return RIG_OK;
}
/*
* kenwood_ts480_get_info
* Assumes rig!=NULL
@ -200,7 +250,8 @@ const struct rig_caps ts480_caps = {
.get_powerstat = kenwood_get_powerstat,
.get_info = kenwood_ts480_get_info,
.reset = kenwood_reset,
.set_ant = kenwood_ts480_set_ant,
.get_ant = kenwood_ts480_get_ant,
};
/*