initial support for raw S-Meter reading

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1877 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.3
Stéphane Fillod, F8CFE 2004-11-15 18:51:37 +00:00
rodzic 74048202dc
commit c6d93677d5
3 zmienionych plików z 70 dodań i 12 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Kachina backend - 505DSP description
* Copyright (c) 2001-2004 by Stephane Fillod
*
* $Id: 505dsp.c,v 1.7 2004-09-26 08:35:03 fillods Exp $
* $Id: 505dsp.c,v 1.8 2004-11-15 18:51:35 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -36,15 +36,17 @@
#define K505DSP_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_TONE|RIG_FUNC_COMP)
#define K505DSP_LEVEL_ALL (RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|RIG_LEVEL_BKINDL|RIG_LEVEL_CWPITCH)
#define K505DSP_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_IF|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|RIG_LEVEL_BKINDL|RIG_LEVEL_CWPITCH)
#define K505DSP_PARM_ALL (RIG_PARM_NONE)
#define K505DSP_VFO (RIG_VFO_A)
#define dBm2S9(x) ((x)+73)
#define K505DSP_STR_CAL { 2, { \
{ 0, -60 }, \
{ 127, 20 }, \
{ 0, dBm2S9(-130) }, \
{ 127, dBm2S9(20) }, \
} }
/*
@ -80,7 +82,7 @@ const struct rig_caps k505dsp_caps = {
.has_get_func = K505DSP_FUNC,
.has_set_func = K505DSP_FUNC,
.has_get_level = K505DSP_LEVEL_ALL,
.has_get_level = RIG_LEVEL_RAWSTR,
.has_set_level = RIG_LEVEL_SET(K505DSP_LEVEL_ALL),
.has_get_parm = K505DSP_PARM_ALL,
.has_set_parm = RIG_PARM_SET(K505DSP_PARM_ALL),
@ -154,6 +156,8 @@ const struct rig_caps k505dsp_caps = {
.set_freq = kachina_set_freq,
.set_mode = kachina_set_mode,
.get_level = kachina_get_level,
};
/*

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib Kachina backend - main file
* Copyright (c) 2001-2003 by Stephane Fillod
* Copyright (c) 2001-2004 by Stephane Fillod
*
* $Id: kachina.c,v 1.6 2003-04-16 22:30:40 fillods Exp $
* $Id: kachina.c,v 1.7 2004-11-15 18:51:35 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -72,7 +72,7 @@
* Otherwise, you'll get a nice seg fault. You've been warned!
* TODO: error case handling
*/
int kachina_transaction(RIG *rig, unsigned char cmd1, unsigned char cmd2)
static int kachina_transaction(RIG *rig, unsigned char cmd1, unsigned char cmd2)
{
int count, retval;
struct rig_state *rs;
@ -98,7 +98,7 @@ int kachina_transaction(RIG *rig, unsigned char cmd1, unsigned char cmd2)
return (buf4[0]==GDCMD) ? RIG_OK : -RIG_EPROTO;
}
int kachina_trans_n(RIG *rig, unsigned char cmd1, const char *data, int data_len)
static int kachina_trans_n(RIG *rig, unsigned char cmd1, const char *data, int data_len)
{
int cmd_len, count, retval;
struct rig_state *rs;
@ -130,7 +130,7 @@ int kachina_trans_n(RIG *rig, unsigned char cmd1, const char *data, int data_len
* convert a frequency in Hz in the range of 30kHz to 30MHz
* to DDS value, as expected by the Kachina.
*/
void inline freq2dds(freq_t freq, int ant_port, unsigned char fbuf[4])
static void freq2dds(freq_t freq, int ant_port, unsigned char fbuf[4])
{
double dds;
unsigned long dds_ulong;
@ -203,6 +203,59 @@ int kachina_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return retval;
}
/*
* kachina_get_level
* Assumes rig!=NULL
*/
int kachina_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
int i, count;
unsigned char buf[32];
static const char rcv_signal_range[128] =
{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f };
/* so far, only RAWSTR supported! */
if (level != RIG_LEVEL_RAWSTR)
return -RIG_ENIMPL;
/* telemetry sent to the PC automatically at a 50msec rate */
serial_flush(&rig->state.rigport);
count = read_string(&rig->state.rigport, buf, 31, rcv_signal_range, 128);
if (count < 1)
return count;
for (i=0; i<count; i++) {
if (buf[i] <= 0x7f)
break;
}
val->i = buf[i];
return RIG_OK;
}
/*
* initrigs_kachina is called by rig_backend_load
*/

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib Kachina backend - main header
* Copyright (c) 2001-2003 by Stephane Fillod
* Copyright (c) 2001-2004 by Stephane Fillod
*
* $Id: kachina.h,v 1.5 2003-11-16 17:14:44 fillods Exp $
* $Id: kachina.h,v 1.6 2004-11-15 18:51:37 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -28,6 +28,7 @@
int kachina_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int kachina_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int kachina_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
extern const struct rig_caps k505dsp_caps;