Add support for Data Modes on Icom "Pro" models.

The Icom IC-7x6Pro models support AFSK data modes with Tx audio
delivered via the back ACC socket. This mode is enabled and queried
via a separate "0x1A06" command and applies to USB, LSB, FM and, AM as
USB-D, LSB-D, FM-D and, AM-D respectively on the radio. I have added
all but AM because hamlib has no mode enumeration for AM Data mode.

Most of the IC-7xxx rigs have an extended version of this special
command which also involves width. This needs further work to
implement.

Signed-off-by: Nate Bargmann <n0nb@n0nb.us>
Hamlib-3.0
Bill Somerville 2013-10-08 00:43:56 +01:00 zatwierdzone przez Nate Bargmann
rodzic 419dc8540f
commit 87ca3f338d
4 zmienionych plików z 116 dodań i 12 usunięć

Wyświetl plik

@ -503,8 +503,8 @@ const struct rig_caps ic746pro_caps = {
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_vfo = icom_set_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,

Wyświetl plik

@ -358,8 +358,8 @@ const struct rig_caps ic756pro_caps = {
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_vfo = icom_set_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,
@ -563,8 +563,8 @@ const struct rig_caps ic756pro2_caps = {
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_vfo = icom_set_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,
@ -901,8 +901,8 @@ const struct rig_caps ic756pro3_caps = {
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_vfo = icom_set_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,

Wyświetl plik

@ -592,6 +592,58 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) {
return RIG_OK;
}
/*
* icom_set_mode_with_data
*/
int icom_set_mode_with_data (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
int retval;
unsigned char datamode;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf);
rmode_t icom_mode;
switch (mode)
{
case RIG_MODE_PKTUSB: icom_mode = RIG_MODE_USB; break;
case RIG_MODE_PKTLSB: icom_mode = RIG_MODE_LSB; break;
case RIG_MODE_PKTFM: icom_mode = RIG_MODE_FM; break;
default: icom_mode = mode; break;
};
retval = icom_set_mode (rig, vfo, icom_mode, width);
if (RIG_OK == retval)
{
if (RIG_MODE_PKTUSB == mode || RIG_MODE_PKTLSB == mode || RIG_MODE_PKTFM == mode)
{
datamode = 0x01;
}
else
{
datamode = 0x00;
}
retval = icom_transaction (rig, C_CTL_MEM, S_MEM_DATA_MODE, &datamode, 1,
ackbuf, &ack_len);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
}
else
{
if (ack_len != 1 || ackbuf[0] != ACK)
{
rig_debug(RIG_DEBUG_ERR,"%s: command not supported ? (%#.2x), "
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
}
}
}
return retval;
}
/*
* icom_set_mode
* Assumes rig!=NULL, rig->state.priv!=NULL
@ -651,6 +703,56 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return RIG_OK;
}
/*
* icom_get_mode_with_data
*
* newer Icom rigs support data mode with ACC-1 audio input and MIC muted
*/
int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
unsigned char databuf[MAXFRAMELEN];
int data_len, retval;
retval = icom_get_mode (rig, vfo, mode, width);
if (RIG_OK == retval && (RIG_MODE_USB == *mode || RIG_MODE_LSB == *mode || RIG_MODE_FM == *mode))
{
/*
* fetch data mode on/off
*/
retval = icom_transaction (rig, C_CTL_MEM, S_MEM_DATA_MODE, 0, 0,
databuf, &data_len);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
"len=%d\n", __FUNCTION__, databuf[0], data_len);
return -RIG_ERJCTED;
}
/*
* databuf should contain Cn,Sc
*/
data_len -= 2;
if (data_len != 1)
{
rig_debug(RIG_DEBUG_ERR,"%s: wrong frame len=%d\n",
__FUNCTION__, data_len);
return -RIG_ERJCTED;
}
if (0x01 == databuf[1])
{
switch (*mode)
{
case RIG_MODE_USB: *mode = RIG_MODE_PKTUSB; break;
case RIG_MODE_LSB: *mode = RIG_MODE_PKTLSB; break;
case RIG_MODE_FM: *mode = RIG_MODE_PKTFM; break;
default: break;
}
}
}
return retval;
}
/*
* icom_get_mode
* Assumes rig!=NULL, rig->state.priv!=NULL, mode!=NULL, width!=NULL
@ -1623,7 +1725,7 @@ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width
if (status != RIG_OK)
return status;
status = icom_set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
status = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
if (status != RIG_OK)
return status;
@ -1642,7 +1744,7 @@ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width
if (status != RIG_OK)
return status;
status = icom_set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
status = rig->caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
if (status != RIG_OK)
return status;
@ -1671,7 +1773,7 @@ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_wid
if (status != RIG_OK)
return status;
status = icom_get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
status = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
if (status != RIG_OK)
return status;
@ -1690,7 +1792,7 @@ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_wid
if (status != RIG_OK)
return status;
status = icom_get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
status = rig->caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width);
if (status != RIG_OK)
return status;

Wyświetl plik

@ -142,7 +142,9 @@ int icom_cleanup(RIG *rig);
int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int icom_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
int icom_set_vfo(RIG *rig, vfo_t vfo);
int icom_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift);