kopia lustrzana https://github.com/Hamlib/Hamlib
Initial support for FT736R, FRG100 and FRG9600
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1797 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.2
rodzic
7386e39a7d
commit
712112009a
|
@ -1,6 +1,6 @@
|
|||
YAESUSRC = ft100.c ft747.c ft817.c ft847.c ft890.c ft900.c ft920.c \
|
||||
ft1000mp.c ft857.c ft897.c ft990.c frg8800.c \
|
||||
ft757gx.c
|
||||
ft757gx.c ft736.c frg100.c frg9600.c
|
||||
|
||||
lib_LTLIBRARIES = hamlib-yaesu.la
|
||||
hamlib_yaesu_la_SOURCES = $(YAESUSRC) yaesu.c
|
||||
|
|
|
@ -0,0 +1,356 @@
|
|||
/*
|
||||
* frg100.c - (C) Stephane Fillod 2002-2004
|
||||
*
|
||||
* This shared library provides an API for communicating
|
||||
* via serial interface to an FRG-100 using the "CAT" interface
|
||||
*
|
||||
* $Id: frg100.c,v 1.1 2004-08-10 21:08:41 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 <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
|
||||
#include "hamlib/rig.h"
|
||||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "yaesu.h"
|
||||
|
||||
|
||||
|
||||
#define FRG100_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM|RIG_MODE_FM)
|
||||
|
||||
#define FRG100_VFOS (RIG_VFO_A)
|
||||
#define FRG100_ANTS 0
|
||||
|
||||
|
||||
/* TODO: get better measure numbers */
|
||||
#define FRG100_STR_CAL { 2, { \
|
||||
{ 0, -60 }, /* S0 -6dB */ \
|
||||
{ 15, 60 } /* +60 */ \
|
||||
} }
|
||||
|
||||
#define FRG100_MEM_CAP { \
|
||||
.freq = 1, \
|
||||
.mode = 1, \
|
||||
.width = 1 \
|
||||
}
|
||||
|
||||
/* Private helper function prototypes */
|
||||
|
||||
static int frg100_open(RIG *rig);
|
||||
|
||||
static int frg100_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||
static int frg100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||
static int frg100_set_vfo(RIG *rig, vfo_t vfo);
|
||||
static int frg100_set_powerstat(RIG *rig, powerstat_t status);
|
||||
static int frg100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||
|
||||
static int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width);
|
||||
static int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width);
|
||||
|
||||
/*
|
||||
* frg100 rigs capabilities.
|
||||
* Also this struct is READONLY!
|
||||
*
|
||||
* TODO:
|
||||
* - Memory recall
|
||||
* - VFO->M & M->VFO
|
||||
* - Lock, Up/Down
|
||||
* - Status update
|
||||
* - Clock set, Timer
|
||||
* - Scan skip
|
||||
* - Step Frequency Size
|
||||
* - Dim
|
||||
*/
|
||||
|
||||
const struct rig_caps frg100_caps = {
|
||||
.rig_model = RIG_MODEL_FRG100,
|
||||
.model_name = "FRG-100",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "0.1",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_UNTESTED,
|
||||
.rig_type = RIG_TYPE_RECEIVER,
|
||||
.ptt_type = RIG_PTT_NONE,
|
||||
.dcd_type = RIG_DCD_NONE,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 4800,
|
||||
.serial_rate_max = 4800,
|
||||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 2,
|
||||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||
.write_delay = 20,
|
||||
.post_write_delay = 300,
|
||||
.timeout = 2000,
|
||||
.retry = 0,
|
||||
.has_get_func = RIG_FUNC_LOCK,
|
||||
.has_set_func = RIG_FUNC_LOCK,
|
||||
.has_get_level = RIG_LEVEL_RAWSTR,
|
||||
.has_set_level = RIG_LEVEL_NONE,
|
||||
.has_get_parm = RIG_PARM_NONE,
|
||||
.has_set_parm = RIG_PARM_BACKLIGHT,
|
||||
.vfo_ops = RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_UP|RIG_OP_DOWN,
|
||||
.preamp = { RIG_DBLST_END, },
|
||||
.attenuator = { RIG_DBLST_END, },
|
||||
.max_rit = Hz(0),
|
||||
.max_xit = Hz(0),
|
||||
.max_ifshift = Hz(0),
|
||||
.targetable_vfo = RIG_TARGETABLE_NONE,
|
||||
.transceive = RIG_TRN_OFF,
|
||||
.bank_qty = 0,
|
||||
.chan_desc_sz = 0,
|
||||
.chan_list = {
|
||||
{ 1, 0x32, RIG_MTYPE_MEM, FRG100_MEM_CAP },
|
||||
{ 0x33, 0x34, RIG_MTYPE_EDGE },
|
||||
},
|
||||
.rx_range_list1 = {
|
||||
{kHz(50), MHz(30), FRG100_MODES, -1, -1, FRG100_VFOS, FRG100_ANTS },
|
||||
RIG_FRNG_END,
|
||||
}, /* Region 1 rx ranges */
|
||||
|
||||
.tx_range_list1 = {
|
||||
RIG_FRNG_END,
|
||||
}, /* region 1 TX ranges */
|
||||
|
||||
.rx_range_list2 = {
|
||||
{kHz(50), MHz(30), FRG100_MODES, -1, -1, FRG100_VFOS, FRG100_ANTS },
|
||||
RIG_FRNG_END,
|
||||
}, /* Region 2 rx ranges */
|
||||
|
||||
.tx_range_list2 = {
|
||||
RIG_FRNG_END,
|
||||
}, /* region 2 TX ranges */
|
||||
|
||||
.tuning_steps = {
|
||||
{RIG_MODE_SSB|RIG_MODE_CW, Hz(10)},
|
||||
{RIG_MODE_FM|RIG_MODE_AM, Hz(100)},
|
||||
RIG_TS_END,
|
||||
},
|
||||
|
||||
/* mode/filter list, remember: order matters! */
|
||||
.filters = {
|
||||
{RIG_MODE_SSB|RIG_MODE_CW, kHz(2.4)},
|
||||
{RIG_MODE_CW, Hz(500)},
|
||||
{RIG_MODE_AM, kHz(6)},
|
||||
{RIG_MODE_AM, kHz(4)},
|
||||
{RIG_MODE_FM, kHz(15)},
|
||||
RIG_FLT_END,
|
||||
},
|
||||
|
||||
.str_cal = FRG100_STR_CAL,
|
||||
|
||||
.rig_open = frg100_open,
|
||||
|
||||
.set_freq = frg100_set_freq,
|
||||
.set_mode = frg100_set_mode,
|
||||
.set_vfo = frg100_set_vfo,
|
||||
.get_level = frg100_get_level,
|
||||
|
||||
.set_powerstat = frg100_set_powerstat,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* frg100_open routine
|
||||
*
|
||||
*/
|
||||
int frg100_open(RIG *rig)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0e};
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "frg100: frg100_open called\n");
|
||||
|
||||
/* send 0 delay pacing */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int frg100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0a};
|
||||
|
||||
/* store bcd format in cmd (MSB), not sure though */
|
||||
to_bcd_be(cmd, freq/10, 8);
|
||||
|
||||
/* Frequency set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
int frg100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0c};
|
||||
|
||||
|
||||
/* fill in p1 */
|
||||
cmd[3] = mode2rig(rig, mode, width);
|
||||
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actually, this is tape relay, 0xfe=on
|
||||
*/
|
||||
int frg100_set_powerstat(RIG *rig, powerstat_t status)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x20};
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,"frg100: frg100_set_powerstat called\n");
|
||||
|
||||
cmd[3] = status == RIG_POWER_OFF ? 0x00 : 0x01;
|
||||
|
||||
/* Frequency set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
int frg100_set_vfo(RIG *rig, vfo_t vfo)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
|
||||
switch(vfo) {
|
||||
case RIG_VFO_CURR:
|
||||
return RIG_OK;
|
||||
case RIG_VFO_VFO:
|
||||
case RIG_VFO_A:
|
||||
cmd[4] = 0x05;
|
||||
break;
|
||||
case RIG_VFO_MEM:
|
||||
/* TODO: cmd[3] = priv->current_mem_chan; */
|
||||
cmd[4] = 0x02;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong VFO */
|
||||
}
|
||||
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
int frg100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xf7};
|
||||
int retval;
|
||||
|
||||
if (level != RIG_LEVEL_RAWSTR)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
serial_flush(&rig->state.rigport);
|
||||
|
||||
/* send READ STATUS(Meter only) cmd to rig */
|
||||
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
/* read back the 1 byte */
|
||||
retval = read_block(&rig->state.rigport, cmd, 5);
|
||||
|
||||
if (retval < 1) {
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: read meter failed %d\n",
|
||||
__FUNCTION__,retval);
|
||||
|
||||
return retval < 0 ? retval : -RIG_EIO;
|
||||
}
|
||||
val->i = cmd[0];
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
#define MODE_LSB 0x00
|
||||
#define MODE_USB 0x01
|
||||
#define MODE_CWW 0x02
|
||||
#define MODE_CWN 0x03
|
||||
#define MODE_AMW 0x04
|
||||
#define MODE_AMN 0x05
|
||||
#define MODE_FMW 0x06
|
||||
#define MODE_FMN 0x07
|
||||
|
||||
|
||||
int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
int md;
|
||||
|
||||
/*
|
||||
* translate mode from generic to frg100 specific
|
||||
*/
|
||||
switch(mode) {
|
||||
case RIG_MODE_USB: md = MODE_USB; break;
|
||||
case RIG_MODE_LSB: md = MODE_LSB; break;
|
||||
case RIG_MODE_AM:
|
||||
if (width != RIG_PASSBAND_NORMAL ||
|
||||
width < rig_passband_normal(rig, mode))
|
||||
md = MODE_AMN;
|
||||
else
|
||||
md = MODE_AMW;
|
||||
break;
|
||||
case RIG_MODE_FM:
|
||||
if (width != RIG_PASSBAND_NORMAL ||
|
||||
width < rig_passband_normal(rig, mode))
|
||||
md = MODE_AMN;
|
||||
else
|
||||
md = MODE_AMW;
|
||||
break;
|
||||
case RIG_MODE_CW:
|
||||
if (width != RIG_PASSBAND_NORMAL ||
|
||||
width < rig_passband_normal(rig, mode))
|
||||
md = MODE_CWN;
|
||||
else
|
||||
md = MODE_CWW;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE */
|
||||
}
|
||||
return md;
|
||||
}
|
||||
|
||||
int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width)
|
||||
{
|
||||
/*
|
||||
* translate mode from frg100 specific to generic
|
||||
*/
|
||||
switch(md) {
|
||||
case MODE_USB: *mode = RIG_MODE_USB; break;
|
||||
case MODE_LSB: *mode = RIG_MODE_LSB; break;
|
||||
case MODE_AMW:
|
||||
case MODE_AMN: *mode = RIG_MODE_AM; break;
|
||||
case MODE_FMW:
|
||||
case MODE_FMN: *mode = RIG_MODE_FM; break;
|
||||
case MODE_CWW:
|
||||
case MODE_CWN: *mode = RIG_MODE_CW; break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE */
|
||||
}
|
||||
if (md == MODE_CWN || md == MODE_AMN || md == MODE_FMN)
|
||||
*width = rig_passband_narrow(rig, *mode);
|
||||
else
|
||||
*width = rig_passband_normal(rig, *mode);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
/*
|
||||
* frg9600.c - (C) Stephane Fillod 2002-2004
|
||||
*
|
||||
* This shared library provides an API for communicating
|
||||
* via serial interface to an FRG-9600 using the "CAT" interface
|
||||
*
|
||||
* $Id: frg9600.c,v 1.1 2004-08-10 21:08:41 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 <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
|
||||
#include "hamlib/rig.h"
|
||||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "yaesu.h"
|
||||
|
||||
|
||||
/* Private helper function prototypes */
|
||||
|
||||
|
||||
#define FRG9600_MODES (RIG_MODE_SSB|RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM)
|
||||
|
||||
#define FRG9600_VFOS (RIG_VFO_A)
|
||||
|
||||
static int frg9600_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||
static int frg9600_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||
|
||||
/*
|
||||
* frg9600 rigs capabilities.
|
||||
* Also this struct is READONLY!
|
||||
*
|
||||
*/
|
||||
|
||||
const struct rig_caps frg9600_caps = {
|
||||
.rig_model = RIG_MODEL_FRG9600,
|
||||
.model_name = "FRG-9600",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "0.1",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_UNTESTED,
|
||||
.rig_type = RIG_TYPE_RECEIVER,
|
||||
.ptt_type = RIG_PTT_NONE,
|
||||
.dcd_type = RIG_DCD_NONE,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 4800,
|
||||
.serial_rate_max = 4800,
|
||||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 2,
|
||||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||
.write_delay = 0,
|
||||
.post_write_delay = 300,
|
||||
.timeout = 2000,
|
||||
.retry = 0,
|
||||
.has_get_func = RIG_FUNC_NONE,
|
||||
.has_set_func = RIG_FUNC_NONE,
|
||||
.has_get_level = RIG_LEVEL_NONE,
|
||||
.has_set_level = RIG_LEVEL_NONE,
|
||||
.has_get_parm = RIG_PARM_NONE,
|
||||
.has_set_parm = RIG_PARM_NONE,
|
||||
.vfo_ops = RIG_OP_NONE,
|
||||
.preamp = { RIG_DBLST_END, },
|
||||
.attenuator = { RIG_DBLST_END, },
|
||||
.max_rit = Hz(0),
|
||||
.max_xit = Hz(0),
|
||||
.max_ifshift = Hz(0),
|
||||
.targetable_vfo = RIG_TARGETABLE_FREQ,
|
||||
.transceive = RIG_TRN_OFF,
|
||||
.bank_qty = 0,
|
||||
.chan_desc_sz = 0,
|
||||
.chan_list = {
|
||||
RIG_CHAN_END,
|
||||
},
|
||||
.rx_range_list1 = {
|
||||
{MHz(60), MHz(905), RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM, -1, -1, FRG9600_VFOS },
|
||||
{MHz(60), MHz(460), RIG_MODE_SSB, -1, -1, FRG9600_VFOS },
|
||||
RIG_FRNG_END,
|
||||
}, /* Region 1 rx ranges */
|
||||
|
||||
.tx_range_list1 = {
|
||||
RIG_FRNG_END,
|
||||
}, /* region 1 TX ranges */
|
||||
|
||||
.rx_range_list2 = {
|
||||
{MHz(60), MHz(905), RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM, -1, -1, FRG9600_VFOS },
|
||||
{MHz(60), MHz(460), RIG_MODE_SSB, -1, -1, FRG9600_VFOS },
|
||||
RIG_FRNG_END,
|
||||
}, /* Region 2 rx ranges */
|
||||
|
||||
.tx_range_list2 = {
|
||||
RIG_FRNG_END,
|
||||
}, /* region 2 TX ranges */
|
||||
|
||||
.tuning_steps = {
|
||||
{RIG_MODE_SSB|RIG_MODE_AM, Hz(100)},
|
||||
{RIG_MODE_FM, kHz(5)},
|
||||
{RIG_MODE_WFM, kHz(100)},
|
||||
RIG_TS_END,
|
||||
},
|
||||
|
||||
/* mode/filter list, at -3dB ! */
|
||||
.filters = {
|
||||
{RIG_MODE_AM, kHz(6)},
|
||||
{RIG_MODE_SSB|RIG_MODE_AM, kHz(2.4)},
|
||||
{RIG_MODE_FM, kHz(15)},
|
||||
{RIG_MODE_WFM, kHz(180)},
|
||||
RIG_FLT_END,
|
||||
},
|
||||
|
||||
.set_freq = frg9600_set_freq,
|
||||
.set_mode = frg9600_set_mode,
|
||||
|
||||
};
|
||||
|
||||
|
||||
#define MODE_SET_LSB 0x10
|
||||
#define MODE_SET_USB 0x11
|
||||
#define MODE_SET_AMN 0x14
|
||||
#define MODE_SET_AMW 0x15
|
||||
#define MODE_SET_FMN 0x16
|
||||
#define MODE_SET_WFM 0x17
|
||||
|
||||
|
||||
int frg9600_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x0a, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
/* store bcd format in cmd (MSB) */
|
||||
to_bcd_be(cmd+1, freq/10, 8);
|
||||
|
||||
/* Frequency set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
int frg9600_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
unsigned char md;
|
||||
|
||||
/*
|
||||
* translate mode from generic to frg9600 specific
|
||||
*/
|
||||
switch(mode) {
|
||||
case RIG_MODE_USB: md = MODE_SET_USB; break;
|
||||
case RIG_MODE_LSB: md = MODE_SET_LSB; break;
|
||||
case RIG_MODE_FM: md = MODE_SET_FMN; break;
|
||||
case RIG_MODE_WFM: md = MODE_SET_WFM; break;
|
||||
case RIG_MODE_AM:
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width < rig_passband_normal(rig, mode))
|
||||
md = MODE_SET_AMN;
|
||||
else
|
||||
md = MODE_SET_AMW;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE */
|
||||
}
|
||||
|
||||
cmd[0] = md;
|
||||
|
||||
/* Mode set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
|
@ -0,0 +1,433 @@
|
|||
/*
|
||||
* ft736.c - (C) Stephane Fillod 2004
|
||||
*
|
||||
* This shared library provides an API for communicating
|
||||
* via serial interface to an FT-736R using the "CAT" interface
|
||||
*
|
||||
* $Id: ft736.c,v 1.1 2004-08-10 21:08:41 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 <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
|
||||
#include "hamlib/rig.h"
|
||||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "yaesu.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#define FT736_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM)
|
||||
|
||||
#define FT736_VFOS (RIG_VFO_A) /* TODO: Sat mode ? */
|
||||
|
||||
/* TODO: get real measure numbers */
|
||||
#define FT736_STR_CAL { 2, { \
|
||||
{ 0x30, -60 }, /* S0 -6dB */ \
|
||||
{ 0xad, 60 } /* +60 */ \
|
||||
} }
|
||||
|
||||
/* Private helper function prototypes */
|
||||
|
||||
static int ft736_open(RIG *rig);
|
||||
static int ft736_close(RIG *rig);
|
||||
|
||||
static int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||
static int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||
static int ft736_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
|
||||
static int ft736_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||
static int ft736_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||
static int ft736_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
|
||||
static int ft736_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd);
|
||||
static int ft736_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||
static int ft736_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift);
|
||||
static int ft736_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs);
|
||||
|
||||
/*
|
||||
* ft736 rigs capabilities.
|
||||
* Also this struct is READONLY!
|
||||
*
|
||||
* TODO:
|
||||
* - repeater func & offset
|
||||
* - CTCSS & DCS
|
||||
* - AQS
|
||||
*/
|
||||
|
||||
const struct rig_caps ft736_caps = {
|
||||
.rig_model = RIG_MODEL_FT736R,
|
||||
.model_name = "FT-736R",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "0.1",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_UNTESTED,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
.ptt_type = RIG_PTT_RIG,
|
||||
.dcd_type = RIG_DCD_RIG,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 4800,
|
||||
.serial_rate_max = 4800,
|
||||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 2,
|
||||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_NONE, /* RTS low, DTR high, and CTS low. */
|
||||
.write_delay = 30, /* 50ms to be real safe */
|
||||
.post_write_delay = 0,
|
||||
.timeout = 2000,
|
||||
.retry = 0,
|
||||
.has_get_func = RIG_FUNC_NONE,
|
||||
.has_set_func = RIG_FUNC_NONE,
|
||||
.has_get_level = RIG_LEVEL_RAWSTR,
|
||||
.has_set_level = RIG_LEVEL_NONE,
|
||||
.has_get_parm = RIG_PARM_NONE,
|
||||
.has_set_parm = RIG_PARM_NONE,
|
||||
.vfo_ops = RIG_OP_NONE,
|
||||
.preamp = { RIG_DBLST_END, },
|
||||
.attenuator = { RIG_DBLST_END, },
|
||||
.max_rit = Hz(0),
|
||||
.max_xit = Hz(0),
|
||||
.max_ifshift = Hz(0),
|
||||
.targetable_vfo = RIG_TARGETABLE_FREQ,
|
||||
.transceive = RIG_TRN_OFF,
|
||||
.bank_qty = 0,
|
||||
.chan_desc_sz = 0,
|
||||
.chan_list = {
|
||||
RIG_CHAN_END,
|
||||
},
|
||||
.rx_range_list1 = {
|
||||
{MHz(50), MHz(53.99999), FT736_MODES, -1, -1, FT736_VFOS },
|
||||
{MHz(144), MHz(145.99999), FT736_MODES, -1, -1, FT736_VFOS },
|
||||
{MHz(430), MHz(439.99999), FT736_MODES, -1, -1, FT736_VFOS },
|
||||
{MHz(1240), MHz(1299.99999), FT736_MODES, -1, -1, FT736_VFOS },
|
||||
RIG_FRNG_END,
|
||||
}, /* Region 1 rx ranges */
|
||||
|
||||
.tx_range_list1 = {
|
||||
{MHz(50), MHz(53.99999), FT736_MODES, W(5), W(30), FT736_VFOS },
|
||||
{MHz(144), MHz(145.99999), FT736_MODES, W(5), W(60), FT736_VFOS },
|
||||
{MHz(430), MHz(439.99999), FT736_MODES, W(5), W(60), FT736_VFOS },
|
||||
{MHz(1240), MHz(1299.99999), FT736_MODES, W(5), W(45), FT736_VFOS },
|
||||
RIG_FRNG_END,
|
||||
}, /* region 1 TX ranges */
|
||||
|
||||
.rx_range_list2 = {
|
||||
{MHz(50), MHz(53.99999), FT736_MODES, -1, -1, FT736_VFOS },
|
||||
{MHz(144), MHz(147.99999), FT736_MODES, -1, -1, FT736_VFOS },
|
||||
{MHz(220), MHz(224.99999), FT736_MODES, -1, -1, FT736_VFOS },
|
||||
{MHz(430), MHz(449.99999), FT736_MODES, -1, -1, FT736_VFOS },
|
||||
{MHz(1240), MHz(1299.99999), FT736_MODES, -1, -1, FT736_VFOS },
|
||||
RIG_FRNG_END,
|
||||
}, /* Region 2 rx ranges */
|
||||
|
||||
.tx_range_list2 = {
|
||||
{MHz(50), MHz(53.99999), FT736_MODES, W(5), W(30), FT736_VFOS },
|
||||
{MHz(144), MHz(147.99999), FT736_MODES, W(5), W(60), FT736_VFOS },
|
||||
{MHz(220), MHz(224.99999), FT736_MODES, W(5), W(60), FT736_VFOS },
|
||||
{MHz(430), MHz(449.99999), FT736_MODES, W(5), W(60), FT736_VFOS },
|
||||
{MHz(1240), MHz(1299.99999), FT736_MODES, W(5), W(45), FT736_VFOS },
|
||||
RIG_FRNG_END,
|
||||
}, /* region 2 TX ranges */
|
||||
|
||||
|
||||
.tuning_steps = {
|
||||
{FT736_MODES, Hz(10)},
|
||||
RIG_TS_END,
|
||||
},
|
||||
|
||||
/* mode/filter list, remember: order matters! */
|
||||
.filters = {
|
||||
{RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR, kHz(2.2)},
|
||||
{RIG_MODE_CW, Hz(600)},
|
||||
{RIG_MODE_FM, kHz(12)},
|
||||
{RIG_MODE_FM, kHz(8)},
|
||||
|
||||
RIG_FLT_END,
|
||||
},
|
||||
|
||||
.str_cal = FT736_STR_CAL,
|
||||
|
||||
.rig_open = ft736_open,
|
||||
.rig_close = ft736_close,
|
||||
|
||||
.set_freq = ft736_set_freq,
|
||||
.set_mode = ft736_set_mode,
|
||||
.set_ptt = ft736_set_ptt,
|
||||
.get_dcd = ft736_get_dcd,
|
||||
.get_level = ft736_get_level,
|
||||
|
||||
.set_split_vfo = ft736_set_split_vfo,
|
||||
.set_split_freq = ft736_set_split_freq,
|
||||
.set_split_mode = ft736_set_split_mode,
|
||||
|
||||
.set_rptr_shift = ft736_set_rptr_shift,
|
||||
.set_rptr_offs = ft736_set_rptr_offs,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* ft736_open routine
|
||||
*
|
||||
*/
|
||||
int ft736_open(RIG *rig)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n",__FUNCTION__);
|
||||
|
||||
/* send Ext Cntl ON: Activate CAT */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
|
||||
}
|
||||
|
||||
int ft736_close(RIG *rig)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x80, 0x80, 0x80, 0x80, 0x80};
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n",__FUNCTION__);
|
||||
|
||||
/* send Ext Cntl OFF: Deactivate CAT */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01};
|
||||
|
||||
/* store bcd format in cmd (MSB) */
|
||||
to_bcd_be(cmd,freq/10,8);
|
||||
|
||||
/* special case for 1.2GHz band */
|
||||
if (freq > GHz(1.2))
|
||||
cmd[0] = (cmd[0] & 0x0f) | 0xc0;
|
||||
|
||||
/* Frequency set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define MD_LSB 0x00
|
||||
#define MD_USB 0x01
|
||||
#define MD_CW 0x02
|
||||
#define MD_CWR 0x03
|
||||
#define MD_AM 0x04
|
||||
#define MD_FM 0x08
|
||||
|
||||
int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x07};
|
||||
unsigned char md;
|
||||
|
||||
|
||||
/*
|
||||
* translate mode from generic to ft736 specific
|
||||
*/
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW: md = MD_CW; break;
|
||||
case RIG_MODE_CWR: md = MD_CWR; break;
|
||||
case RIG_MODE_USB: md = MD_USB; break;
|
||||
case RIG_MODE_LSB: md = MD_LSB; break;
|
||||
case RIG_MODE_FM: md = MD_FM; break;
|
||||
case RIG_MODE_AM: md = MD_AM; break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE */
|
||||
}
|
||||
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width < rig_passband_normal(rig, mode)) {
|
||||
md |= 0x80;
|
||||
}
|
||||
|
||||
cmd[0] = md;
|
||||
|
||||
/* Mode set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ft736_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x8e};
|
||||
|
||||
/*
|
||||
* this can be misleading as Yeasu call it "Full duplex"
|
||||
* or "sat mode", and split Yaesu terms is repeater shift.
|
||||
*/
|
||||
cmd[4] = split == RIG_SPLIT_ON ? 0x0e : 0x8e;
|
||||
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
int ft736_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x1e};
|
||||
|
||||
/* store bcd format in cmd (MSB) */
|
||||
to_bcd_be(cmd,freq/10,8);
|
||||
|
||||
/* special case for 1.2GHz band */
|
||||
if (freq > GHz(1.2))
|
||||
cmd[0] = (cmd[0] & 0x0f) | 0xc0;
|
||||
|
||||
/* Frequency set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
int ft736_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x27};
|
||||
unsigned char md;
|
||||
|
||||
|
||||
/*
|
||||
* translate mode from generic to ft736 specific
|
||||
*/
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW: md = MD_CW; break;
|
||||
case RIG_MODE_CWR: md = MD_CWR; break;
|
||||
case RIG_MODE_USB: md = MD_USB; break;
|
||||
case RIG_MODE_LSB: md = MD_LSB; break;
|
||||
case RIG_MODE_FM: md = MD_FM; break;
|
||||
case RIG_MODE_AM: md = MD_AM; break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE */
|
||||
}
|
||||
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width < rig_passband_normal(rig, mode)) {
|
||||
md |= 0x80;
|
||||
}
|
||||
|
||||
cmd[0] = md;
|
||||
|
||||
/* Mode set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int ft736_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x88};
|
||||
|
||||
cmd[4] = ptt == RIG_PTT_ON ? 0x08 : 0x88;
|
||||
|
||||
/* Tx/Rx set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
int ft736_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xe7};
|
||||
int retval;
|
||||
|
||||
serial_flush(&rig->state.rigport);
|
||||
|
||||
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
/* read back the 1 byte */
|
||||
retval = read_block(&rig->state.rigport, cmd, 5);
|
||||
|
||||
if (retval < 1) {
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: read squelch failed %d\n",
|
||||
__FUNCTION__,retval);
|
||||
|
||||
return retval < 0 ? retval : -RIG_EIO;
|
||||
}
|
||||
*dcd = cmd[0] == 0x00 ? RIG_DCD_OFF : RIG_DCD_ON;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
int ft736_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xf7};
|
||||
int retval;
|
||||
|
||||
if (level != RIG_LEVEL_RAWSTR)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
serial_flush(&rig->state.rigport);
|
||||
|
||||
/* send Test S-meter cmd to rig */
|
||||
retval = write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
/* read back the 1 byte */
|
||||
retval = read_block(&rig->state.rigport, cmd, 5);
|
||||
|
||||
if (retval < 1) {
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: read meter failed %d\n",
|
||||
__FUNCTION__,retval);
|
||||
|
||||
return retval < 0 ? retval : -RIG_EIO;
|
||||
}
|
||||
val->i = cmd[0];
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ft736_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x88};
|
||||
|
||||
switch (shift) {
|
||||
case RIG_RPT_SHIFT_NONE:
|
||||
cmd[4] = 0x88;
|
||||
break;
|
||||
case RIG_RPT_SHIFT_MINUS:
|
||||
cmd[4] = 0x09;
|
||||
break;
|
||||
case RIG_RPT_SHIFT_PLUS:
|
||||
cmd[4] = 0x49;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
int ft736_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xf9};
|
||||
|
||||
/* store bcd format in cmd (MSB) */
|
||||
to_bcd_be(cmd,offs,8);
|
||||
|
||||
/* Offset set */
|
||||
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* via serial interface to a Yaesu rig
|
||||
*
|
||||
*
|
||||
* $Id: yaesu.c,v 1.20 2004-08-08 19:15:31 fillods Exp $
|
||||
* $Id: yaesu.c,v 1.21 2004-08-10 21:08:41 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -51,6 +51,7 @@ DECLARE_INITRIG_BACKEND(yaesu)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "yaesu: %s called\n", __func__);
|
||||
|
||||
rig_register(&ft100_caps);
|
||||
rig_register(&ft736_caps);
|
||||
rig_register(&ft747_caps);
|
||||
rig_register(&ft757gx_caps);
|
||||
rig_register(&ft757gx2_caps);
|
||||
|
@ -63,7 +64,9 @@ DECLARE_INITRIG_BACKEND(yaesu)
|
|||
rig_register(&ft920_caps);
|
||||
rig_register(&ft990_caps);
|
||||
rig_register(&ft1000mp_caps);
|
||||
rig_register(&frg100_caps);
|
||||
rig_register(&frg8800_caps);
|
||||
rig_register(&frg9600_caps);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* Common yaesu declarations for hamlib
|
||||
*
|
||||
* $Id: yaesu.h,v 1.22 2004-08-08 19:15:31 fillods Exp $
|
||||
* $Id: yaesu.h,v 1.23 2004-08-10 21:08:42 fillods Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -48,6 +48,7 @@ struct yaesu_cmd_set {
|
|||
typedef struct yaesu_cmd_set yaesu_cmd_set_t;
|
||||
|
||||
extern const struct rig_caps ft100_caps;
|
||||
extern const struct rig_caps ft736_caps;
|
||||
extern const struct rig_caps ft747_caps;
|
||||
extern const struct rig_caps ft757gx_caps;
|
||||
extern const struct rig_caps ft757gx2_caps;
|
||||
|
@ -60,6 +61,8 @@ extern const struct rig_caps ft900_caps;
|
|||
extern const struct rig_caps ft920_caps;
|
||||
extern const struct rig_caps ft990_caps;
|
||||
extern const struct rig_caps ft1000mp_caps;
|
||||
extern const struct rig_caps frg100_caps;
|
||||
extern const struct rig_caps frg8800_caps;
|
||||
extern const struct rig_caps frg9600_caps;
|
||||
|
||||
#endif /* _YAESU_H */
|
||||
|
|
Ładowanie…
Reference in New Issue