diff --git a/doc/README.ft920 b/doc/README.ft920 new file mode 100644 index 000000000..062b13f0a --- /dev/null +++ b/doc/README.ft920 @@ -0,0 +1,55 @@ +Quirks, known bugs, and other notes. +==================================== + +$Id: README.ft920,v 1.1 2002-11-23 14:09:19 n0nb Exp $ + +In this document I'll try to describe the behavior of the Yaesu FT-920 +transceiver with Hamlib. Some of these are limitations of the radio +while others are programming trade-offs with Hamlib. + +This document is organized by Hamlib function calls and documents observed +behavior with each call. + +rig_set_mode + * If radio is in MEM or MEM TUNE state, main display mode can be + changed when RIG_VFO_CURR is passed. + * Modes DATA USB and DATA FM cannot be set at this time + (Hamlib limitation). See below. + +rig_get_mode + * Modes DATA USB and DATA FM cannot be returned as rig.h only has + RIG_MODE_RTTY (Hamlib limitation). + * DATA LSB is mapped to RIG_MODE_RTTY. + +rig_set_freq + * If radio is in MEM or MEM TUNE state, main display freq can be + changed when RIG_VFO_CURR is passed. + * RIG_TARGETABLE_ALL is properly handled (I think). + +rig_set_vfo + * When called with RIG_VFO_A, the radio appears to do nothing, + however, rig_state->current_vfo will be updated. + * When called with RIG_VFO_B, the radio will swap the main and sub + displays, the same as if the front panel A<>B button is pressed. + * No provision exists to make VFO-B (sub display) the active RX + through CAT. + +rig_get_split + * Both split capabilities are tested, i.e. RX A/TX B and RX B/TX A, + but Hamlib only supports an indication that the radio is split. + * The VFO value passed is not used by the ft920 backend lib. + +rig_set_split + * When called with RIG_SPLIT_OFF the radio will make TX A active if + TX B was active, otherwise no change. + * When called with RIG_SPLIT_ON the radio will make TX B active if + TX A was active, otherwise no change. + * The FT-920 has no capability to change the active RX to RX B (sub + display) through CAT. Thus if VFO-B is active RX/TX the setting + RIG_SPLIT_ON will make no visible change on the radio. + * The VFO value passed is not used by the ft920 backend lib. + +General notes. + As with most all Yaesu radios the radio must be polled by the application + for status updates, i.e. no transceive mode in CAT. + diff --git a/yaesu/ft920.c b/yaesu/ft920.c index 8302eb14d..bf9763934 100644 --- a/yaesu/ft920.c +++ b/yaesu/ft920.c @@ -12,7 +12,7 @@ * pages 86 to 90 * * - * $Id: ft920.c,v 1.9 2002-11-22 03:04:30 n0nb Exp $ + * $Id: ft920.c,v 1.10 2002-11-23 14:09:20 n0nb Exp $ * * * This library is free software; you can redistribute it and/or @@ -273,6 +273,8 @@ const struct rig_caps ft920_caps = { .get_mode = ft920_get_mode, /* get mode */ .set_vfo = ft920_set_vfo, /* set vfo */ .get_vfo = ft920_get_vfo, /* get vfo */ + .set_split = ft920_set_split, + .get_split = ft920_get_split, }; @@ -917,6 +919,83 @@ int ft920_get_vfo(RIG *rig, vfo_t *vfo) { } +/* + * set the '920 into split TX/RX mode + * + * VFO cannot be set as the set split on command only changes the + * TX to the sub display. Setting split off returns the TX to the + * main display. + * + */ + +int ft920_set_split(RIG *rig, vfo_t vfo, split_t split) { + unsigned char cmd_index; + + rig_debug(RIG_DEBUG_VERBOSE, "ft920: ft920_set_split called\n"); + + if (!rig) + return -RIG_EINVAL; + + switch(split) { + case RIG_SPLIT_OFF: + cmd_index = FT920_NATIVE_SPLIT_OFF; + break; + case RIG_SPLIT_ON: + cmd_index = FT920_NATIVE_SPLIT_ON; + break; + default: + return -RIG_EINVAL; + } + + ft920_send_priv_cmd(rig, cmd_index); + + return RIG_OK; +} + + +/* + * Get whether the '920 is in split mode + * + */ + +int ft920_get_split(RIG *rig, vfo_t vfo, split_t *split) { + struct ft920_priv_data *priv; + unsigned char status_0; + + rig_debug(RIG_DEBUG_VERBOSE, "ft920: ft920_get_split called\n"); + + if (!rig) + return -RIG_EINVAL; + + priv = (struct ft920_priv_data *)rig->state.priv; + + /* Get flags for VFO split status */ + ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS, + FT920_STATUS_FLAGS_LENGTH); + + status_0 = priv->update_data[FT920_SUMO_DISPLAYED_STATUS_0]; + status_0 &= SF_VFOB; /* get VFO B (sub display) active bits */ + + rig_debug(RIG_DEBUG_TRACE, + "ft920: get_split: split status_0 = [0x%x]\n", status_0); + + switch (status_0) { + case SF_SPLITA: + case SF_SPLITB: + *split = RIG_SPLIT_ON; + break; + case SF_VFOA: + case SF_VFOB: + *split = RIG_SPLIT_OFF; + break; + default: + return RIG_EINVAL; + } + + return RIG_OK; +} + + /* * private helper function. Retrieves update data from rig. * using pacing value and buffer indicated in *priv struct. diff --git a/yaesu/ft920.h b/yaesu/ft920.h index d8fa79197..61ffcb035 100644 --- a/yaesu/ft920.h +++ b/yaesu/ft920.h @@ -9,7 +9,7 @@ * via serial interface to an FT-920 using the "CAT" interface * * - * $Id: ft920.h,v 1.7 2002-11-22 03:04:30 n0nb Exp $ + * $Id: ft920.h,v 1.8 2002-11-23 14:09:21 n0nb Exp $ * * * This library is free software; you can redistribute it and/or @@ -214,17 +214,17 @@ typedef enum ft920_native_cmd_e ft920_native_cmd_t; #define FT920_SUMO_DISPLAYED_STATUS_0 0x00 /* Status flag byte 0 */ #define SF_VFOA 0x00 /* bits 0 & 1, VFO A TX/RX == 0 */ -#define SF_SPLITA 0x01 /* Split operation with VFO-B on TX */ -#define SF_SPLITB 0x02 /* Split operation with VFO-B on RX */ -#define SF_VFOB 0x03 /* bits 0 & 1, VFO B TX/RX == 3 */ +#define SF_SPLITA (1<<0) /* Split operation with VFO-B on TX */ +#define SF_SPLITB (1<<1) /* Split operation with VFO-B on RX */ +#define SF_VFOB (SF_SPLITA|SF_SPLITB) /* bits 0 & 1, VFO B TX/RX == 3 */ #define FT920_SUMO_DISPLAYED_STATUS_1 0x01 /* Status flag byte 1 */ -#define SF_QMB 0x08 /* Quick Memory Bank (QMB) selected */ -#define SF_MT 0x10 /* Memory Tuning in progress */ -#define SF_VFO 0x20 /* VFO operation selected */ -#define SF_MR 0x40 /* Memory Mode selected */ -#define SF_GC 0x80 /* General Coverage Reception selected */ -#define SF_VFO_MASK 0x78 /* Ignore general coverage flag. Is it needed? */ +#define SF_QMB (1<<3) /* Quick Memory Bank (QMB) selected */ +#define SF_MT (1<<4) /* Memory Tuning in progress */ +#define SF_VFO (1<<5) /* VFO operation selected */ +#define SF_MR (1<<6) /* Memory Mode selected */ +#define SF_GC (1<<7) /* General Coverage Reception selected */ +#define SF_VFO_MASK (SF_QMB|SF_MT|SF_VFO|SF_MR) /* * Offsets for VFO record retrieved via 0x10 P1 = 02, 03 @@ -305,11 +305,13 @@ int ft920_close(RIG *rig); int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); -int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */ -int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */ +int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); +int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); -int ft920_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */ -int ft920_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */ +int ft920_set_vfo(RIG *rig, vfo_t vfo); +int ft920_get_vfo(RIG *rig, vfo_t *vfo); +int ft920_set_split(RIG *rig, vfo_t vfo, split_t split); +int ft920_get_split(RIG *rig, vfo_t vfo, split_t *split); #endif /* _FT920_H */