int ft857_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, "ft857: 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 = ft857_send_icmd(rig, FT857_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) ft857_send_cmd(rig, FT857_NATIVE_CAT_CLAR_OFF); else ft857_send_cmd(rig, FT857_NATIVE_CAT_CLAR_ON); return RIG_OK; }
/* * This doesn't seem to work on FT857. It might work with FT817 though. */ int ft857_set_powerstat(RIG *rig, powerstat_t status) { switch (status) { case RIG_POWER_OFF: return ft857_send_cmd(rig, FT857_NATIVE_CAT_PWR_OFF); case RIG_POWER_ON: return ft857_send_cmd(rig, FT857_NATIVE_CAT_PWR_ON); case RIG_POWER_STANDBY: default: return -RIG_EINVAL; } }
int ft857_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, "ft857: ft857_set_ptt called\n"); switch(ptt) { case RIG_PTT_ON: index = FT857_NATIVE_CAT_PTT_ON; break; case RIG_PTT_OFF: index = FT857_NATIVE_CAT_PTT_OFF; break; default: return -RIG_EINVAL; } n = ft857_send_cmd(rig, index); rig_force_cache_timeout(&((struct ft857_priv_data *) rig->state.priv)->tx_status_tv); if (n < 0 && n != -RIG_ERJCTED) return n; return RIG_OK; }
int ft857_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: set repeter shift = %i\n", shift); switch (shift) { case RIG_RPT_SHIFT_NONE: return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX); case RIG_RPT_SHIFT_MINUS: return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_RPT_SHIFT_MINUS); case RIG_RPT_SHIFT_PLUS: return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_RPT_SHIFT_PLUS); } return -RIG_EINVAL; }
int ft857_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { switch (op) { case RIG_OP_TOGGLE: return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_VFOAB); default: return -RIG_EINVAL; } return -RIG_EINVAL; }
int ft857_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 ft857_send_cmd(rig, FT857_NATIVE_CAT_LOCK_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_LOCK_OFF); case RIG_FUNC_TONE: if (status) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_ENC_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); case RIG_FUNC_TSQL: if (status) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); #if 0 case RIG_FUNC_CODE: /* this doesn't exist */ if (status) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_DCS_ENC_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); case RIG_FUNC_DSQL: /* this doesn't exist */ if (status) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_DCS_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); #endif default: return -RIG_EINVAL; } }
int ft857_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq, rmode_t mode, pbwidth_t width) { int retcode; if (vfo != RIG_VFO_CURR && vfo != RIG_VFO_TX) return -RIG_ENTARGET; retcode = ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_VFOAB); if (RIG_OK != retcode) { return retcode; } retcode = ft857_set_freq (rig, RIG_VFO_CURR, freq); if (RIG_OK == retcode) { retcode = ft857_set_mode (rig, RIG_VFO_CURR, mode, width); } ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_VFOAB); /* always try and return to orig VFO */ return retcode; }
int ft857_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, "ft857: set CTCSS sql (%.1f)\n", tone / 10.0); if (tone == 0) return ft857_send_cmd(rig, FT857_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 = ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_CTCSS_FREQ, data)) < 0) return n; return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_ON); }
int ft857_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, "ft857: set DCS sql (%d)\n", code); if (code == 0) return ft857_send_cmd(rig, FT857_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 = ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_DCS_CODE, data)) < 0) return n; return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_DCS_ON); }
int ft857_set_vfo(RIG *rig, vfo_t vfo) { vfo_t curvfo; int retval = ft857_get_vfo(rig,&curvfo); if (retval != RIG_OK) { rig_debug(RIG_DEBUG_ERR,"%s: error get_vfo '%s'\n",__func__,rigerror(retval)); return retval; } if (curvfo == vfo) { return RIG_OK; } return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_VFOAB); }
int ft857_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,"ft857: generic mode = %x \n", mode); switch(mode) { case RIG_MODE_AM: index = FT857_NATIVE_CAT_SET_MODE_AM; break; case RIG_MODE_CW: index = FT857_NATIVE_CAT_SET_MODE_CW; break; case RIG_MODE_USB: index = FT857_NATIVE_CAT_SET_MODE_USB; break; case RIG_MODE_LSB: index = FT857_NATIVE_CAT_SET_MODE_LSB; break; case RIG_MODE_RTTY: case RIG_MODE_PKTUSB: /* user has to have correct DIG mode setup on rig */ index = FT857_NATIVE_CAT_SET_MODE_DIG; break; case RIG_MODE_FM: index = FT857_NATIVE_CAT_SET_MODE_FM; break; case RIG_MODE_WFM: index = FT857_NATIVE_CAT_SET_MODE_FM; break; case RIG_MODE_CWR: index = FT857_NATIVE_CAT_SET_MODE_CWR; break; case RIG_MODE_PKTFM: index = FT857_NATIVE_CAT_SET_MODE_PKT; break; default: return -RIG_EINVAL; } if (width != RIG_PASSBAND_NORMAL) return -RIG_EINVAL; rig_force_cache_timeout(&((struct ft857_priv_data *) rig->state.priv)->fm_status_tv); return ft857_send_cmd(rig, index); }