diff --git a/kenwood/kenwood.c b/kenwood/kenwood.c index 388bae327..5e3a23671 100644 --- a/kenwood/kenwood.c +++ b/kenwood/kenwood.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - main file * Copyright (c) 2000-2004 by Stephane Fillod and others * - * $Id: kenwood.c,v 1.72 2004-02-08 17:05:55 fillods Exp $ + * $Id: kenwood.c,v 1.73 2004-02-14 16:50:53 f4dwv 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 @@ -268,6 +268,52 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo) return retval; } +int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) +{ + unsigned char cmdbuf[16], ackbuf[16]; + int cmd_len, ack_len, retval; + char vfo_function; + + if(vfo !=RIG_VFO_CURR) { + switch (vfo) { + case RIG_VFO_VFO: + case RIG_VFO_A: vfo_function = '0'; break; + case RIG_VFO_B: vfo_function = '1'; break; + case RIG_VFO_MEM: vfo_function = '2'; break; + default: + rig_debug(RIG_DEBUG_ERR,"kenwood_set_split_vfo: unsupported VFO %d\n", + vfo); + return -RIG_EINVAL; + } + + /* set RX VFO */ + cmd_len = sprintf(cmdbuf, "FR%c%s", vfo_function, cmd_trm(rig)); + ack_len = 0; + retval = kenwood_transaction (rig, cmdbuf, cmd_len, ackbuf, &ack_len); + if (retval != RIG_OK) + return retval; + } + + if(split==RIG_SPLIT_ON) { + switch (txvfo) { + case RIG_VFO_VFO: + case RIG_VFO_A: vfo_function = '0'; break; + case RIG_VFO_B: vfo_function = '1'; break; + case RIG_VFO_MEM: vfo_function = '2'; break; + default: + rig_debug(RIG_DEBUG_ERR,"kenwood_set_split_vfo: unsupported VFO %d\n", txvfo); + return -RIG_EINVAL; + } + } else + if(vfo==RIG_VFO_CURR) + rig_debug(RIG_DEBUG_ERR,"kenwood_set_split_vfo: unsupported VFO %d\n", vfo); + + /* set TX VFO */ + cmd_len = sprintf(cmdbuf, "FT%c%s", vfo_function, cmd_trm(rig)); + ack_len = 0; + retval = kenwood_transaction (rig, cmdbuf, cmd_len, ackbuf, &ack_len); + return retval; +} /* * kenwood_get_vfo using byte 31 of the IF information field diff --git a/kenwood/kenwood.h b/kenwood/kenwood.h index eef74813c..287c68955 100644 --- a/kenwood/kenwood.h +++ b/kenwood/kenwood.h @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - main header * Copyright (c) 2000-2004 by Stephane Fillod * - * $Id: kenwood.h,v 1.33 2004-02-08 17:05:55 fillods Exp $ + * $Id: kenwood.h,v 1.34 2004-02-14 16:50:54 f4dwv 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 @@ -49,6 +49,7 @@ int kenwood_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, size_t *data_len); int kenwood_set_vfo(RIG *rig, vfo_t vfo); int kenwood_get_vfo(RIG *rig, vfo_t *vfo); +int kenwood_set_split_vfo(RIG *rig, vfo_t vfo , split_t split, vfo_t txvfo); int kenwood_old_set_vfo(RIG *rig, vfo_t vfo); int kenwood_old_get_vfo(RIG *rig, vfo_t *vfo); int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq); diff --git a/kenwood/ts850.c b/kenwood/ts850.c index ef66217df..2fb5d4ceb 100644 --- a/kenwood/ts850.c +++ b/kenwood/ts850.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - TS850 description * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ts850.c,v 1.13 2004-02-14 15:12:41 f4dwv Exp $ + * $Id: ts850.c,v 1.14 2004-02-14 16:50:53 f4dwv 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 @@ -202,6 +202,7 @@ const struct rig_caps ts850_caps = { .get_mode = ts850_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo, +.set_split_vfo = kenwood_set_split_vfo, .set_ctcss_tone = ts850_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .get_ptt = kenwood_get_ptt,