[Hamlib-cvs-digest] CVS: hamlib/yaesu ft747.c,1.1,1.2 ft747.h,1.1,1.2 ft847.c,1.1,1.2 ft847.h,1.1,1.
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Frank S. <jav...@us...> - 2001-01-04 07:03:58
|
Update of /cvsroot/hamlib/hamlib/yaesu In directory usw-pr-cvs1:/tmp/cvs-serv12556 Modified Files: ft747.c ft747.h ft847.c ft847.h Log Message: Begin to use common yaesu code Index: ft747.c =================================================================== RCS file: /cvsroot/hamlib/hamlib/yaesu/ft747.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ft747.c 2001/01/04 05:39:03 1.1 --- ft747.c 2001/01/04 07:03:58 1.2 *************** *** 51,56 **** #include <hamlib/riglist.h> #include "serial.h" - #include "ft747.h" #include "misc.h" --- 51,57 ---- #include <hamlib/riglist.h> #include "serial.h" #include "misc.h" + #include "yaesu.h" + #include "ft747.h" *************** *** 65,69 **** /* eg: mem number, or freq etc.. */ ! static const ft747_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */ --- 66,70 ---- /* eg: mem number, or freq etc.. */ ! static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */ *************** *** 191,204 **** - /* - * Function definitions below - */ - /* ! * setup *priv ! * serial port is already open (rig->state->fd) * - * - * */ --- 192,198 ---- /* ! * _init * */ *************** *** 239,242 **** --- 233,237 ---- * the serial port is closed by the frontend */ + int ft747_cleanup(RIG *rig) { if (!rig) *************** *** 322,326 **** */ ! memcpy(&p->p_cmd,&ncmd[FT_747_NATIVE_FREQ_SET].nseq,FT747_CMD_LENGTH); to_bcd(p->p_cmd,freq/10,8); /* store bcd format in in p_cmd */ --- 317,321 ---- */ ! memcpy(&p->p_cmd,&ncmd[FT_747_NATIVE_FREQ_SET].nseq,YAESU_CMD_LENGTH); to_bcd(p->p_cmd,freq/10,8); /* store bcd format in in p_cmd */ *************** *** 330,334 **** cmd = p->p_cmd; /* get native sequence */ ! write_block(rig_s->fd, cmd, FT747_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; --- 325,329 ---- cmd = p->p_cmd; /* get native sequence */ ! write_block(rig_s->fd, cmd, YAESU_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; *************** *** 455,459 **** cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ ! write_block(rig_s->fd, cmd, FT747_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); rig_debug(RIG_DEBUG_VERBOSE,"ft747: cmd_index = %i \n", cmd_index); --- 450,454 ---- cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ ! write_block(rig_s->fd, cmd, YAESU_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); rig_debug(RIG_DEBUG_VERBOSE,"ft747: cmd_index = %i \n", cmd_index); *************** *** 575,579 **** cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ ! write_block(rig_s->fd, cmd, FT747_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; --- 570,574 ---- cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ ! write_block(rig_s->fd, cmd, YAESU_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; *************** *** 646,650 **** cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ ! write_block(rig_s->fd, cmd, FT747_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; /* good */ --- 641,645 ---- cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ ! write_block(rig_s->fd, cmd, YAESU_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; /* good */ *************** *** 738,746 **** rig_debug(RIG_DEBUG_VERBOSE,"ft747: read pacing = %i \n",p->pacing); ! write_block(rig_s->fd, cmd_pace, FT747_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); rig_debug(RIG_DEBUG_VERBOSE,"ft747: read timeout = %i \n",FT747_DEFAULT_READ_TIMEOUT); ! write_block(rig_s->fd, cmd_update, FT747_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); /* request data */ n = read_sleep(rig_s->fd,p->update_data, FT747_STATUS_UPDATE_DATA_LENGTH, FT747_DEFAULT_READ_TIMEOUT); /* n = read_block(rig_s->fd,p->update_data, FT747_STATUS_UPDATE_DATA_LENGTH, FT747_DEFAULT_READ_TIMEOUT); */ --- 733,741 ---- rig_debug(RIG_DEBUG_VERBOSE,"ft747: read pacing = %i \n",p->pacing); ! write_block(rig_s->fd, cmd_pace, YAESU_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); rig_debug(RIG_DEBUG_VERBOSE,"ft747: read timeout = %i \n",FT747_DEFAULT_READ_TIMEOUT); ! write_block(rig_s->fd, cmd_update, YAESU_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); /* request data */ n = read_sleep(rig_s->fd,p->update_data, FT747_STATUS_UPDATE_DATA_LENGTH, FT747_DEFAULT_READ_TIMEOUT); /* n = read_block(rig_s->fd,p->update_data, FT747_STATUS_UPDATE_DATA_LENGTH, FT747_DEFAULT_READ_TIMEOUT); */ *************** *** 749,905 **** } - - /* - * TODO: Implement these old OPCODES -- FS - */ - - - #if 0 - - void ft747_cmd_set_split_yes(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x01, 0x01 }; /* split = on */ - write_block(fd,data); - } - - void ft747_cmd_set_split_no(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x01 }; /* split = off */ - write_block(fd,data); - } - - void ft747_cmd_set_recall_memory(int fd, int mem) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x02 }; /* recall memory*/ - - data[3] = mem; - write_block(fd,data); - } - - void ft747_cmd_set_vfo_to_memory(int fd, int mem) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x03 }; /* vfo to memory*/ - - data[3] = mem; - write_block(fd,data); - } - - void ft747_cmd_set_dlock_off(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x04 }; /* dial lock = off */ - write_block(fd,data); - } - - void ft747_cmd_set_dlock_on(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x01, 0x04 }; /* dial lock = on */ - write_block(fd,data); - - } - - - void ft747_cmd_set_select_vfo_a(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x05 }; /* select vfo A */ - write_block(fd,data); - } - - void ft747_cmd_set_select_vfo_b(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x01, 0x05 }; /* select vfo B */ - write_block(fd,data); - } - - void ft747_cmd_set_memory_to_vfo(int fd, int mem) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x06 }; /* memory to vfo*/ - - data[3] = mem; - write_block(fd,data); - } - - void ft747_cmd_set_up500k(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x07 }; /* up 500 khz */ - write_block(fd,data); - } - - void ft747_cmd_set_down500k(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x08 }; /* down 500 khz */ - write_block(fd,data); - } - - void ft747_cmd_set_clarify_off(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x09 }; /* clarify off */ - write_block(fd,data); - printf("ft747_cmd_clarify_off complete \n"); - } - - void ft747_cmd_set_clarify_on(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x01, 0x09 }; /* clarify on */ - write_block(fd,data); - } - - - void ft747_cmd_set_freq(int fd, unsigned int freq) { - printf("ft747_cmd_freq_set not implemented yet \n"); - } - - - void ft747_cmd_set_mode(int fd, int mode) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x0c }; /* mode set */ - - data[3] = mode; - write_block(fd,data); - - } - - void ft747_cmd_set_pacing(int fd, int delay) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x0e }; /* pacing set */ - - data[3] = delay; - write_block(fd,data); - - } - - void ft747_cmd_set_ptt_off(int fd) { - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x0f }; /* ptt off */ - write_block(fd,data); - - } - - void ft747_cmd_set_ptt_on(int fd) { - - #ifdef TX_ENABLED - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x01, 0x0f }; /* ptt on */ - write_block(fd,data); - printf("ft747_cmd_ptt_on complete \n"); - #elsif - printf("ft747_cmd_ptt_on disabled \n"); - #endif - - } - - /* - * Read data from rig and store in buffer provided - * by the user. - */ - - void ft747_cmd_get_update_store(int fd, unsigned char *buffer) { - int n; /* counter */ - - static unsigned char data[] = { 0x00, 0x00, 0x00, 0x00, 0x10 }; /* request update from rig */ - - write_block(fd,data); - n = read_sleep(fd,buffer,FT747_STATUS_UPDATE_SIZE); /* wait and read for bytes to be read */ - - return; - } - - - - /* - * 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; - } - #endif - --- 744,747 ---- Index: ft747.h =================================================================== RCS file: /cvsroot/hamlib/hamlib/yaesu/ft747.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ft747.h 2001/01/04 05:39:03 1.1 --- ft747.h 2001/01/04 07:03:58 1.2 *************** *** 31,35 **** #define _FT747_H 1 - #define FT747_CMD_LENGTH 5 #define FT747_STATUS_UPDATE_DATA_LENGTH 345 --- 31,34 ---- *************** *** 107,122 **** - /* - * Basic 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; - - /* Internal MODES - when setting modes via cmd_mode_set() */ --- 106,109 ---- *************** *** 198,203 **** unsigned int read_update_delay; /* depends on pacing value */ unsigned char current_vfo; /* active VFO from last cmd , can be either RIG_VFO_A or RIG_VFO_B only */ ! unsigned char p_cmd[FT747_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ ! ft747_cmd_set_t pcs[FT_747_NATIVE_SIZE]; /* private cmd set */ unsigned char update_data[FT747_STATUS_UPDATE_DATA_LENGTH]; /* returned data */ }; --- 185,190 ---- unsigned int read_update_delay; /* depends on pacing value */ unsigned char current_vfo; /* active VFO from last cmd , can be either RIG_VFO_A or RIG_VFO_B only */ ! unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ ! yaesu_cmd_set_t pcs[FT_747_NATIVE_SIZE]; /* private cmd set */ unsigned char update_data[FT747_STATUS_UPDATE_DATA_LENGTH]; /* returned data */ }; *************** *** 264,308 **** const float band_data[11] = { 0.0, 0.1, 2.5, 4.0, 7.5, 10.5, 14.5, 18.5, 21.5, 25.0, 30.0 }; - - /* - * Visible functions in shared lib. - * - */ - - /* - * set commands - */ - - - - - void cmd_set_split_yes(int fd); - void cmd_set_split_no(int fd); - void cmd_set_recall_memory(int fd, int mem); - void cmd_set_vfo_to_memory(int fd, int mem); - void cmd_set_dlock_off(int fd); - void cmd_set_dlock_on(int fd); - void cmd_set_select_vfo_a(int fd); - void cmd_set_select_vfo_b(int fd); - void cmd_set_memory_to_vfo(int fd, int mem); - void cmd_set_up500k(int fd); - void cmd_set_down500k(int fd); - void cmd_set_clarify_off(int fd); - void cmd_set_clarify_on(int fd); - - /* - *void cmd_set_freq(int fd, unsigned int freq); - */ - - void cmd_set_mode(int fd, int mode); - void cmd_set_pacing(int fd, int delay); - void cmd_set_ptt_off(int fd); - void cmd_set_ptt_on(int fd); /* careful.. */ - - /* - * get commands - */ - - void cmd_get_update_store(int fd, unsigned char *buffer); /* data external */ #endif --- 251,254 ---- Index: ft847.c =================================================================== RCS file: /cvsroot/hamlib/hamlib/yaesu/ft847.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ft847.c 2001/01/04 05:39:03 1.1 --- ft847.c 2001/01/04 07:03:58 1.2 *************** *** 58,61 **** --- 58,62 ---- #include <hamlib/riglist.h> #include "serial.h" + #include "yaesu.h" #include "ft847.h" #include "misc.h" *************** *** 72,76 **** /* eg: mem number, or freq etc.. */ ! static const ft847_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* CAT = On */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x80 } }, /* CAT = Off */ --- 73,77 ---- /* eg: mem number, or freq etc.. */ ! static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* CAT = On */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x80 } }, /* CAT = Off */ *************** *** 375,379 **** cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ ! write_block(rig_s->fd, cmd, FT847_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; --- 376,380 ---- cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ ! write_block(rig_s->fd, cmd, YAESU_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; *************** *** 432,436 **** } ! memcpy(&p->p_cmd,&ncmd[cmd_index].nseq,FT847_CMD_LENGTH); to_bcd_be(p->p_cmd,freq/10,8); /* store bcd format in in p_cmd */ --- 433,437 ---- } ! memcpy(&p->p_cmd,&ncmd[cmd_index].nseq,YAESU_CMD_LENGTH); to_bcd_be(p->p_cmd,freq/10,8); /* store bcd format in in p_cmd */ *************** *** 440,444 **** cmd = p->p_cmd; /* get native sequence */ ! write_block(rig_s->fd, cmd, FT847_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; --- 441,445 ---- cmd = p->p_cmd; /* get native sequence */ ! write_block(rig_s->fd, cmd, YAESU_CMD_LENGTH, rig_s->write_delay, rig_s->post_write_delay); return RIG_OK; Index: ft847.h =================================================================== RCS file: /cvsroot/hamlib/hamlib/yaesu/ft847.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ft847.h 2001/01/04 05:39:03 1.1 --- ft847.h 2001/01/04 07:03:58 1.2 *************** *** 30,34 **** - #define FT847_CMD_LENGTH 5 #define FT847_WRITE_DELAY 50 --- 30,33 ---- *************** *** 145,167 **** - /* - * TODO -- Move this to common yaesu.h file -- FS - * - */ - - /* - * Basic Data structure for FT847 native cmd set - */ - - - - struct ft847_cmd_set { - unsigned char ncomp; /* 1 = complete, 0 = incomplete, needs extra info */ - unsigned char nseq[5]; /* native cmd sequence */ - }; - - typedef struct ft847_cmd_set ft847_cmd_set_t; - - /* --- 144,147 ---- *************** *** 172,177 **** struct ft847_priv_data { unsigned char current_vfo; /* active VFO from last cmd , can be either RIG_VFO_A, SAT_RX, SAT_TX */ ! unsigned char p_cmd[FT847_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ ! ft847_cmd_set_t pcs[FT_847_NATIVE_SIZE]; /* private cmd set */ unsigned char rx_status; /* tx returned data */ unsigned char tx_status; /* rx returned data */ --- 152,157 ---- struct ft847_priv_data { unsigned char current_vfo; /* active VFO from last cmd , can be either RIG_VFO_A, SAT_RX, SAT_TX */ ! unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ ! yaesu_cmd_set_t pcs[FT_847_NATIVE_SIZE]; /* private cmd set */ unsigned char rx_status; /* tx returned data */ unsigned char tx_status; /* rx returned data */ |