예제 #1
0
파일: ft817.c 프로젝트: GomSpace/hamlib
int ft817_set_rptr_shift (RIG *rig, vfo_t vfo, rptr_shift_t shift)
{
    /* Note: this doesn't have effect unless FT817 is in FM mode
       although the command is accepted in any mode.
    */
    if (vfo != RIG_VFO_CURR)
        return -RIG_ENTARGET;

    rig_debug(RIG_DEBUG_VERBOSE, "ft817: set repeter shift = %i\n", shift);

    switch (shift) {

    case RIG_RPT_SHIFT_NONE:
        return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX);

    case RIG_RPT_SHIFT_MINUS:
        return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_RPT_SHIFT_MINUS);

    case RIG_RPT_SHIFT_PLUS:
        return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_RPT_SHIFT_PLUS);

    }

    return -RIG_EINVAL;
}
예제 #2
0
파일: ft817.c 프로젝트: GomSpace/hamlib
int ft817_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
{
    unsigned char data[YAESU_CMD_LENGTH - 1];
    int n;

    if (vfo != RIG_VFO_CURR)
        return -RIG_ENTARGET;

    rig_debug(RIG_DEBUG_VERBOSE, "ft817: set rit = %li)\n", rit);

    /* fill in the RIT freq */
    data[0] = (rit < 0) ? 255 : 0;
    data[1] = 0;
    to_bcd_be(data + 2, labs(rit) / 10, 4);

    if ((n = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_CLAR_FREQ, data)) < 0)
        return n;

    /* the rig rejects if these are repeated - don't confuse user with retcode */
    if (rit == 0)
        ft817_send_cmd(rig, FT817_NATIVE_CAT_CLAR_OFF);
    else
        ft817_send_cmd(rig, FT817_NATIVE_CAT_CLAR_ON);

    return RIG_OK;
}
예제 #3
0
파일: ft817.c 프로젝트: GomSpace/hamlib
int ft817_set_powerstat(RIG *rig, powerstat_t status)
{
    switch (status) {
    case RIG_POWER_OFF:
        return ft817_send_cmd(rig, FT817_NATIVE_CAT_PWR_OFF);
    case RIG_POWER_ON:
        return ft817_send_cmd(rig, FT817_NATIVE_CAT_PWR_ON);
    case RIG_POWER_STANDBY:
    default:
        return -RIG_EINVAL;
    }
}
예제 #4
0
파일: ft817.c 프로젝트: GomSpace/hamlib
int ft817_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
{
    unsigned char data[YAESU_CMD_LENGTH - 1];
    /* 	int n; */

    if (vfo != RIG_VFO_CURR)
        return -RIG_ENTARGET;

    rig_debug(RIG_DEBUG_VERBOSE, "ft817: set DCS code (%d)\n", code);

    if (code == 0)
        return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF);

    /* fill in the DCS code - the rig doesn't support separate codes... */
    to_bcd_be(data,     code, 4);
    to_bcd_be(data + 2, code, 4);


    /* FT-817 does not have the DCS_ENC_ON command, so we just set the tone here */

    /* 	if ((n = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_DCS_CODE, data)) < 0) */
    /* 		return n; */

    /* 	return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_DCS_ENC_ON); */

    return ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_DCS_CODE, data);
}
예제 #5
0
파일: ft817.c 프로젝트: GomSpace/hamlib
int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
    int index, n;

    if (vfo != RIG_VFO_CURR)
        return -RIG_ENTARGET;

    rig_debug(RIG_DEBUG_VERBOSE, "ft817: ft817_set_ptt called\n");

    switch(ptt) {
    case RIG_PTT_ON:
        index = FT817_NATIVE_CAT_PTT_ON;
        break;
    case RIG_PTT_OFF:
        index = FT817_NATIVE_CAT_PTT_OFF;
        break;
    default:
        return -RIG_EINVAL;
    }

    n = ft817_send_cmd(rig, index);

    rig_force_cache_timeout(
        &((struct ft817_priv_data *)rig->state.priv)->tx_status_tv);

    if (n < 0 && n != -RIG_ERJCTED)
        return n;

    return RIG_OK;
}
예제 #6
0
파일: ft817.c 프로젝트: GomSpace/hamlib
/* FIXME: this function silently ignores the vfo args and just turns
   split ON or OFF.
*/
int ft817_set_split_vfo  (RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
    int index, n;

    /* 	if (vfo != RIG_VFO_CURR) */
    /* 		return -RIG_ENTARGET; */

    rig_debug(RIG_DEBUG_VERBOSE, "ft817: ft817_set_split_vfo called\n");

    switch (split) {

    case RIG_SPLIT_ON:
        index = FT817_NATIVE_CAT_SPLIT_ON;
        break;

    case RIG_SPLIT_OFF:
        index = FT817_NATIVE_CAT_SPLIT_OFF;
        break;

    default:
        return -RIG_EINVAL;
    }

    n = ft817_send_cmd (rig, index);

    if (n < 0 && n != -RIG_ERJCTED)
        return n;

    return RIG_OK;

}
예제 #7
0
int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
	int index, n;

	if (vfo != RIG_VFO_CURR)
		return -RIG_ENTARGET;

	rig_debug(RIG_DEBUG_VERBOSE, "ft817: ft817_set_ptt called\n");

	switch(ptt) {
	case RIG_PTT_ON:
		index = FT817_NATIVE_CAT_PTT_ON;
		break;
	case RIG_PTT_OFF:
		index = FT817_NATIVE_CAT_PTT_OFF;
		break;
	default:
		return -RIG_EINVAL;
	}

	n = ft817_send_cmd(rig, index);

	if (n < 0 && n != -RIG_ERJCTED)
		return n;

	return RIG_OK;
}
예제 #8
0
int ft817_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
	int index;	/* index of sequence to send */

	if (vfo != RIG_VFO_CURR)
		return -RIG_ENTARGET;

	rig_debug(RIG_DEBUG_VERBOSE,"ft817: generic mode = %x \n", mode);

	switch(mode) {

	case RIG_MODE_AM:
		index = FT817_NATIVE_CAT_SET_MODE_AM;
		break;

	case RIG_MODE_CW:
		index = FT817_NATIVE_CAT_SET_MODE_CW;
		break;

	case RIG_MODE_USB:
		index = FT817_NATIVE_CAT_SET_MODE_USB;
		break;

	case RIG_MODE_LSB:
		index = FT817_NATIVE_CAT_SET_MODE_LSB;
		break;

	case RIG_MODE_RTTY:
		index = FT817_NATIVE_CAT_SET_MODE_DIG;
		break;

	case RIG_MODE_FM:
		index = FT817_NATIVE_CAT_SET_MODE_FM;
		break;

	case RIG_MODE_WFM:
		/* can not be set, it is implicit when changing band */
//		index = FT817_NATIVE_CAT_SET_MODE_FM;
		return -RIG_EINVAL;
		break;

	case RIG_MODE_CWR:
		index = FT817_NATIVE_CAT_SET_MODE_CWR;
		break;

	case RIG_MODE_PKTFM:
		index = FT817_NATIVE_CAT_SET_MODE_PKT;
		break;

	default:
		return -RIG_EINVAL;
	}

	/* just ignore passband */
