kopia lustrzana https://github.com/Hamlib/Hamlib
added ft847_open and ft847_close to enable CAT ON/OFF
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@179 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.1.0
rodzic
375fe0c242
commit
d097865bf8
141
ft847/ft847.c
141
ft847/ft847.c
|
@ -6,7 +6,7 @@
|
|||
* via serial interface to an FT-847 using the "CAT" interface.
|
||||
*
|
||||
*
|
||||
* $Id: ft847.c,v 1.20 2000-09-23 03:48:01 javabear Exp $
|
||||
* $Id: ft847.c,v 1.21 2000-10-01 23:50:46 javabear Exp $
|
||||
*
|
||||
*
|
||||
*
|
||||
|
@ -126,10 +126,10 @@ const struct rig_caps ft847_caps = {
|
|||
},
|
||||
ft847_init,
|
||||
ft847_cleanup,
|
||||
NULL,
|
||||
NULL,
|
||||
ft847_open,
|
||||
ft847_close,
|
||||
NULL /* probe not supported yet */,
|
||||
ft847_set_freq_main_vfo_hz,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -154,12 +154,12 @@ int ft847_init(RIG *rig) {
|
|||
struct ft847_priv_data *p;
|
||||
|
||||
if (!rig)
|
||||
return -1;
|
||||
return -RIG_EINVAL;
|
||||
|
||||
p = (struct ft847_priv_data*)malloc(sizeof(struct ft847_priv_data));
|
||||
if (!p) {
|
||||
/* whoops! memory shortage! */
|
||||
return -2;
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
/* init the priv_data from static struct
|
||||
|
@ -168,8 +168,10 @@ int ft847_init(RIG *rig) {
|
|||
*p = ft847_priv;
|
||||
|
||||
rig->state.priv = (void*)p;
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -177,21 +179,61 @@ int ft847_init(RIG *rig) {
|
|||
* ft847_cleanup routine
|
||||
* the serial port is closed by the frontend
|
||||
*/
|
||||
|
||||
int ft847_cleanup(RIG *rig) {
|
||||
if (!rig)
|
||||
return -1;
|
||||
return -RIG_EINVAL;
|
||||
|
||||
if (rig->state.priv)
|
||||
free(rig->state.priv);
|
||||
rig->state.priv = NULL;
|
||||
|
||||
return 0;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* should check return code and that write wrote cmd_len chars!
|
||||
*/
|
||||
/* write_block2(rig_s->fd, buf, frm_len, rig_s->write_delay); */
|
||||
|
||||
/*
|
||||
* ft847_open routine
|
||||
*
|
||||
*/
|
||||
|
||||
int ft847_open(RIG *rig) {
|
||||
struct rig_state *rig_s;
|
||||
static unsigned char cmd[] = { 0x00, 0x00, 0x00, 0x00, 0x00 }; /* cat = on */
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rig_s = &rig->state;
|
||||
|
||||
/* Good time to set CAT ON */
|
||||
|
||||
write_block(rig_s->fd, cmd, FT847_CMD_LENGTH, rig_s->write_delay);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ft847_close routine
|
||||
*
|
||||
*/
|
||||
|
||||
int ft847_close(RIG *rig) {
|
||||
struct rig_state *rig_s;
|
||||
static unsigned char cmd[] = { 0x00, 0x00, 0x00, 0x00, 0x80 }; /* cat = off */
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rig_s = &rig->state;
|
||||
|
||||
/* Good time to set CAT OFF */
|
||||
|
||||
write_block(rig_s->fd, cmd, FT847_CMD_LENGTH, rig_s->write_delay);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
@ -199,6 +241,79 @@ int ft847_cleanup(RIG *rig) {
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
int ft847_set_freq(RIG *rig, freq_t freq) {
|
||||
return -RIG_ENIMPL;
|
||||
}
|
||||
|
||||
int ft847_get_freq(RIG *rig, freq_t *freq) {
|
||||
return -RIG_ENIMPL;
|
||||
}
|
||||
|
||||
int ft847_set_mode(RIG *rig, rmode_t mode) {
|
||||
return -RIG_ENIMPL;
|
||||
}
|
||||
|
||||
int ft847_get_mode(RIG *rig, rmode_t *mode) {
|
||||
return -RIG_ENIMPL;
|
||||
}
|
||||
|
||||
int ft847_set_vfo(RIG *rig, vfo_t vfo) {
|
||||
return -RIG_ENIMPL;
|
||||
|
||||
}
|
||||
int ft847_get_vfo(RIG *rig, vfo_t *vfo) {
|
||||
return -RIG_ENIMPL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* _set_ptt
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
int ft847_set_ptt(RIG *rig, ptt_t ptt) {
|
||||
struct rig_state *rig_s;
|
||||
struct ft847_priv_data *p;
|
||||
|
||||
static unsigned char cmd_A[] = { 0x00, 0x00, 0x00, 0x00, 0x08 }; /* ptt = on */
|
||||
static unsigned char cmd_B[] = { 0x00, 0x00, 0x00, 0x00, 0x88 }; /* ptt = off */
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
p = (struct ft847_priv_data*)rig->state.priv;
|
||||
rig_s = &rig->state;
|
||||
|
||||
/*
|
||||
* TODO : check for errors -- FS
|
||||
*/
|
||||
|
||||
switch(ptt) {
|
||||
case RIG_PTT_ON:
|
||||
write_block(rig_s->fd, cmd_A, FT847_CMD_LENGTH, rig_s->write_delay);
|
||||
return RIG_OK;
|
||||
case RIG_PTT_OFF:
|
||||
write_block(rig_s->fd, cmd_B, FT847_CMD_LENGTH, rig_s->write_delay);
|
||||
return RIG_OK;
|
||||
default:
|
||||
return -RIG_EINVAL; /* sorry, wrong ptt range */
|
||||
}
|
||||
|
||||
return RIG_OK; /* good */
|
||||
|
||||
}
|
||||
|
||||
int ft847_get_ptt(RIG *rig, ptt_t *ptt) {
|
||||
return -RIG_ENIMPL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int ft847_set_freq_main_vfo_hz(RIG *rig, freq_t freq, rmode_t mode) {
|
||||
struct ft847_priv_data *p;
|
||||
struct rig_state *rig_s;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* via serial interface to an FT-847 using the "CAT" interface.
|
||||
*
|
||||
*
|
||||
* $Id: ft847.h,v 1.14 2000-09-23 03:49:13 javabear Exp $
|
||||
* $Id: ft847.h,v 1.15 2000-10-01 23:49:08 javabear Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -28,6 +28,10 @@
|
|||
#ifndef _FT847_H
|
||||
#define _FT847_H 1
|
||||
|
||||
|
||||
#define FT847_CMD_LENGTH 5
|
||||
|
||||
|
||||
/*
|
||||
* future - private data
|
||||
*
|
||||
|
@ -38,21 +42,33 @@ struct ft847_priv_data {
|
|||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* API local implementation
|
||||
*/
|
||||
|
||||
int ft847_init(RIG *rig);
|
||||
int ft847_open(RIG *rig);
|
||||
|
||||
int ft847_cleanup(RIG *rig);
|
||||
int ft847_close(RIG *rig);
|
||||
|
||||
int ft847_set_freq(RIG *rig, freq_t freq);
|
||||
int ft847_get_freq(RIG *rig, freq_t *freq);
|
||||
|
||||
/* int cmd_set_freq_main_vfo_hz(RIG *rig, freq_t freq, rig_mode_t mode); */
|
||||
int ft847_set_mode(RIG *rig, rmode_t mode); /* select mode */
|
||||
int ft847_get_mode(RIG *rig, rmode_t *mode); /* get mode */
|
||||
|
||||
/*
|
||||
int (*set_freq)(RIG *rig, freq_t freq);
|
||||
int (*set_mode)(RIG *rig, rig_mode_t mode);
|
||||
int (*set_vfo)(RIG *rig, rig_vfo_t vfo);
|
||||
*/
|
||||
int ft847_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */
|
||||
int ft847_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */
|
||||
|
||||
int ft847_set_ptt(RIG *rig, ptt_t ptt);
|
||||
int ft847_get_ptt(RIG *rig, ptt_t *ptt);
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
* Allow TX commands to be disabled
|
||||
|
@ -113,7 +129,6 @@ const unsigned char CTCSS_ENC_DEC_OFF = 0x2a;
|
|||
*/
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
void cmd_set_cat_on(int fd);
|
||||
void cmd_set_cat_off(int fd);
|
||||
|
|
Ładowanie…
Reference in New Issue