Exemplo n.º 1
0
Arquivo: ft897.c Projeto: W4AQL/hamlib
int ft897_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, "ft897: 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 = ft897_send_icmd(rig, FT897_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)
    ft897_send_cmd(rig, FT897_NATIVE_CAT_CLAR_OFF);
  else
    ft897_send_cmd(rig, FT897_NATIVE_CAT_CLAR_ON);

  return RIG_OK;
}
Exemplo n.º 2
0
Arquivo: ft897.c Projeto: W4AQL/hamlib
int ft897_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
  unsigned char data[YAESU_CMD_LENGTH - 1];

  if (vfo != RIG_VFO_CURR)
    return -RIG_ENTARGET;

  rig_debug(RIG_DEBUG_VERBOSE,"ft897: requested freq = %"PRIfreq" Hz\n", freq);

  /* fill in the frequency */
  to_bcd_be(data, (freq + 5) / 10, 8);

  return ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_FREQ, data);
}
Exemplo n.º 3
0
Arquivo: ft897.c Projeto: W4AQL/hamlib
int ft897_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
{
  unsigned char data[YAESU_CMD_LENGTH - 1];

  if (vfo != RIG_VFO_CURR)
    return -RIG_ENTARGET;

  rig_debug(RIG_DEBUG_VERBOSE, "ft897: set repeter offs = %li\n", offs);

  /* fill in the offset freq */
  to_bcd_be(data, offs / 10, 8);

  return ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_RPT_OFFSET, data);
}
Exemplo n.º 4
0
int ft897_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
  unsigned char data[YAESU_CMD_LENGTH - 1];

  if (vfo != RIG_VFO_CURR)
    return -RIG_ENTARGET;

  rig_debug(RIG_DEBUG_VERBOSE,"ft897: requested freq = %"PRIfreq" Hz\n", freq);

  /* fill in the frequency */
  to_bcd_be(data, (freq + 5) / 10, 8);

  /*invalidate frequency cache*/
  rig_force_cache_timeout(&((struct ft897_priv_data *) rig->state.priv)->fm_status_tv);

  return ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_FREQ, data);
}
Exemplo n.º 5
0
Arquivo: ft897.c Projeto: W4AQL/hamlib
int ft897_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, "ft897: set CTCSS sql (%.1f)\n", tone / 10.0);

  if (tone == 0)
    return ft897_send_cmd(rig, FT897_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 = ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_CTCSS_FREQ, data)) < 0)
    return n;

  return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_ON);
}
Exemplo n.º 6
0
Arquivo: ft897.c Projeto: W4AQL/hamlib
int ft897_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, "ft897: set DCS sql (%d)\n", code);

  if (code == 0)
    return ft897_send_cmd(rig, FT897_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 = ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_DCS_CODE, data)) < 0)
    return n;

  return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_DCS_ON);
}