2001-01-04 05:39:03 +00:00
|
|
|
/*
|
|
|
|
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
|
2010-03-27 23:12:29 +00:00
|
|
|
* (C) Stephane Fillod 2000-2010
|
2001-01-04 05:39:03 +00:00
|
|
|
*
|
|
|
|
* ft747.c - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
|
|
|
|
* This shared library provides an API for communicating
|
|
|
|
* via serial interface to an FT-747GX using the "CAT" interface
|
|
|
|
* box (FIF-232C) or similar
|
|
|
|
*
|
|
|
|
*
|
2011-08-23 02:26:44 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2002-12-01 03:08:05 +00:00
|
|
|
*
|
2011-08-23 02:26:44 +00:00
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
2002-12-01 03:08:05 +00:00
|
|
|
*
|
2011-08-23 02:26:44 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2002-12-01 03:08:05 +00:00
|
|
|
*
|
2001-01-04 05:39:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO - FS
|
|
|
|
*
|
2010-03-28 21:35:32 +00:00
|
|
|
* 1. rationalise code, more helper functions [started]
|
|
|
|
* 2. get_channel, set_func/get_func
|
2001-01-04 05:39:03 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-02-04 13:41:36 +00:00
|
|
|
#include <hamlib/config.h>
|
2003-04-07 22:42:11 +00:00
|
|
|
|
2001-01-04 05:39:03 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h> /* String function definitions */
|
|
|
|
|
2003-04-07 22:42:11 +00:00
|
|
|
#include "hamlib/rig.h"
|
2001-01-04 05:39:03 +00:00
|
|
|
#include "serial.h"
|
|
|
|
#include "misc.h"
|
2001-01-04 07:03:58 +00:00
|
|
|
#include "yaesu.h"
|
|
|
|
#include "ft747.h"
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2021-09-04 19:37:28 +00:00
|
|
|
/*
|
|
|
|
* Native FT747 functions. This is what I have to work with :-)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-11-28 18:41:10 +00:00
|
|
|
enum ft747_native_cmd_e
|
|
|
|
{
|
|
|
|
FT_747_NATIVE_SPLIT_OFF = 0,
|
|
|
|
FT_747_NATIVE_SPLIT_ON,
|
|
|
|
FT_747_NATIVE_RECALL_MEM,
|
|
|
|
FT_747_NATIVE_VFO_TO_MEM,
|
|
|
|
FT_747_NATIVE_DLOCK_OFF,
|
|
|
|
FT_747_NATIVE_DLOCK_ON,
|
|
|
|
FT_747_NATIVE_VFO_A,
|
|
|
|
FT_747_NATIVE_VFO_B,
|
|
|
|
FT_747_NATIVE_M_TO_VFO,
|
|
|
|
FT_747_NATIVE_UP_500K,
|
|
|
|
FT_747_NATIVE_DOWN_500K,
|
|
|
|
FT_747_NATIVE_CLARIFY_OFF,
|
|
|
|
FT_747_NATIVE_CLARIFY_ON,
|
|
|
|
FT_747_NATIVE_FREQ_SET,
|
|
|
|
FT_747_NATIVE_MODE_SET_LSB,
|
|
|
|
FT_747_NATIVE_MODE_SET_USB,
|
|
|
|
FT_747_NATIVE_MODE_SET_CWW,
|
|
|
|
FT_747_NATIVE_MODE_SET_CWN,
|
|
|
|
FT_747_NATIVE_MODE_SET_AMW,
|
|
|
|
FT_747_NATIVE_MODE_SET_AMN,
|
|
|
|
FT_747_NATIVE_MODE_SET_FMW,
|
|
|
|
FT_747_NATIVE_MODE_SET_FMN,
|
|
|
|
FT_747_NATIVE_PACING,
|
|
|
|
FT_747_NATIVE_PTT_OFF,
|
|
|
|
FT_747_NATIVE_PTT_ON,
|
|
|
|
FT_747_NATIVE_UPDATE,
|
|
|
|
FT_747_NATIVE_SIZE /* end marker, value indicates number of */
|
|
|
|
/* native cmd entries */
|
2021-09-04 19:37:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum ft747_native_cmd_e ft747_native_cmd_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Internal MODES - when setting modes via cmd_mode_set() */
|
|
|
|
|
|
|
|
#define MODE_SET_LSB 0x00
|
|
|
|
#define MODE_SET_USB 0x01
|
|
|
|
#define MODE_SET_CWW 0x02
|
|
|
|
#define MODE_SET_CWN 0x03
|
|
|
|
#define MODE_SET_AMW 0x04
|
|
|
|
#define MODE_SET_AMN 0x05
|
|
|
|
#define MODE_SET_FMW 0x06
|
|
|
|
#define MODE_SET_FMN 0x07
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mode Bitmap. Bits 5 and 6 unused
|
|
|
|
* When READING modes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define MODE_FM 0x01
|
|
|
|
#define MODE_AM 0x02
|
|
|
|
#define MODE_CW 0x04
|
|
|
|
#define MODE_FMN 0x81
|
|
|
|
#define MODE_AMN 0x82
|
|
|
|
#define MODE_CWN 0x84
|
|
|
|
#define MODE_USB 0x08
|
|
|
|
#define MODE_LSB 0x10
|
|
|
|
#define MODE_NAR 0x80
|
|
|
|
|
|
|
|
/* All relevant bits */
|
|
|
|
#define MODE_MASK 0x9f
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Status Flag Masks when reading
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SF_DLOCK 0x01
|
|
|
|
#define SF_SPLIT 0x02
|
|
|
|
#define SF_CLAR 0x04
|
|
|
|
#define SF_VFOAB 0x08
|
|
|
|
#define SF_VFOMR 0x10
|
|
|
|
#define SF_RXTX 0x20
|
|
|
|
#define SF_RESV 0x40
|
|
|
|
#define SF_PRI 0x80
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local VFO CMD's, according to spec
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define FT747_VFO_A 0x00
|
|
|
|
#define FT747_VFO_B 0x01
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some useful offsets in the status update map (offset)
|
|
|
|
*
|
|
|
|
* Manual appears to be full of mistakes regarding offsets etc.. -- FS
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define FT747_SUMO_DISPLAYED_MEM 0x17
|
|
|
|
#define FT747_SUMO_DISPLAYED_MODE 0x18
|
|
|
|
#define FT747_SUMO_DISPLAYED_STATUS 0x00
|
|
|
|
#define FT747_SUMO_DISPLAYED_FREQ 0x01
|
2022-08-18 22:03:17 +00:00
|
|
|
#define FT747_SUMO_VFO_A_FREQ 0x09
|
|
|
|
#define FT747_SUMO_VFO_B_FREQ 0x11
|
2021-09-04 19:37:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* API local implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int ft747_init(RIG *rig);
|
|
|
|
static int ft747_cleanup(RIG *rig);
|
|
|
|
static int ft747_open(RIG *rig);
|
|
|
|
static int ft747_close(RIG *rig);
|
|
|
|
|
|
|
|
static int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
|
|
|
static int ft747_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
|
|
|
|
|
2021-11-28 18:41:10 +00:00
|
|
|
static int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
|
|
|
|
pbwidth_t width); /* select mode */
|
|
|
|
static int ft747_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
|
|
|
|
pbwidth_t *width); /* get mode */
|
2021-09-04 19:37:28 +00:00
|
|
|
|
|
|
|
static int ft747_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */
|
|
|
|
static int ft747_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */
|
|
|
|
|
|
|
|
static int ft747_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
|
|
|
|
|
|
|
|
static int ft747_set_split(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
|
|
|
|
static int ft747_get_split(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
|
|
|
|
|
|
|
|
static int ft747_set_mem(RIG *rig, vfo_t vfo, int ch);
|
|
|
|
static int ft747_get_mem(RIG *rig, vfo_t vfo, int *ch);
|
|
|
|
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2001-01-05 02:03:33 +00:00
|
|
|
/* Private helper function prototypes */
|
2001-01-04 05:39:03 +00:00
|
|
|
|
|
|
|
static int ft747_get_update_data(RIG *rig);
|
2001-01-05 02:03:33 +00:00
|
|
|
static int ft747_send_priv_cmd(RIG *rig, unsigned char ci);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
|
|
|
/* Native ft747 cmd set prototypes. These are READ ONLY as each */
|
|
|
|
/* rig instance will copy from these and modify if required . */
|
|
|
|
/* Complete sequences (1) can be read and used directly as a cmd sequence . */
|
|
|
|
/* Incomplete sequences (0) must be completed with extra parameters */
|
|
|
|
/* eg: mem number, or freq etc.. */
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
static const yaesu_cmd_set_t ft747_ncmd[] =
|
|
|
|
{
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */
|
|
|
|
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory*/
|
|
|
|
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* vfo to memory*/
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x04 } }, /* dial lock = off */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x04 } }, /* dial lock = on */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */
|
|
|
|
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* memory to vfo*/
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* up 500 khz */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* down 500 khz */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* clarify off */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, /* clarify on */
|
|
|
|
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set freq */
|
|
|
|
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* mode set LSB */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* mode set USB */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* mode set CWW */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* mode set CWN */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* mode set AMW */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* mode set AMN */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* mode set FMW */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x07, 0x0c } }, /* mode set FMN */
|
|
|
|
|
|
|
|
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* pacing set */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* ptt off */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* ptt on */
|
|
|
|
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x10 } }, /* request update from rig */
|
2001-01-04 05:39:03 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-23 02:26:44 +00:00
|
|
|
/*
|
|
|
|
* Receiver caps
|
2001-01-04 05:39:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#define FT747_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB)
|
|
|
|
#define FT747_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB)
|
|
|
|
#define FT747_AM_RX_MODES (RIG_MODE_AM)
|
|
|
|
#define FT747_FM_RX_MODES (RIG_MODE_FM)
|
|
|
|
|
|
|
|
|
2011-08-23 02:26:44 +00:00
|
|
|
/*
|
2001-01-04 05:39:03 +00:00
|
|
|
* TX caps
|
2011-08-23 02:26:44 +00:00
|
|
|
*/
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
#define FT747_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB ) /* 100 W class */
|
2001-01-04 05:39:03 +00:00
|
|
|
#define FT747_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */
|
|
|
|
|
2010-03-28 21:35:32 +00:00
|
|
|
/*
|
|
|
|
* no opcode for RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN
|
|
|
|
* TODO: LOCK
|
|
|
|
*/
|
|
|
|
#define FT747_FUNC_ALL (RIG_FUNC_LOCK)
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2001-05-06 01:34:25 +00:00
|
|
|
|
2011-08-23 02:26:44 +00:00
|
|
|
#define FT747_VFOS (RIG_VFO_A|RIG_VFO_B)
|
2001-05-06 01:34:25 +00:00
|
|
|
|
|
|
|
/*
|
2010-03-28 21:35:32 +00:00
|
|
|
* FT747 channel caps.
|
|
|
|
* Last 2 channels don't have split memory
|
|
|
|
*/
|
|
|
|
#define FT747_SPLIT_MEM_CAP { \
|
|
|
|
.freq = 1, \
|
|
|
|
.mode = 1, \
|
|
|
|
.width = 1, \
|
|
|
|
.split = 1, \
|
|
|
|
.tx_freq = 1, \
|
|
|
|
.tx_mode = 1, \
|
|
|
|
.tx_width = 1, \
|
|
|
|
.funcs = RIG_FUNC_LOCK, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define FT747_NOSPLIT_MEM_CAP { \
|
|
|
|
.freq = 1, \
|
|
|
|
.mode = 1, \
|
|
|
|
.width = 1, \
|
|
|
|
.funcs = RIG_FUNC_LOCK, \
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Private data
|
2001-05-06 01:34:25 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
struct ft747_priv_data
|
|
|
|
{
|
|
|
|
unsigned char
|
|
|
|
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
|
|
|
|
unsigned char update_data[FT747_STATUS_UPDATE_DATA_LENGTH]; /* returned data */
|
|
|
|
struct timeval status_tv;
|
2001-05-06 01:34:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-01-04 05:39:03 +00:00
|
|
|
/*
|
|
|
|
* ft747 rigs capabilities.
|
|
|
|
* Also this struct is READONLY!
|
|
|
|
*/
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
const struct rig_caps ft747_caps =
|
|
|
|
{
|
2020-03-05 14:44:18 +00:00
|
|
|
RIG_MODEL(RIG_MODEL_FT747),
|
2019-11-30 16:19:08 +00:00
|
|
|
.model_name = "FT-747GX",
|
|
|
|
.mfg_name = "Yaesu",
|
2022-08-19 13:33:31 +00:00
|
|
|
.version = "20220819.1",
|
2019-11-30 16:19:08 +00:00
|
|
|
.copyright = "LGPL",
|
2021-09-15 18:50:31 +00:00
|
|
|
.status = RIG_STATUS_STABLE,
|
2019-11-30 16:19:08 +00:00
|
|
|
.rig_type = RIG_TYPE_MOBILE,
|
|
|
|
.ptt_type = RIG_PTT_RIG,
|
|
|
|
.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 = FT747_WRITE_DELAY,
|
|
|
|
.post_write_delay = FT747_POST_WRITE_DELAY,
|
|
|
|
.timeout = 2000,
|
|
|
|
.retry = 0,
|
|
|
|
.has_get_func = FT747_FUNC_ALL,
|
|
|
|
.has_set_func = FT747_FUNC_ALL,
|
2022-01-29 22:25:18 +00:00
|
|
|
.has_get_level = RIG_LEVEL_BAND_SELECT,
|
|
|
|
.has_set_level = RIG_LEVEL_BAND_SELECT,
|
2019-11-30 16:19:08 +00:00
|
|
|
.has_get_parm = RIG_PARM_NONE,
|
|
|
|
.has_set_parm = RIG_PARM_NONE,
|
|
|
|
.ctcss_list = NULL,
|
|
|
|
.dcs_list = NULL,
|
|
|
|
.preamp = { RIG_DBLST_END, },
|
|
|
|
.attenuator = { RIG_DBLST_END, },
|
|
|
|
.max_rit = Hz(0), /* 9999 */
|
|
|
|
.max_xit = Hz(0),
|
|
|
|
.max_ifshift = Hz(0),
|
2022-08-19 20:39:21 +00:00
|
|
|
.targetable_vfo = RIG_TARGETABLE_FREQ,
|
2019-11-30 16:19:08 +00:00
|
|
|
.transceive = RIG_TRN_OFF,
|
|
|
|
.bank_qty = 0,
|
|
|
|
.chan_desc_sz = 0,
|
|
|
|
.chan_list = {
|
|
|
|
{ 0, 17, RIG_MTYPE_MEM, FT747_SPLIT_MEM_CAP },
|
|
|
|
{ 18, 19, RIG_MTYPE_MEM, FT747_NOSPLIT_MEM_CAP },
|
|
|
|
RIG_CHAN_END,
|
|
|
|
},
|
|
|
|
|
2022-08-19 20:39:21 +00:00
|
|
|
.rx_range_list1 = { {
|
2019-11-30 16:19:08 +00:00
|
|
|
.startf = kHz(100), .endf = 29999900,
|
|
|
|
.modes = FT747_ALL_RX_MODES, .low_power = -1, .high_power = -1, .vfo = FT747_VFOS
|
|
|
|
},
|
|
|
|
RIG_FRNG_END,
|
|
|
|
}, /* rx range */
|
|
|
|
|
2022-08-19 20:39:21 +00:00
|
|
|
.tx_range_list1 = { {kHz(1500), 1999900, FT747_OTHER_TX_MODES, .low_power = 5000, .high_power = 100000, .vfo = FT747_VFOS}, /* 100W class */
|
2019-11-30 16:19:08 +00:00
|
|
|
|
|
|
|
{.startf = kHz(1500), .endf = 1999900, FT747_AM_TX_MODES, .low_power = 2000, .high_power = 25000, .vfo = FT747_VFOS}, /* 25W class */
|
|
|
|
|
|
|
|
{.startf = kHz(3500), 3999900, FT747_OTHER_TX_MODES, 5000, 100000, FT747_VFOS},
|
|
|
|
{.startf = kHz(3500), 3999900, FT747_AM_TX_MODES, 2000, 25000, FT747_VFOS},
|
|
|
|
|
|
|
|
{.startf = kHz(7000), 7499900, FT747_OTHER_TX_MODES, 5000, 100000, FT747_VFOS},
|
|
|
|
{.startf = kHz(7000), 7499900, FT747_AM_TX_MODES, 2000, 25000, FT747_VFOS},
|
|
|
|
|
|
|
|
{.startf = MHz(10), 10499900, FT747_OTHER_TX_MODES, 5000, 100000, FT747_VFOS},
|
|
|
|
{.startf = MHz(10), 10499900, FT747_AM_TX_MODES, 2000, 25000, FT747_VFOS},
|
|
|
|
|
|
|
|
{.startf = MHz(14), 14499900, FT747_OTHER_TX_MODES, 5000, 100000, FT747_VFOS},
|
|
|
|
{.startf = MHz(14), 14499900, FT747_AM_TX_MODES, 2000, 25000, FT747_VFOS},
|
|
|
|
|
|
|
|
{.startf = MHz(18), 18499900, FT747_OTHER_TX_MODES, 5000, 100000, FT747_VFOS},
|
|
|
|
{.startf = MHz(18), 18499900, FT747_AM_TX_MODES, 2000, 25000, FT747_VFOS},
|
|
|
|
|
|
|
|
{.startf = MHz(21), 21499900, FT747_OTHER_TX_MODES, 5000, 100000, FT747_VFOS},
|
|
|
|
{.startf = MHz(21), 21499900, FT747_AM_TX_MODES, 2000, 25000, FT747_VFOS},
|
|
|
|
|
|
|
|
{.startf = kHz(24500), 24999900, FT747_OTHER_TX_MODES, 5000, 100000, FT747_VFOS},
|
|
|
|
{.startf = kHz(24500), 24999900, FT747_AM_TX_MODES, 2000, 25000, FT747_VFOS},
|
|
|
|
|
|
|
|
{.startf = MHz(28), 29999900, FT747_OTHER_TX_MODES, 5000, 100000, FT747_VFOS},
|
|
|
|
{.startf = MHz(28), 29999900, FT747_AM_TX_MODES, 2000, 25000, FT747_VFOS},
|
|
|
|
|
|
|
|
RIG_FRNG_END,
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.tuning_steps = { {FT747_SSB_CW_RX_MODES, 25}, /* fast off */
|
|
|
|
{FT747_SSB_CW_RX_MODES, 2500}, /* fast on */
|
|
|
|
|
|
|
|
{FT747_AM_RX_MODES, kHz(1)}, /* fast off */
|
|
|
|
{FT747_AM_RX_MODES, kHz(10)}, /* fast on */
|
|
|
|
|
|
|
|
{FT747_FM_RX_MODES, kHz(5)}, /* fast off */
|
|
|
|
{FT747_FM_RX_MODES, 12500}, /* fast on */
|
|
|
|
|
|
|
|
RIG_TS_END,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* mode/filter list, .remember = order matters! */
|
|
|
|
|
|
|
|
.filters = { {RIG_MODE_SSB, kHz(2.2)}, /* standard SSB filter bandwidth */
|
|
|
|
{RIG_MODE_CW, kHz(1.8)}, /* normal CW filter */
|
|
|
|
{RIG_MODE_CW, kHz(0.5)}, /* CW filter with narrow selection */
|
|
|
|
{RIG_MODE_AM, kHz(6)}, /* normal AM filter */
|
|
|
|
{RIG_MODE_AM, kHz(2.4)}, /* AM filter with narrow selection */
|
|
|
|
{RIG_MODE_FM, kHz(19)}, /* FM wide filter, with optional FM unit. */
|
|
|
|
{RIG_MODE_FM, kHz(8)}, /* FM with optional FM unit */
|
|
|
|
|
|
|
|
RIG_FLT_END,
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
.priv = NULL, /* private data */
|
|
|
|
|
|
|
|
.rig_init = ft747_init,
|
|
|
|
.rig_cleanup = ft747_cleanup,
|
|
|
|
.rig_open = ft747_open, /* port opened */
|
|
|
|
.rig_close = ft747_close, /* port closed */
|
|
|
|
|
|
|
|
.set_freq = ft747_set_freq, /* set freq */
|
|
|
|
.get_freq = ft747_get_freq, /* get freq */
|
|
|
|
.set_mode = ft747_set_mode, /* set mode */
|
|
|
|
.get_mode = ft747_get_mode, /* get mode */
|
|
|
|
.set_vfo = ft747_set_vfo, /* set vfo */
|
|
|
|
.get_vfo = ft747_get_vfo, /* get vfo */
|
|
|
|
.set_split_vfo = ft747_set_split, /* set split */
|
|
|
|
.get_split_vfo = ft747_get_split, /* get split */
|
|
|
|
.set_ptt = ft747_set_ptt, /* set ptt */
|
|
|
|
.set_mem = ft747_set_mem, /* set mem */
|
|
|
|
.get_mem = ft747_get_mem, /* get mem */
|
2022-02-11 17:44:18 +00:00
|
|
|
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
|
2001-01-04 05:39:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2011-08-23 02:26:44 +00:00
|
|
|
* _init
|
2001-01-04 05:39:03 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_init(RIG *rig)
|
|
|
|
{
|
2020-02-23 17:26:09 +00:00
|
|
|
rig->state.priv = (struct ft747_priv_data *) calloc(1,
|
|
|
|
sizeof(struct ft747_priv_data));
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2020-01-13 18:48:30 +00:00
|
|
|
if (!rig->state.priv) /* whoops! memory shortage! */
|
2019-11-30 16:19:08 +00:00
|
|
|
{
|
|
|
|
return -RIG_ENOMEM;
|
|
|
|
}
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return RIG_OK;
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ft747_cleanup routine
|
|
|
|
* the serial port is closed by the frontend
|
|
|
|
*/
|
2001-01-04 07:03:58 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_cleanup(RIG *rig)
|
|
|
|
{
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (rig->state.priv)
|
|
|
|
{
|
|
|
|
free(rig->state.priv);
|
|
|
|
}
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig->state.priv = NULL;
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return RIG_OK;
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ft747_open routine
|
2011-08-23 02:26:44 +00:00
|
|
|
*
|
2001-01-04 05:39:03 +00:00
|
|
|
*/
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_open(RIG *rig)
|
|
|
|
{
|
|
|
|
struct rig_state *rig_s;
|
|
|
|
struct ft747_priv_data *p;
|
|
|
|
int ret;
|
|
|
|
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_s = &rig->state;
|
|
|
|
p = (struct ft747_priv_data *)rig_s->priv;
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "ft747:rig_open: write_delay = %i msec \n",
|
2022-01-25 23:41:26 +00:00
|
|
|
rig_s->rigport.write_delay);
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "ft747:rig_open: post_write_delay = %i msec \n",
|
2022-01-25 23:41:26 +00:00
|
|
|
rig_s->rigport.post_write_delay);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
/*
|
|
|
|
* Copy native cmd PACING to private cmd storage area
|
|
|
|
*/
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
memcpy(&p->p_cmd, &ft747_ncmd[FT_747_NATIVE_PACING].nseq, YAESU_CMD_LENGTH);
|
|
|
|
p->p_cmd[3] =
|
|
|
|
FT747_PACING_DEFAULT_VALUE; /* get pacing value, and store in private cmd */
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "ft747: read pacing = %i \n",
|
|
|
|
FT747_PACING_DEFAULT_VALUE);
|
2010-03-27 23:12:29 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
/* send PACING cmd to rig, once for all */
|
2010-03-27 23:12:29 +00:00
|
|
|
|
2022-01-25 23:41:26 +00:00
|
|
|
ret = write_block(&rig->state.rigport, p->p_cmd, YAESU_CMD_LENGTH);
|
2010-03-27 23:12:29 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_force_cache_timeout(&p->status_tv);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return RIG_OK;
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ft747_close routine
|
2011-08-23 02:26:44 +00:00
|
|
|
*
|
2001-01-04 05:39:03 +00:00
|
|
|
*/
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_close(RIG *rig)
|
|
|
|
{
|
2001-01-05 02:03:33 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return RIG_OK;
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Example of wrapping backend function inside frontend API
|
2011-08-23 02:26:44 +00:00
|
|
|
*
|
2001-01-04 05:39:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|
|
|
{
|
|
|
|
struct ft747_priv_data *p;
|
|
|
|
unsigned char *cmd; /* points to sequence to send */
|
2020-03-23 15:13:02 +00:00
|
|
|
// cppcheck-suppress *
|
|
|
|
char *fmt = "%s: requested freq after conversion = %"PRIll" Hz \n";
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
p = (struct ft747_priv_data *)rig->state.priv;
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2022-08-21 03:56:04 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE,
|
|
|
|
"ft747: requested freq = %"PRIfreq" Hz vfo = %s \n", freq, rig_strvfo(vfo));
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
/*
|
|
|
|
* Copy native cmd freq_set to private cmd storage area
|
|
|
|
*/
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
memcpy(&p->p_cmd, &ft747_ncmd[FT_747_NATIVE_FREQ_SET].nseq, YAESU_CMD_LENGTH);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
/* store bcd format in p_cmd (LSB), round to nearest 10 Hz even
|
|
|
|
though the rig will internally then round to 25 Hz steps */
|
|
|
|
to_bcd(p->p_cmd, (freq + 5) / 10, 8);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2020-03-23 15:13:02 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, fmt, __func__, (int64_t)from_bcd(p->p_cmd,
|
|
|
|
8) * 10);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_force_cache_timeout(&p->status_tv);
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
cmd = p->p_cmd; /* get native sequence */
|
2022-01-25 23:41:26 +00:00
|
|
|
return write_block(&rig->state.rigport, cmd, YAESU_CMD_LENGTH);
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return Freq for a given VFO
|
|
|
|
*/
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|
|
|
{
|
|
|
|
struct ft747_priv_data *p;
|
|
|
|
freq_t f;
|
|
|
|
int ret;
|
|
|
|
|
2022-08-21 03:56:04 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE,
|
|
|
|
"%s: called vfo=%s, freqMainA=%.0f, freqMainB=%.0f\n", __func__,
|
|
|
|
rig_strvfo(vfo), rig->state.cache.freqMainA, rig->state.cache.freqMainB);
|
2019-11-30 16:19:08 +00:00
|
|
|
|
2022-08-21 03:56:04 +00:00
|
|
|
if (vfo == RIG_VFO_CURR) { vfo = rig->state.cache.vfo; }
|
|
|
|
|
|
|
|
if (rig->state.cache.ptt == RIG_PTT_ON)
|
2022-08-19 11:58:03 +00:00
|
|
|
{
|
2022-08-21 03:56:04 +00:00
|
|
|
*freq = RIG_VFO_B ? rig->state.cache.freqMainB : rig->state.cache.freqMainA;
|
2022-08-19 11:58:03 +00:00
|
|
|
return RIG_OK;
|
|
|
|
}
|
2019-11-30 16:19:08 +00:00
|
|
|
|
2022-08-18 22:33:41 +00:00
|
|
|
p = (struct ft747_priv_data *)rig->state.priv;
|
2019-11-30 16:19:08 +00:00
|
|
|
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2022-03-23 04:06:32 +00:00
|
|
|
// the leading 2 bytes are zero so we just use 4 bytes for the freq
|
2019-11-30 16:19:08 +00:00
|
|
|
switch (vfo)
|
|
|
|
{
|
|
|
|
case RIG_VFO_CURR:
|
|
|
|
/* grab freq and convert */
|
2022-08-18 20:59:56 +00:00
|
|
|
f = from_bcd_be(&(p->update_data[FT747_SUMO_DISPLAYED_FREQ]), 8);
|
2019-11-30 16:19:08 +00:00
|
|
|
break;
|
2001-01-05 02:03:33 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
case RIG_VFO_A:
|
2022-08-18 20:59:56 +00:00
|
|
|
f = from_bcd_be(&(p->update_data[FT747_SUMO_VFO_A_FREQ]), 8);
|
2019-11-30 16:19:08 +00:00
|
|
|
break;
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
case RIG_VFO_B:
|
2022-08-18 20:59:56 +00:00
|
|
|
f = from_bcd_be(&(p->update_data[FT747_SUMO_VFO_B_FREQ]), 8);
|
2019-11-30 16:19:08 +00:00
|
|
|
break;
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
default:
|
|
|
|
return -RIG_EINVAL; /* sorry, wrong VFO */
|
|
|
|
}
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "ft747: freq = %"PRIfreq" Hz for VFO = %s\n",
|
|
|
|
f, rig_strvfo(vfo));
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2022-08-18 22:03:17 +00:00
|
|
|
(*freq) = f; /* return displayed frequency */
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return RIG_OK;
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* set mode : eg AM, CW etc for a given VFO
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|
|
|
{
|
|
|
|
unsigned char cmd_index; /* index of sequence to send */
|
|
|
|
pbwidth_t width_normal;
|
|
|
|
|
|
|
|
width_normal = rig_passband_normal(rig, mode);
|
|
|
|
|
|
|
|
if (width == RIG_PASSBAND_NORMAL)
|
|
|
|
{
|
|
|
|
width = width_normal;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* translate mode from generic to ft747 specific
|
|
|
|
*/
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: generic mode = %s \n", __func__,
|
|
|
|
rig_strrmode(mode));
|
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case RIG_MODE_AM:
|
|
|
|
if (width != RIG_PASSBAND_NOCHANGE
|
|
|
|
&& width < width_normal)
|
|
|
|
{
|
|
|
|
cmd_index = FT_747_NATIVE_MODE_SET_AMN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmd_index = FT_747_NATIVE_MODE_SET_AMW;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_MODE_CW:
|
|
|
|
if (width != RIG_PASSBAND_NOCHANGE
|
|
|
|
&& width < width_normal)
|
|
|
|
{
|
|
|
|
cmd_index = FT_747_NATIVE_MODE_SET_CWN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmd_index = FT_747_NATIVE_MODE_SET_CWW;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_MODE_USB:
|
|
|
|
cmd_index = FT_747_NATIVE_MODE_SET_USB;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_MODE_LSB:
|
|
|
|
cmd_index = FT_747_NATIVE_MODE_SET_LSB;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIG_MODE_FM:
|
|
|
|
if (width != RIG_PASSBAND_NOCHANGE
|
|
|
|
&& width < width_normal)
|
|
|
|
{
|
|
|
|
cmd_index = FT_747_NATIVE_MODE_SET_FMN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmd_index = FT_747_NATIVE_MODE_SET_FMW;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return -RIG_EINVAL; /* sorry, wrong MODE */
|
|
|
|
}
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "ft747: cmd_index = %i \n", cmd_index);
|
|
|
|
|
|
|
|
rig_force_cache_timeout(&((struct ft747_priv_data *)
|
|
|
|
rig->state.priv)->status_tv);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* phew! now send cmd to rig
|
|
|
|
*/
|
|
|
|
|
|
|
|
return ft747_send_priv_cmd(rig, cmd_index);
|
|
|
|
}
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2001-01-06 06:49:40 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|
|
|
{
|
|
|
|
struct ft747_priv_data *p;
|
|
|
|
unsigned char mymode; /* ft747 mode */
|
|
|
|
int ret;
|
2001-01-06 06:49:40 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
p = (struct ft747_priv_data *)rig->state.priv;
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
mymode = p->update_data[FT747_SUMO_DISPLAYED_MODE];
|
|
|
|
mymode &= MODE_MASK; /* mask out bits 5 and 6 */
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "ft747: mymode = %x \n", mymode);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* translate mode from ft747 to generic.
|
|
|
|
*/
|
|
|
|
|
|
|
|
switch (mymode & 0x1f)
|
|
|
|
{
|
|
|
|
case MODE_FM:
|
|
|
|
(*mode) = RIG_MODE_FM;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MODE_AM:
|
|
|
|
(*mode) = RIG_MODE_AM;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MODE_CW:
|
|
|
|
(*mode) = RIG_MODE_CW;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MODE_USB:
|
|
|
|
(*mode) = RIG_MODE_USB;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MODE_LSB:
|
|
|
|
(*mode) = RIG_MODE_LSB;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return -RIG_EPROTO; /* sorry, unknown mode */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mymode & MODE_NAR)
|
|
|
|
{
|
|
|
|
*width = rig_passband_narrow(rig, *mode);
|
|
|
|
}
|
2010-03-28 21:35:32 +00:00
|
|
|
else
|
2019-11-30 16:19:08 +00:00
|
|
|
{
|
|
|
|
*width = rig_passband_normal(rig, *mode);
|
|
|
|
}
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return RIG_OK;
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* set vfo and store requested vfo for later RIG_VFO_CURR
|
|
|
|
* requests.
|
|
|
|
*
|
|
|
|
*/
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_set_vfo(RIG *rig, vfo_t vfo)
|
|
|
|
{
|
|
|
|
struct ft747_priv_data *p;
|
|
|
|
unsigned char cmd_index; /* index of sequence to send */
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
p = (struct ft747_priv_data *)rig->state.priv;
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
switch (vfo)
|
|
|
|
{
|
2010-03-30 21:26:12 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
case RIG_VFO_VFO:
|
|
|
|
case RIG_VFO_CURR:
|
|
|
|
return RIG_OK;
|
|
|
|
|
|
|
|
case RIG_VFO_A:
|
|
|
|
cmd_index = FT_747_NATIVE_VFO_A;
|
|
|
|
break;
|
2010-03-30 21:26:12 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
case RIG_VFO_B:
|
|
|
|
cmd_index = FT_747_NATIVE_VFO_B;
|
|
|
|
break;
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
default:
|
|
|
|
return -RIG_EINVAL; /* sorry, wrong VFO */
|
|
|
|
}
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_force_cache_timeout(&p->status_tv);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return ft747_send_priv_cmd(rig, cmd_index);
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_get_vfo(RIG *rig, vfo_t *vfo)
|
|
|
|
{
|
|
|
|
struct ft747_priv_data *p;
|
|
|
|
unsigned char status; /* ft747 status flag */
|
|
|
|
int ret;
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
p = (struct ft747_priv_data *)rig->state.priv;
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
status = p->update_data[FT747_SUMO_DISPLAYED_STATUS];
|
|
|
|
status &= SF_VFOAB; /* check VFO bit*/
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "ft747: vfo status = %x \n", status);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
/*
|
|
|
|
* translate vfo status from ft747 to generic.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO = B\n", __func__);
|
|
|
|
(*vfo) = RIG_VFO_B;
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO = A\n", __func__);
|
|
|
|
(*vfo) = RIG_VFO_A;
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
2001-01-04 05:39:03 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_set_split(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|
|
|
{
|
|
|
|
unsigned char cmd_index; /* index of sequence to send */
|
2010-03-27 23:12:29 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
cmd_index = split == RIG_SPLIT_ON ? FT_747_NATIVE_SPLIT_ON :
|
|
|
|
FT_747_NATIVE_SPLIT_OFF;
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_force_cache_timeout(&((struct ft747_priv_data *)
|
|
|
|
rig->state.priv)->status_tv);
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return ft747_send_priv_cmd(rig, cmd_index);
|
2010-03-27 23:12:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_get_split(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
|
|
|
|
{
|
|
|
|
struct ft747_priv_data *p;
|
|
|
|
unsigned char status; /* ft747 status flag */
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
p = (struct ft747_priv_data *)rig->state.priv;
|
2010-03-27 23:12:29 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
2010-03-27 23:12:29 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
status = p->update_data[FT747_SUMO_DISPLAYED_STATUS];
|
2010-03-27 23:12:29 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (((status & SF_VFOAB) && (status & SF_RXTX)) ||
|
|
|
|
(!(status & SF_VFOAB) && !(status & SF_RXTX)))
|
|
|
|
{
|
|
|
|
*tx_vfo = RIG_VFO_B;
|
2022-03-27 12:24:05 +00:00
|
|
|
*split = RIG_SPLIT_ON;
|
2019-11-30 16:19:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*tx_vfo = RIG_VFO_A;
|
2022-03-27 12:24:05 +00:00
|
|
|
*split = RIG_SPLIT_OFF;
|
2019-11-30 16:19:08 +00:00
|
|
|
}
|
2010-03-27 23:12:29 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return RIG_OK;
|
2010-03-27 23:12:29 +00:00
|
|
|
}
|
|
|
|
|
2001-01-06 06:49:40 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|
|
|
{
|
|
|
|
unsigned char cmd_index; /* index of sequence to send */
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
switch (ptt)
|
|
|
|
{
|
|
|
|
case RIG_PTT_OFF:
|
|
|
|
cmd_index = FT_747_NATIVE_PTT_OFF;
|
|
|
|
break;
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
case RIG_PTT_ON:
|
|
|
|
cmd_index = FT_747_NATIVE_PTT_ON;
|
|
|
|
break;
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
default:
|
|
|
|
return -RIG_EINVAL; /* sorry, wrong VFO */
|
|
|
|
}
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_force_cache_timeout(&((struct ft747_priv_data *)
|
|
|
|
rig->state.priv)->status_tv);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* phew! now send cmd to rig
|
|
|
|
*/
|
|
|
|
|
|
|
|
return ft747_send_priv_cmd(rig, cmd_index);
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_set_mem(RIG *rig, vfo_t vfo, int ch)
|
|
|
|
{
|
|
|
|
struct ft747_priv_data *p;
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
p = (struct ft747_priv_data *)rig->state.priv;
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (ch < 0 || ch > 0x13)
|
|
|
|
{
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
/*
|
|
|
|
* Copy native cmd freq_set to private cmd storage area
|
|
|
|
*/
|
|
|
|
memcpy(&p->p_cmd, &ft747_ncmd[FT_747_NATIVE_RECALL_MEM].nseq, YAESU_CMD_LENGTH);
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
p->p_cmd[3] = ch;
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
rig_force_cache_timeout(&p->status_tv);
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2022-01-25 23:41:26 +00:00
|
|
|
return write_block(&rig->state.rigport, p->p_cmd, YAESU_CMD_LENGTH);
|
2010-03-28 21:35:32 +00:00
|
|
|
}
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
int ft747_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
|
|
|
{
|
|
|
|
struct ft747_priv_data *p;
|
|
|
|
unsigned char mem_nb;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
p = (struct ft747_priv_data *)rig->state.priv;
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
ret = ft747_get_update_data(rig); /* get whole shebang from rig */
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
mem_nb = p->update_data[FT747_SUMO_DISPLAYED_MEM];
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (mem_nb > 0x13)
|
|
|
|
{
|
|
|
|
return -RIG_EPROTO;
|
|
|
|
}
|
2011-08-23 02:26:44 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
*ch = mem_nb;
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
return RIG_OK;
|
2010-03-28 21:35:32 +00:00
|
|
|
}
|
|
|
|
|
2001-01-04 05:39:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* private helper function. Retrieves update data from rig.
|
2010-03-28 21:35:32 +00:00
|
|
|
* using buffer indicated in *priv struct.
|
2001-01-04 05:39:03 +00:00
|
|
|
*
|
|
|
|
* need to use this when doing ft747_get_* stuff
|
|
|
|
*/
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
static int ft747_get_update_data(RIG *rig)
|
|
|
|
{
|
|
|
|
hamlib_port_t *rigport;
|
|
|
|
struct ft747_priv_data *p;
|
2022-03-24 21:21:53 +00:00
|
|
|
//unsigned char last_byte;
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
p = (struct ft747_priv_data *)rig->state.priv;
|
2022-01-25 23:41:26 +00:00
|
|
|
rigport = &rig->state.rigport;
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2022-08-21 03:56:04 +00:00
|
|
|
if (rig->state.cache.ptt == RIG_PTT_ON
|
|
|
|
|| !rig_check_cache_timeout(&p->status_tv, FT747_CACHE_TIMEOUT))
|
2019-11-30 16:19:08 +00:00
|
|
|
{
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (!rig->state.transmit) /* rig doesn't respond in Tx mode */
|
|
|
|
{
|
2019-12-24 16:11:27 +00:00
|
|
|
int ret;
|
2022-03-24 21:21:53 +00:00
|
|
|
//int port_timeout;
|
2020-06-23 14:01:46 +00:00
|
|
|
rig_flush(rigport);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
/* send UPDATE command to fetch data*/
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
ret = ft747_send_priv_cmd(rig, FT_747_NATIVE_UPDATE);
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-12-18 21:49:45 +00:00
|
|
|
ret = read_block(rigport, p->update_data,
|
2019-11-30 16:19:08 +00:00
|
|
|
FT747_STATUS_UPDATE_DATA_LENGTH);
|
2017-08-07 13:39:57 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2001-01-04 05:39:03 +00:00
|
|
|
|
2022-03-24 21:21:53 +00:00
|
|
|
#if 0 // skip this extra byte -- we will flush it before doing a read
|
2019-11-30 16:19:08 +00:00
|
|
|
port_timeout = rigport->timeout;
|
2022-03-23 04:06:32 +00:00
|
|
|
rigport->timeout = 20; /* ms */
|
2019-11-30 16:19:08 +00:00
|
|
|
/* read sometimes-missing last byte (345th), but don't fail */
|
|
|
|
read_block(rigport, &last_byte, 1);
|
|
|
|
rigport->timeout = port_timeout;
|
2022-03-24 21:21:53 +00:00
|
|
|
#endif
|
2019-11-30 16:19:08 +00:00
|
|
|
}
|
2010-03-28 21:35:32 +00:00
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
/* update cache date */
|
|
|
|
gettimeofday(&p->status_tv, NULL);
|
|
|
|
|
|
|
|
return RIG_OK;
|
2001-01-04 05:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-05 02:03:33 +00:00
|
|
|
/*
|
|
|
|
* private helper function to send a private command
|
|
|
|
* sequence . Must only be complete sequences.
|
|
|
|
*/
|
|
|
|
|
2019-11-30 16:19:08 +00:00
|
|
|
static int ft747_send_priv_cmd(RIG *rig, unsigned char ci)
|
|
|
|
{
|
2021-12-18 21:49:45 +00:00
|
|
|
if (!ft747_ncmd[ci].ncomp)
|
2019-11-30 16:19:08 +00:00
|
|
|
{
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: attempt to send incomplete sequence\n",
|
|
|
|
__func__);
|
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2001-01-05 02:03:33 +00:00
|
|
|
|
2022-01-25 23:41:26 +00:00
|
|
|
return write_block(&rig->state.rigport, ft747_ncmd[ci].nseq, YAESU_CMD_LENGTH);
|
2001-01-05 02:03:33 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|