/* 	if (width != RIG_PASSBAND_NORMAL) */
/* 		return -RIG_EINVAL; */

	return ft817_send_cmd(rig, index);
}
예제 #9
0
파일: ft817.c 프로젝트: GomSpace/hamlib
int ft817_vfo_op         (RIG *rig, vfo_t vfo, vfo_op_t op)
{
    switch (op) {

    case RIG_OP_TOGGLE:
        return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_VFOAB);

    default:
        return -RIG_EINVAL;
    }
}
예제 #10
0
파일: ft817.c 프로젝트: GomSpace/hamlib
int ft817_set_func (RIG *rig, vfo_t vfo, setting_t func, int status)
{
    if (vfo != RIG_VFO_CURR)
        return -RIG_ENTARGET;

    switch (func) {
    case RIG_FUNC_LOCK:
        if (status)
            return ft817_send_cmd (rig, FT817_NATIVE_CAT_LOCK_ON);
        else
            return ft817_send_cmd (rig, FT817_NATIVE_CAT_LOCK_OFF);

    case RIG_FUNC_TONE:
        if (status)
            return ft817_send_cmd (rig, FT817_NATIVE_CAT_SET_CTCSS_ENC_ON);
        else
            return ft817_send_cmd (rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF);

    case RIG_FUNC_TSQL:
        if (status)
            return ft817_send_cmd (rig, FT817_NATIVE_CAT_SET_CTCSS_ON);
        else
            return ft817_send_cmd (rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF);

    default:
        return -RIG_EINVAL;
    }
}
예제 #11
0
파일: ft817.c 프로젝트: GomSpace/hamlib
int ft817_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
{
    unsigned char data[YAESU_CMD_LENGTH - 1];
    int n;

    if (vfo != RIG_VFO_CURR)
        return -RIG_ENTARGET;

    rig_debug(RIG_DEBUG_VERBOSE, "ft817: set CTCSS sql (%.1f)\n", tone / 10.0);

    if (tone == 0)
        return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF);

    /* fill in the CTCSS freq - the rig doesn't support separate tones... */
    to_bcd_be(data,     tone, 4);
    to_bcd_be(data + 2, tone, 4);

    if ((n = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_CTCSS_FREQ, data)) < 0)
        return n;

    return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_ON);
}
예제 #12
0
파일: ft817.c 프로젝트: GomSpace/hamlib
int ft817_set_dcs_sql (RIG *rig, vfo_t vfo, tone_t code)
{
    unsigned char data[YAESU_CMD_LENGTH - 1];
    int n;

    if (vfo != RIG_VFO_CURR)
        return -RIG_ENTARGET;

    rig_debug(RIG_DEBUG_VERBOSE, "ft817: set DCS sql (%d)\n", code);

    if (code == 0)
        return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF);

    /* fill in the DCS code - the rig doesn't support separate codes... */
    to_bcd_be(data,     code, 4);
    to_bcd_be(data + 2, code, 4);

    if ((n = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_DCS_CODE, data)) < 0)
        return n;

    return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_DCS_ON);
}