kopia lustrzana https://github.com/Hamlib/Hamlib
Fix get_mode and get_freq--had incorrect offsets and reported frequency
is in little endian order. Fix set_mode as CW Narrow was always selected regardless of bandwidth. Thanks Myron, KC0MLS. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2286 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.7
rodzic
4c51fc5b11
commit
58984001d0
294
yaesu/ft757gx.c
294
yaesu/ft757gx.c
|
@ -2,12 +2,14 @@
|
|||
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
|
||||
*
|
||||
* ft757gx.c - (C) Stephane Fillod 2004
|
||||
* (C) Nate Bargmann 2008
|
||||
*
|
||||
* This shared library provides an API for communicating
|
||||
* via serial interface to an FT-757GX using the "CAT" interface
|
||||
* box (FIF-232C) or similar
|
||||
* via serial interface to an FT-757GX/FT-757GXII using the
|
||||
* "CAT" interface box (FIF-232C) or similar.
|
||||
*
|
||||
*
|
||||
* $Id: ft757gx.c,v 1.4 2006-10-07 15:51:38 csete Exp $
|
||||
* $Id: ft757gx.c,v 1.5 2008-01-10 14:19:19 n0nb Exp $
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -51,70 +53,16 @@
|
|||
#include "ft757gx.h"
|
||||
|
||||
|
||||
static int ft757_init(RIG *rig);
|
||||
static int ft757_cleanup(RIG *rig);
|
||||
static int ft757_open(RIG *rig);
|
||||
|
||||
static int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||
static int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
|
||||
|
||||
static int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */
|
||||
static int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */
|
||||
|
||||
static int ft757_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */
|
||||
static int ft757_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */
|
||||
|
||||
static int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
|
||||
static int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||
|
||||
|
||||
|
||||
/* Private helper function prototypes */
|
||||
|
||||
static int ft757_get_update_data(RIG *rig);
|
||||
static int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width);
|
||||
static int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width);
|
||||
|
||||
|
||||
/*
|
||||
* Some useful offsets in the status update map (offset)
|
||||
*
|
||||
* Status Update Chart, FT757GXII
|
||||
*/
|
||||
#define STATUS_CURR_FREQ 6 /* Operating Frequency */
|
||||
#define STATUS_CURR_MODE 10
|
||||
#define STATUS_VFOA_FREQ 11
|
||||
#define STATUS_VFOA_MODE 15
|
||||
#define STATUS_VFOB_FREQ 16
|
||||
#define STATUS_VFOB_MODE 20
|
||||
|
||||
|
||||
#define MODE_LSB 0x0
|
||||
#define MODE_USB 0x1
|
||||
#define MODE_CWW 0x2
|
||||
#define MODE_CWN 0x3
|
||||
#define MODE_AM 0x4
|
||||
#define MODE_FM 0x5
|
||||
|
||||
/*
|
||||
* Receiver caps
|
||||
*/
|
||||
|
||||
#define FT757GX_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM)
|
||||
|
||||
|
||||
/*
|
||||
* TX caps
|
||||
*/
|
||||
|
||||
#define FT757GX_ALL_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM)
|
||||
|
||||
|
||||
/*
|
||||
* future - private data
|
||||
*
|
||||
*/
|
||||
|
||||
struct ft757_priv_data {
|
||||
unsigned char pacing; /* pacing value */
|
||||
unsigned int read_update_delay; /* depends on pacing value */
|
||||
|
@ -124,15 +72,14 @@ struct ft757_priv_data {
|
|||
|
||||
|
||||
/*
|
||||
* ft757gx rigs capabilities.
|
||||
* ft757gx rig capabilities.
|
||||
* Also this struct is READONLY!
|
||||
*/
|
||||
|
||||
const struct rig_caps ft757gx_caps = {
|
||||
.rig_model = RIG_MODEL_FT757,
|
||||
.model_name = "FT-757GX",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "0.3",
|
||||
.version = "0.3.1",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_ALPHA,
|
||||
.rig_type = RIG_TYPE_MOBILE,
|
||||
|
@ -227,23 +174,15 @@ const struct rig_caps ft757gx_caps = {
|
|||
.get_ptt = NULL, /* get ptt */
|
||||
};
|
||||
|
||||
/* TODO: get better measure numbers */
|
||||
#define FT757GXII_STR_CAL { 2, { \
|
||||
{ 0, -60 }, /* S0 -6dB */ \
|
||||
{ 15, 60 } /* +60 */ \
|
||||
} }
|
||||
|
||||
#define FT757_MEM_CAP { \
|
||||
.freq = 1, \
|
||||
.mode = 1, \
|
||||
.width = 1 \
|
||||
}
|
||||
|
||||
/*
|
||||
* ft757gx2 rig capabilities.
|
||||
* Also this struct is READONLY!
|
||||
*/
|
||||
const struct rig_caps ft757gx2_caps = {
|
||||
.rig_model = RIG_MODEL_FT757GXII,
|
||||
.model_name = "FT-757GXII",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "0.2",
|
||||
.version = "0.2.1",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_ALPHA,
|
||||
.rig_type = RIG_TYPE_MOBILE,
|
||||
|
@ -349,31 +288,30 @@ const struct rig_caps ft757gx2_caps = {
|
|||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* _init
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
int ft757_init(RIG *rig) {
|
||||
int ft757_init(RIG *rig)
|
||||
{
|
||||
struct ft757_priv_data *p;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
p = (struct ft757_priv_data*)malloc(sizeof(struct ft757_priv_data));
|
||||
p = (struct ft757_priv_data *)malloc(sizeof(struct ft757_priv_data));
|
||||
if (!p) /* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__);
|
||||
|
||||
/* TODO: read pacing from preferences */
|
||||
|
||||
p->pacing = FT757GX_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
p->read_update_delay = FT757GX_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
|
||||
p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */
|
||||
rig->state.priv = (void*)p;
|
||||
rig->state.priv = (void *)p;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -384,12 +322,13 @@ int ft757_init(RIG *rig) {
|
|||
* the serial port is closed by the frontend
|
||||
*/
|
||||
|
||||
int ft757_cleanup(RIG *rig) {
|
||||
int ft757_cleanup(RIG *rig)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__);
|
||||
|
||||
if (rig->state.priv)
|
||||
free(rig->state.priv);
|
||||
rig->state.priv = NULL;
|
||||
|
@ -404,25 +343,20 @@ int ft757_cleanup(RIG *rig) {
|
|||
|
||||
int ft757_open(RIG *rig)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0e};
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data*)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
int retval;
|
||||
|
||||
serial_flush(&rig->state.rigport);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
/* send 0 delay PACING cmd to rig */
|
||||
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
/* read back the 75 status bytes */
|
||||
retval = read_block(&rig->state.rigport,
|
||||
(char *) priv->update_data,
|
||||
FT757GX_STATUS_UPDATE_DATA_LENGTH);
|
||||
retval = ft757_get_update_data(rig);
|
||||
if (retval < 0) {
|
||||
memset(priv->update_data, 0, FT757GX_STATUS_UPDATE_DATA_LENGTH);
|
||||
|
||||
if (retval != FT757GX_STATUS_UPDATE_DATA_LENGTH) {
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: update_data failed %d\n",
|
||||
__FUNCTION__, retval);
|
||||
memset(priv->update_data,0,FT757GX_STATUS_UPDATE_DATA_LENGTH);
|
||||
return retval;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -439,50 +373,68 @@ int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0a};
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
/* fill in first four bytes */
|
||||
to_bcd(cmd, freq/10, 8);
|
||||
to_bcd(cmd, freq/10, BCD_LEN);
|
||||
|
||||
return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
|
||||
return write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0c};
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: mode = %d, width = %d\n",
|
||||
__func__, mode, width);
|
||||
|
||||
if (mode == RIG_MODE_NONE)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
/* fill in p1 */
|
||||
cmd[3] = mode2rig(rig, mode, width);
|
||||
|
||||
return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
|
||||
return write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Return Freq
|
||||
*/
|
||||
|
||||
int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data*)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
retval = ft757_get_update_data(rig); /* get whole shebang from rig */
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
/* grab freq and convert */
|
||||
|
||||
/* grab freq (little endian format) and convert */
|
||||
switch(vfo) {
|
||||
case RIG_VFO_CURR:
|
||||
*freq = from_bcd_be(priv->update_data+STATUS_CURR_FREQ, 8);
|
||||
*freq = from_bcd(priv->update_data+STATUS_CURR_FREQ, BCD_LEN);
|
||||
break;
|
||||
case RIG_VFO_A:
|
||||
*freq = from_bcd_be(priv->update_data+STATUS_VFOA_FREQ, 8);
|
||||
*freq = from_bcd(priv->update_data+STATUS_VFOA_FREQ, BCD_LEN);
|
||||
break;
|
||||
case RIG_VFO_B:
|
||||
*freq = from_bcd_be(priv->update_data+STATUS_VFOB_FREQ, 8);
|
||||
*freq = from_bcd(priv->update_data+STATUS_VFOB_FREQ, BCD_LEN);
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong VFO */
|
||||
|
@ -492,12 +444,16 @@ int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
}
|
||||
|
||||
|
||||
|
||||
int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data*)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
retval = ft757_get_update_data(rig); /* get whole shebang from rig */
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
@ -525,19 +481,25 @@ int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
* requests.
|
||||
*
|
||||
*/
|
||||
int ft757_set_vfo(RIG *rig, vfo_t vfo) {
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x05};
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data*)rig->state.priv;
|
||||
|
||||
int ft757_set_vfo(RIG *rig, vfo_t vfo)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x05};
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
switch(vfo) {
|
||||
case RIG_VFO_CURR:
|
||||
return RIG_OK;
|
||||
case RIG_VFO_A:
|
||||
cmd[3] = 0x00;
|
||||
cmd[3] = 0x00; /* VFO A */
|
||||
break;
|
||||
case RIG_VFO_B:
|
||||
cmd[3] = 0x01;
|
||||
cmd[3] = 0x01; /* VFO B */
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong VFO */
|
||||
|
@ -545,14 +507,20 @@ int ft757_set_vfo(RIG *rig, vfo_t vfo) {
|
|||
|
||||
priv->current_vfo = vfo;
|
||||
|
||||
return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
|
||||
return write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
int ft757_get_vfo(RIG *rig, vfo_t *vfo) {
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data*)rig->state.priv;
|
||||
int ft757_get_vfo(RIG *rig, vfo_t *vfo)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
retval = ft757_get_update_data(rig); /* get whole shebang from rig */
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
@ -568,11 +536,17 @@ int ft757_get_vfo(RIG *rig, vfo_t *vfo) {
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
||||
{
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data*)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
retval = ft757_get_update_data(rig); /* get whole shebang from rig */
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
@ -581,27 +555,33 @@ int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x01, 0x10};
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
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, (char *) cmd, YAESU_CMD_LENGTH);
|
||||
retval = write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH);
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
/* read back the 1 byte */
|
||||
retval = read_block(&rig->state.rigport, (char *) cmd, 1);
|
||||
retval = read_block(&rig->state.rigport, (char *)cmd, 1);
|
||||
|
||||
if (retval != 1) {
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: read meter failed %d\n",
|
||||
__FUNCTION__,retval);
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: read meter failed %d.\n",
|
||||
__func__, retval);
|
||||
|
||||
return retval < 0 ? retval : -RIG_EIO;
|
||||
}
|
||||
|
@ -621,25 +601,29 @@ int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
int ft757_get_update_data(RIG *rig)
|
||||
{
|
||||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x10};
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data*)rig->state.priv;
|
||||
struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
serial_flush(&rig->state.rigport);
|
||||
|
||||
/* send READ STATUS cmd to rig */
|
||||
retval = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
|
||||
retval = write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH);
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
/* read back the 75 status bytes */
|
||||
retval = read_block(&rig->state.rigport,
|
||||
(char *) priv->update_data,
|
||||
(char *)priv->update_data,
|
||||
FT757GX_STATUS_UPDATE_DATA_LENGTH);
|
||||
|
||||
if (retval != FT757GX_STATUS_UPDATE_DATA_LENGTH) {
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: read update_data failed %d\n",
|
||||
__FUNCTION__,retval);
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: read update_data failed, %d octects of %d read.\n",
|
||||
__func__, retval, FT757GX_STATUS_UPDATE_DATA_LENGTH);
|
||||
|
||||
return retval < 0 ? retval : -RIG_EIO;
|
||||
}
|
||||
|
@ -652,39 +636,69 @@ int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width)
|
|||
{
|
||||
int md;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
/*
|
||||
* translate mode from generic to ft757 specific
|
||||
*/
|
||||
switch(mode) {
|
||||
case RIG_MODE_AM: md = MODE_AM; break;
|
||||
case RIG_MODE_USB: md = MODE_USB; break;
|
||||
case RIG_MODE_LSB: md = MODE_LSB; break;
|
||||
case RIG_MODE_FM: md = MODE_FM; break;
|
||||
case RIG_MODE_AM:
|
||||
md = MODE_AM;
|
||||
break;
|
||||
case RIG_MODE_USB:
|
||||
md = MODE_USB;
|
||||
break;
|
||||
case RIG_MODE_LSB:
|
||||
md = MODE_LSB;
|
||||
break;
|
||||
case RIG_MODE_FM:
|
||||
md = MODE_FM;
|
||||
break;
|
||||
case RIG_MODE_CW:
|
||||
if (width != RIG_PASSBAND_NORMAL ||
|
||||
width < rig_passband_normal(rig, mode))
|
||||
md = MODE_CWN;
|
||||
else
|
||||
if (width == RIG_PASSBAND_NORMAL ||
|
||||
width >= rig_passband_normal(rig, mode))
|
||||
md = MODE_CWW;
|
||||
else
|
||||
md = MODE_CWN;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE */
|
||||
}
|
||||
|
||||
return md;
|
||||
}
|
||||
|
||||
|
||||
int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
/*
|
||||
* translate mode from ft757 specific to generic
|
||||
*/
|
||||
switch(md) {
|
||||
case MODE_AM: *mode = RIG_MODE_AM; break;
|
||||
case MODE_USB: *mode = RIG_MODE_USB; break;
|
||||
case MODE_LSB: *mode = RIG_MODE_LSB; break;
|
||||
case MODE_FM: *mode = RIG_MODE_FM; break;
|
||||
case MODE_AM:
|
||||
*mode = RIG_MODE_AM;
|
||||
break;
|
||||
case MODE_USB:
|
||||
*mode = RIG_MODE_USB;
|
||||
break;
|
||||
case MODE_LSB:
|
||||
*mode = RIG_MODE_LSB;
|
||||
break;
|
||||
case MODE_FM:
|
||||
*mode = RIG_MODE_FM;
|
||||
break;
|
||||
case MODE_CWW:
|
||||
case MODE_CWN: *mode = RIG_MODE_CW; break;
|
||||
case MODE_CWN:
|
||||
*mode = RIG_MODE_CW;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE */
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* box (FIF-232C) or similar (max232 + some capacitors :-)
|
||||
*
|
||||
*
|
||||
* $Id: ft757gx.h,v 1.2 2004-08-08 19:15:31 fillods Exp $
|
||||
* $Id: ft757gx.h,v 1.3 2008-01-10 14:19:19 n0nb Exp $
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -32,20 +32,83 @@
|
|||
|
||||
#define FT757GX_STATUS_UPDATE_DATA_LENGTH 75
|
||||
|
||||
#define FT757GX_PACING_INTERVAL 5
|
||||
#define FT757GX_PACING_INTERVAL 0
|
||||
#define FT757GX_PACING_DEFAULT_VALUE 0
|
||||
#define FT757GX_WRITE_DELAY 50
|
||||
|
||||
/* number of BCD digits--2 digits per octet */
|
||||
#define BCD_LEN 8
|
||||
|
||||
|
||||
/* Sequential fast writes confuse my FT757GX without this delay */
|
||||
|
||||
#define FT757GX_POST_WRITE_DELAY 5
|
||||
|
||||
|
||||
/* Rough safe value for default timeout */
|
||||
|
||||
#define FT757GX_DEFAULT_READ_TIMEOUT 345 * ( 3 + (FT757GX_PACING_INTERVAL * FT757GX_PACING_DEFAULT_VALUE))
|
||||
|
||||
/*
|
||||
* Some useful offsets in the status update map (offset = book byte value - 1)
|
||||
*
|
||||
* Status Update Chart, FT757GXII
|
||||
*/
|
||||
#define STATUS_CURR_FREQ 5 /* Operating Frequency */
|
||||
#define STATUS_CURR_MODE 9
|
||||
#define STATUS_VFOA_FREQ 10
|
||||
#define STATUS_VFOA_MODE 14
|
||||
#define STATUS_VFOB_FREQ 15
|
||||
#define STATUS_VFOB_MODE 19
|
||||
|
||||
/* Mode values for both set and get */
|
||||
#define MODE_LSB 0x00
|
||||
#define MODE_USB 0x01
|
||||
#define MODE_CWW 0x02
|
||||
#define MODE_CWN 0x03
|
||||
#define MODE_AM 0x04
|
||||
#define MODE_FM 0x05
|
||||
|
||||
|
||||
/* TODO: get better measure numbers */
|
||||
#define FT757GXII_STR_CAL { 2, { \
|
||||
{ 0, -60 }, /* S0 -6dB */ \
|
||||
{ 15, 60 } /* +60 */ \
|
||||
} }
|
||||
|
||||
#define FT757_MEM_CAP { \
|
||||
.freq = 1, \
|
||||
.mode = 1, \
|
||||
.width = 1 \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Receiver caps
|
||||
*/
|
||||
#define FT757GX_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM)
|
||||
|
||||
|
||||
/*
|
||||
* TX caps
|
||||
*/
|
||||
#define FT757GX_ALL_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM)
|
||||
|
||||
|
||||
/* Backend fucntion prototypes. These map to frontend functions. */
|
||||
static int ft757_init(RIG *rig);
|
||||
static int ft757_cleanup(RIG *rig);
|
||||
static int ft757_open(RIG *rig);
|
||||
|
||||
static int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||
static int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
|
||||
|
||||
static int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */
|
||||
static int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */
|
||||
|
||||
static int ft757_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */
|
||||
static int ft757_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */
|
||||
|
||||
static int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
|
||||
static int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||
|
||||
|
||||
#endif /* _FT757GX_H */
|
||||
|
|
Ładowanie…
Reference in New Issue