kopia lustrzana https://github.com/Hamlib/Hamlib
trying different approach to storing cmd sequence.
_set_ptt is being converted. Needs tidying up though. Some sequences are complete, and can be read from static data. Incomplete sequences will eventually be copied form static declaration, and completed in priv data. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@292 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.0
rodzic
21db3793b9
commit
a172a41fdb
|
@ -7,7 +7,7 @@
|
|||
* box (FIF-232C) or similar
|
||||
*
|
||||
*
|
||||
* $Id: ft747.c,v 1.24 2000-12-09 21:48:52 javabear Exp $
|
||||
* $Id: ft747.c,v 1.25 2000-12-11 04:19:10 javabear Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -31,7 +31,7 @@
|
|||
/*
|
||||
* TODO - FS
|
||||
*
|
||||
* 1. Rentrant code, handle static stuff
|
||||
* 1. Rentrant code, remove static stuff from all functions.
|
||||
* 2. rationalise code, more helper functions.
|
||||
* 3. Allow cached reads
|
||||
* 4. Fix crappy 25Hz resolution handling
|
||||
|
@ -59,6 +59,45 @@
|
|||
|
||||
static int ft747_get_update_data(RIG *rig);
|
||||
|
||||
/* Native ft747 cmd set prototypes. These are READ ONLY as each */
|
||||
/* rig instance will copy from these and modify if required . */
|
||||
/* Complete sequences (1) can be read and used directly as a cmd sequence . */
|
||||
/* Incomplete sequences (0) must be copied to priv data and completed */
|
||||
/* there. */
|
||||
|
||||
static const struct ft747_cmd_set ncmd[] = {
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */
|
||||
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory*/
|
||||
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* vfo to memory*/
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x04 } }, /* dial lock = off */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x04 } }, /* dial lock = on */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */
|
||||
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* memory to vfo*/
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* up 500 khz */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* down 500 khz */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* clarify off */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, /* clarify on */
|
||||
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set freq */
|
||||
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* mode set LSB */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* mode set USB */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* mode set CWW */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* mode set CWN */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* mode set AMW */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* mode set AMN */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* mode set FMW */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x07, 0x0c } }, /* mode set FMN */
|
||||
|
||||
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* pacing set */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* ptt off */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* ptt on */
|
||||
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x10 } }, /* request update from rig */
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Receiver caps
|
||||
|
@ -551,9 +590,7 @@ int ft747_get_vfo(RIG *rig, vfo_t *vfo) {
|
|||
int ft747_set_ptt(RIG *rig,vfo_t vfo, ptt_t ptt) {
|
||||
struct rig_state *rig_s;
|
||||
struct ft747_priv_data *p;
|
||||
|
||||
static unsigned char cmd_ptt_off[] = { 0x00, 0x00, 0x00, 0x00, 0x0f }; /* ptt off */
|
||||
static unsigned char cmd_ptt_on[] = { 0x00, 0x00, 0x00, 0x01, 0x0f }; /* ptt on */
|
||||
unsigned char *cmd; /* points to sequence to send */
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
@ -563,16 +600,19 @@ int ft747_set_ptt(RIG *rig,vfo_t vfo, ptt_t ptt) {
|
|||
|
||||
ft747_set_vfo(rig,vfo); /* select VFO first */
|
||||
|
||||
|
||||
switch(ptt) {
|
||||
case RIG_PTT_OFF:
|
||||
write_block(rig_s->fd, cmd_ptt_off, FT747_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay);
|
||||
return RIG_OK;
|
||||
cmd = (unsigned char *)&ncmd[FT_747_NATIVE_MODE_PTT_OFF].nseq; /* get native sequence */
|
||||
break;
|
||||
case RIG_PTT_ON:
|
||||
write_block(rig_s->fd, cmd_ptt_on, FT747_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay);
|
||||
return RIG_OK;
|
||||
cmd = (unsigned char *)&ncmd[FT_747_NATIVE_MODE_PTT_ON].nseq;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong VFO */
|
||||
}
|
||||
|
||||
write_block(rig_s->fd, cmd, FT747_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay);
|
||||
return RIG_OK; /* good */
|
||||
}
|
||||
|
||||
|
@ -816,6 +856,18 @@ void ft747_cmd_get_update_store(int fd, unsigned char *buffer) {
|
|||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Private helper cmd to copy a native cmd sequence to priv
|
||||
*/
|
||||
|
||||
static void build_cmd(unsigned char *dst, int command){
|
||||
int i;
|
||||
for(i=0; i<FT747_CMD_LENGTH; i++) {
|
||||
dst[i] = ncmd[command].nseq[i]; /* lookup native cmd and build sequence */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* init_ft747 is called by rig_backend_load
|
||||
|
|
106
ft747/ft747.h
106
ft747/ft747.h
|
@ -7,7 +7,7 @@
|
|||
* box (FIF-232C) or similar (max232 + some capacitors :-)
|
||||
*
|
||||
*
|
||||
* $Id: ft747.h,v 1.17 2000-12-09 02:03:26 javabear Exp $
|
||||
* $Id: ft747.h,v 1.18 2000-12-11 04:19:10 javabear Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -64,6 +64,110 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Native FT747 functions. This is what I have to work with :-)
|
||||
*
|
||||
*/
|
||||
|
||||
enum ft747_native_cmd_e {
|
||||
FT_747_NATIVE_SPLIT_OFF = 0,
|
||||
FT_747_NATIVE_SPLIT_ON,
|
||||
FT_747_NATIVE_RECALL_MEM,
|
||||
FT_747_NATIVE_VFO_TO_MEM,
|
||||
FT_747_NATIVE_DLOCK_OFF,
|
||||
FT_747_NATIVE_DLOCK_ON,
|
||||
FT_747_NATIVE_VFO_A,
|
||||
FT_747_NATIVE_VFO_B,
|
||||
FT_747_NATIVE_M_TO_VFO,
|
||||
FT_747_NATIVE_UP_500K,
|
||||
FT_747_NATIVE_DOWN_500K,
|
||||
FT_747_NATIVE_CLARIFY_OFF,
|
||||
FT_747_NATIVE_CLARIFY_ON,
|
||||
FT_747_NATIVE_FREQ_SET,
|
||||
FT_747_NATIVE_MODE_SET_LSB,
|
||||
FT_747_NATIVE_MODE_SET_USB,
|
||||
FT_747_NATIVE_MODE_SET_CWW,
|
||||
FT_747_NATIVE_MODE_SET_CWN,
|
||||
FT_747_NATIVE_MODE_SET_AMW,
|
||||
FT_747_NATIVE_MODE_SET_AMN,
|
||||
FT_747_NATIVE_MODE_SET_FMW,
|
||||
FT_747_NATIVE_MODE_SET_FMN,
|
||||
FT_747_NATIVE_MODE_PACING,
|
||||
FT_747_NATIVE_MODE_PTT_OFF,
|
||||
FT_747_NATIVE_MODE_PTT_ON,
|
||||
FT_747_NATIVE_MODE_UPDATE
|
||||
|
||||
};
|
||||
|
||||
typedef enum ft747_native_cmd_e ft747_native_cmd_t;
|
||||
|
||||
|
||||
/*
|
||||
* Data structure for FT747 native cmd set
|
||||
*/
|
||||
|
||||
struct ft747_cmd_set {
|
||||
unsigned char ncomp; /* 1 = complete, 0 = incomplete, needs extra info */
|
||||
unsigned char nseq[5]; /* native cmd sequence */
|
||||
};
|
||||
|
||||
/* typedef struct ft747_cmd_set ft747_cmd_set_t; */
|
||||
|
||||
#if 0
|
||||
#define FT_747_NATIVE_SPLIT_OFF 0
|
||||
#define FT_747_NATIVE_SPLIT_ON 1
|
||||
#define FT_747_NATIVE_RECALL_MEM 2
|
||||
#define FT_747_NATIVE_VFO_TO_MEM 3
|
||||
#define FT_747_NATIVE_DLOCK_OFF 4
|
||||
#define FT_747_NATIVE_DLOCK_ON 5
|
||||
#define FT_747_NATIVE_VFO_A 6
|
||||
#define FT_747_NATIVE_VFO_B 7
|
||||
|
||||
#define FT_747_NATIVE_M_TO_VFO 9
|
||||
#define FT_747_NATIVE_UP_500K 9
|
||||
#define FT_747_NATIVE_DOWN_500K 10
|
||||
#define FT_747_NATIVE_CLARIFY_OFF 12
|
||||
#define FT_747_NATIVE_CLARIFY_ON 12
|
||||
#define FT_747_NATIVE_FREQ_SET 13
|
||||
|
||||
#define FT_747_NATIVE_MODE_SET_LSB 14
|
||||
#define FT_747_NATIVE_MODE_SET_USB 15
|
||||
#define FT_747_NATIVE_MODE_SET_CWW 16
|
||||
#define FT_747_NATIVE_MODE_SET_CWN 17
|
||||
#define FT_747_NATIVE_MODE_SET_AMW 18
|
||||
#define FT_747_NATIVE_MODE_SET_AMN 19
|
||||
#define FT_747_NATIVE_MODE_SET_FMW 20
|
||||
#define FT_747_NATIVE_MODE_SET_FMN 20
|
||||
|
||||
#define FT_747_NATIVE_MODE_PACING 21
|
||||
#define FT_747_NATIVE_MODE_PTT_OFF 22
|
||||
#define FT_747_NATIVE_MODE_PTT_ON 23
|
||||
#define FT_747_NATIVE_MODE_UPDATE 24
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Internal MODES - when setting modes via cmd_mode_set() */
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue