Tentec Orion Backend


Files

file  orion.c
 Backend for Tentec Orion 565 / 566.
file  orion.h
 Backend for Tentec Orion 565 / 566.

Data Structures

struct  tt565_priv_data
 Orion private data. More...

Defines

#define TT565_MEM_CAP
 Memory capability.
#define TT565_MODES
 Orion Supported Modes.
#define TT565_RXMODES   (TT565_MODES)
 Orion Receiver Modes.
#define TT565_FUNCS   (RIG_FUNC_LOCK|RIG_FUNC_TUNER|RIG_FUNC_VOX|RIG_FUNC_NB)
 Orion Supported Functions.
#define TT565_LEVELS
 Orion Supported Levels.
#define TT565_ANTS   (RIG_ANT_1|RIG_ANT_2)
 Orion Tx/Rx Antennas.
#define TT565_RXANTS   (TT565_ANTS|RIG_ANT_3)
 Orion Rx Antennas.
#define TT565_PARMS   (RIG_PARM_NONE)
 Orion Parameters.
#define TT565_VFO   (RIG_VFO_A|RIG_VFO_B)
 Orion VFOs - A and B.
#define TT565_VFO_OPS
 Orion VFO Operations.
#define TT565_STR_CAL_V1
 S-Meter Calibration list.
#define TT565_STR_CAL_V2
#define EOM   "\015"
 End of command marker.
#define TT565_USB   '0'
 USB Mode.
#define TT565_LSB   '1'
 LSB Mode.
#define TT565_CW   '2'
 CW normal Mode.
#define TT565_CWR   '3'
 CW reverse Mode.
#define TT565_AM   '4'
 AM Mode.
#define TT565_FM   '5'
 FM Mode.
#define TT565_RTTY   '6'
 RTTY Mode.
#define TT565_TONE_MIN   300
 minimum sidetone freq., Hz
#define TT565_TONE_MAX   1200
 maximum sidetone freq., Hz
#define TT565_CW_MIN   10
 minimum CW keyer rate, wpm
#define TT565_CW_MAX   60
 maximum CW keyer rate, wpm

Functions

int tt565_transaction (RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
 tt565_transaction, adapted from tentec_transaction (tentec.c)
int tt565_init (RIG *rig)
 Basically, it just sets up *priv.
int tt565_cleanup (RIG *rig)
 tt565_cleanup routine
int tt565_open (RIG *rig)
 tt565_open routine
int tt565_set_freq (RIG *rig, vfo_t vfo, freq_t freq)
 Set a frequence into the specified VFO.
int tt565_get_freq (RIG *rig, vfo_t vfo, freq_t *freq)
 Get the frequency currently set in the specified VFO (A or B).
int tt565_set_vfo (RIG *rig, vfo_t vfo)
 set RIG_VFO_CURR and send info to physical rig.
int tt565_get_vfo (RIG *rig, vfo_t *vfo)
int tt565_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
 Set split operating mode.
int tt565_get_split_vfo (RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
 Get the current split status and Tx vfo selection.
int tt565_set_mode (RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
 Set operating mode to RIG_MODE_x with indicated passband width.
int tt565_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
 Get op. mode and bandwidth for selected vfo.
int tt565_set_ts (RIG *rig, vfo_t vfo, shortfreq_t ts)
 Set Tuning Step for VFO A or B.
int tt565_get_ts (RIG *rig, vfo_t vfo, shortfreq_t *ts)
 Get Tuning Step for VFO A or B.
int tt565_set_rit (RIG *rig, vfo_t vfo, shortfreq_t rit)
 Set Rx incremental tuning.
int tt565_get_rit (RIG *rig, vfo_t vfo, shortfreq_t *rit)
 Get Rx incremental tuning.
int tt565_set_xit (RIG *rig, vfo_t vfo, shortfreq_t xit)
 Set Tx incremental tuning (Main TRx only).
int tt565_get_xit (RIG *rig, vfo_t vfo, shortfreq_t *xit)
 Get Tx incremental tuning (Main TRx only).
int tt565_set_ptt (RIG *rig, vfo_t vfo, ptt_t ptt)
 Set push to talk (Tx on/off).
int tt565_get_ptt (RIG *rig, vfo_t vfo, ptt_t *ptt)
 Get push to talk (Tx on/off).
int tt565_reset (RIG *rig, reset_t reset)
 Restart Orion firmware.
const char * tt565_get_info (RIG *rig)
 Get firmware identification, e.g., "Version 1.372".
int tt565_set_level (RIG *rig, vfo_t vfo, setting_t level, value_t val)
 Sets any of Orion's "Level" adjustments.
int tt565_get_level (RIG *rig, vfo_t vfo, setting_t level, value_t *val)
 Get the current value of an Orion "level".
int tt565_set_mem (RIG *rig, vfo_t vfo, int ch)
 This only sets the current memory channel locally. No Orion I/O.
int tt565_get_mem (RIG *rig, vfo_t vfo, int *ch)
 Get the current memory channel number (only).
int tt565_vfo_op (RIG *rig, vfo_t vfo, vfo_op_t op)
 perform a RIG_OP operation
int tt565_send_morse (RIG *rig, vfo_t vfo, const char *msg)
 Send a string as morse characters.
int tt565_set_func (RIG *rig, vfo_t vfo, setting_t func, int status)
 Set an Orion "function".
int tt565_get_func (RIG *rig, vfo_t vfo, setting_t func, int *status)
 get state of an Orion "function"
int tt565_set_ant (RIG *rig, vfo_t vfo, ant_t ant)
 Antenna selection for Orion.
int tt565_get_ant (RIG *rig, vfo_t vfo, ant_t *ant)
 Find what antenna is "attached" to our vfo.

Variables

struct rig_caps tt565_caps
 tt565 transceiver capabilities.

Define Documentation

#define TT565_MEM_CAP

Value:

{        \
        .freq = 1,      \
        .mode = 1,      \
        .width = 1,     \
}
Memory capability.

Orion's own memory channel holds a freq, mode, and bandwidth. May be captured from VFO A or B and applied to VFO A or B. It cannot directly be read or written from the computer!

#define TT565_STR_CAL_V1

Value:

{ 14,  { \
                {   1, -47 }, /* padding to match lengths with v2 */ \
                        {  10, -47 }, \
                {  13, -42 }, \
                {  18, -37 }, \
                {  22, -32 }, \
                {  27, -27 }, \
                {  32, -18 }, \
                {  37, -11 }, \
                {  42,  -4 }, \
                {  47,  -1 }, \
                {  52,  10 }, \
                {  57,  20 }, \
                {  65,  30 }, \
                {  74,  40 }, \
        } }
S-Meter Calibration list.

List format: { hardware units, dB relative to S9}

These alternate tables must be of equal size, because they may be switched depending on firmware version detection.

Note high end of scale is severely compressed in v1 Table corrected against v 1.372, 11/2007

#define TT565_STR_CAL_V2

Value:

{ 14, { \
                { 10., -48. }, /* S1 = min. indication */ \
                { 24., -42. }, \
                { 38., -36. }, \
                { 47., -30. }, \
                { 61., -24. }, \
                { 70., -18. }, \
                { 79., -12. }, \
                { 84.,  -6. }, \
                { 94.,   0. }, /* S9 */ \
                { 103., 10. }, \
                { 118., 20. }, \
                { 134., 30. }, \
                { 147., 40. }, \
                { 161., 50. }, \
        } }
Calibration for Version 2.062a firmware, from Rigserve project. Again, this is approximate based on one measurement.

#define TT565_VFO_OPS

Value:

Orion VFO Operations.

Allowed operations


Function Documentation

static int tt565_cleanup ( RIG rig  ) 

tt565_cleanup routine

Parameters:
rig the serial port is closed by the frontend

static int tt565_get_ant ( RIG rig,
vfo_t  vfo,
ant_t ant 
)

Find what antenna is "attached" to our vfo.

Parameters:
rig != NULL
vfo 
ant receives antenna identifier
Returns:
RIG_OK or < 0
See also:
tt565_set_ant

static int tt565_get_freq ( RIG rig,
vfo_t  vfo,
freq_t freq 
)

Get the frequency currently set in the specified VFO (A or B).

Parameters:
rig must != NULL
vfo RIG_VFO_A or RIG_VFO_B
freq must != NULL Performs query on physical rig

static int tt565_get_func ( RIG rig,
vfo_t  vfo,
setting_t  func,
int *  status 
)

get state of an Orion "function"

Parameters:
rig != NULL
vfo must == RIG_VFO_CURR
func 
status receives result of function query
Returns:
RIG_OK or < 0
See also:
tt565_set_func

static const char * tt565_get_info ( RIG rig  ) 

Get firmware identification, e.g., "Version 1.372".

Parameters:
rig must != NULL
Returns:
firmware identification string or NULL Re-entrancy issue (what else is new?)

static int tt565_get_level ( RIG rig,
vfo_t  vfo,
setting_t  level,
value_t val 
)

Get the current value of an Orion "level".

Parameters:
rig must be != NULL
vfo 
level identifier for level of interest
val Receives level's value, must != NULL
See also:
tt565_get_level Supported rx levels:
-RIG_LEVEL_SWR
-RIG_LEVEL_RAWSTR, int raw rx signal strength (rig units)
-RIG_LEVEL_RFPOWER
-RIG_LEVEL_AGC
-RIG_LEVEL_AF
-RIG_LEVEL_IF
-RIG_LEVEL_RF
-RIG_LEVEL_ATT
-RIG_LEVEL_PREAMP
-RIG_LEVEL_SQL
-RIG_LEVEL_MICGAIN
-RIG_LEVEL_COMP
-RIG_LEVEL_CWPITCH
-RIG_LEVEL_KEYSPED
-RIG_LEVEL_NR
-RIG_LEVEL_VOX
-RIG_LEVEL_VOXGAIN
-RIG_LEVEL_ANTIVOX
(RIG_LEVEL_STRENGTH, int calibrated signal strength (dB, S9 = 0) is handled in settings.c)

static int tt565_get_mem ( RIG rig,
vfo_t  vfo,
int *  ch 
)

Get the current memory channel number (only).

Parameters:
rig != NULL
vfo 
ch to receive the current channel number
Returns:
RIG_OK

static int tt565_get_mode ( RIG rig,
vfo_t  vfo,
rmode_t mode,
pbwidth_t width 
)

Get op. mode and bandwidth for selected vfo.

Parameters:
rig must != NULL
vfo 
mode Receives current mode setting, must be != NULL
width Receives current bandwidth setting, must be != NULL
Returns:
RIG_OK or < 0
Remarks:
Confusion of VFO and Main/Sub TRx/Rx. See tt565_set_mode.

static int tt565_get_ptt ( RIG rig,
vfo_t  vfo,
ptt_t ptt 
)

Get push to talk (Tx on/off).

Parameters:
rig must != NULL
vfo 
ptt Receives RIG_PTT_ON or RIG_PTT_OFF
Returns:
RIG_OK or < 0

static int tt565_get_rit ( RIG rig,
vfo_t  vfo,
shortfreq_t rit 
)

Get Rx incremental tuning.

Parameters:
rig must != NULL
vfo 
rit Receives Rx incremental tuning, Hz
Returns:
RIG_OK or < 0

static int tt565_get_split_vfo ( RIG rig,
vfo_t  vfo,
split_t split,
vfo_t tx_vfo 
)

Get the current split status and Tx vfo selection.

Parameters:
rig must != NULL
vfo 
split Returned with RIG_SPLIT_ON if Tx <> Rx vfo, .._OFF otherwise
tx_vfo Returned RIG_VFO_x, signifying selected Tx vfo
Returns:
RIG_OK or < 0

static int tt565_get_ts ( RIG rig,
vfo_t  vfo,
shortfreq_t ts 
)

Get Tuning Step for VFO A or B.

Parameters:
rig must != NULL
vfo 
ts Receives Tuning Step, Hz
Returns:
RIG_OK or < 0

static int tt565_get_vfo ( RIG rig,
vfo_t vfo 
)

Parameters:
rig must != NULL
vfo Set = stored state of current VFO state
Returns:
RIG_OK

static int tt565_get_xit ( RIG rig,
vfo_t  vfo,
shortfreq_t xit 
)

Get Tx incremental tuning (Main TRx only).

Parameters:
rig must != NULL
vfo 
xit Receives Tx incremental tuning, Hz
Returns:
RIG_OK or < 0

static int tt565_init ( RIG rig  ) 

Basically, it just sets up *priv.

Parameters:
rig 
Returns:
RIG_OK or < 0

static int tt565_open ( RIG rig  ) 

tt565_open routine

Parameters:
rig Open the rig - check firmware version issues

static int tt565_reset ( RIG rig,
reset_t  reset 
)

Restart Orion firmware.

Parameters:
rig must != NULL
reset (not used)
Returns:
RIG_OK or < 0 Sends an "X" command and listens for reply = "ORION START". This only seems to test for healthy connection to the firmware. There is no effect on Orion's state, AFAIK.

static int tt565_send_morse ( RIG rig,
vfo_t  vfo,
const char *  msg 
)

Send a string as morse characters.

Parameters:
rig 
vfo 
msg A message string (<= 20 char)
Returns:
RIG_OK Orion keyer must be on for morse, but we do not have a "keyer on" function in hamlib (yet). Keyer will be forced on.
Orion can queue up to about 20 characters. We could batch a longer message into 20 char chunks, but there is no simple way to tell if message has completed. We could calculate a duration based on keyer speed and the text that was sent, but what we really need is a handshake for "message complete". Without it, you can't easily use the Orion as a code practice machine. For now, we let the user do the batching. Note that rig panel is locked up for duration of message.

static int tt565_set_ant ( RIG rig,
vfo_t  vfo,
ant_t  ant 
)

Antenna selection for Orion.

Parameters:
rig != NULL
vfo 
ant antenna identifier RIG_ANT_1 or RIG_ANT_2
Returns:
RIG_OK or < 0 We support Ant_1 and Ant_2 for M and S receivers.
Note that Rx-only antenna (Ant_3?) is not supported at this time.
Orion command assigns MSBN (main rtx, sub rx, both, or none) to each ant, but hamlib wants to assign an ant to rx/tx! The efficient way would be to keep current config in rig priv area, but we will ask the rig what its state is each time...

static int tt565_set_freq ( RIG rig,
vfo_t  vfo,
freq_t  freq 
)

Set a frequence into the specified VFO.

Parameters:
rig must != NULL
vfo RIG_VFO_A or RIG_VFO_B
freq assumes rig->state.priv!=NULL
assumes priv->mode in AM,CW,LSB or USB.

static int tt565_set_func ( RIG rig,
vfo_t  vfo,
setting_t  func,
int  status 
)

Set an Orion "function".

Parameters:
rig != NULL
vfo 
func Identifier for function to be performed
status data for function
Returns:
RIG_OK or < 0 Note that vfo must == RIG_VFO_CURR
Supported functions & data
RIG_FUNC_TUNER, off/on, 0/1
RIG_FUNC_VOX, off/on, 0/1
RIG_FUNC_LOCK, unlock/lock, 0/1
RIG_FUNC_NB, off/on, 0/1 (sets Orion NB=0 or =4), compare RIG_LEVEL_NR

static int tt565_set_level ( RIG rig,
vfo_t  vfo,
setting_t  level,
value_t  val 
)

Sets any of Orion's "Level" adjustments.

Parameters:
rig must != NULL
vfo 
level A level id token, e.g. RIG_LEVEL_AF
val Value for the level, on a scale or via a token
Returns:
RIG_OK or < 0 Unfortunately, "val" type is not well defined. Sometimes it is a float (AF gain), an integer (RF Atten.), or an enum (RIG_AGC_FAST)...
Supported Levels and Units
-RIG_LEVEL_RFPOWER, float 0.0 - 1.0
-RIG_LEVEL_AGC, int RIG_AGC_x, x= OFF, FAST, MEDIUM, SLOW, USER
-RIG_LEVEL_AF, float 0.0 - 1.0
-RIG_LEVEL_IF, passband tuning, int Hz
-RIG_LEVEL_RF, IF gain (!), float 0.0 - 1.0
-RIG_LEVEL_ATT, Atten. setting, int dB (we pick 0, 6, 12, or 18 dB)
-RIG_LEVEL_PREAMP, Preamp on/off, 0-1 (main Rx only)
-RIG_LEVEL_SQL, squelch, float 0.0 - 1.0
-RIG_LEVEL_MICGAIN, float 0.0 - 1.0
-RIG_LEVEL_COMP, speech compression, float 0.0 - 1.0
-RIG_LEVEL_CWPITCH, int Hz
-RIG_LEVEL_KEYSPD, int wpm
-RIG_LEVEL_NR, noise reduction/blank, float 0.0 - 1.0
-RIG_LEVEL_VOX, vox delay, float x 1/10 second
-RIG_LEVEL_VOXGAIN, float 0.0 - 1.0
-RIG_LEVEL_ANTIVOX, float 0.0 - 1.0


FIXME: cannot support PREAMP and ATT both at same time (make sens though)

static int tt565_set_mem ( RIG rig,
vfo_t  vfo,
int  ch 
)

This only sets the current memory channel locally. No Orion I/O.

Parameters:
rig !=NULL
vfo 
ch Channel number
Returns:
RIG_OK Use RIG_OP_TO_VFO and RIG_OP_FROM_VFO to get/store a freq in the channel.
See also:
tt565_vfo_op

static int tt565_set_mode ( RIG rig,
vfo_t  vfo,
rmode_t  mode,
pbwidth_t  width 
)

Set operating mode to RIG_MODE_x with indicated passband width.

Parameters:
rig must != NULL
vfo 
mode 
width passband in Hz or = RIG_PASSBAND_NORMAL (=0) which gives a nominal value Supported modes x= USB, LSB, CW, CWR, AM, FM, RTTY
This applies to currently selected receiver (Main Rx=Tx or Sub Rx)
See also:
tt565_set_vfo
Remarks:
Note widespread confusion between "VFO" and "Receiver". The Orion has VFOs A and B which may be mapped to Main and Sub Receivers independently. But Hamlib may have different ideas!

static int tt565_set_ptt ( RIG rig,
vfo_t  vfo,
ptt_t  ptt 
)

Set push to talk (Tx on/off).

Parameters:
rig must != NULL
vfo 
ptt RIG_PTT_ON or RIG_PTT_OFF
Returns:
RIG_OK or < 0

static int tt565_set_rit ( RIG rig,
vfo_t  vfo,
shortfreq_t  rit 
)

Set Rx incremental tuning.

Parameters:
rig must != NULL
vfo 
rit Rx incremental tuning, Hz
Returns:
RIG_OK or < 0

static int tt565_set_split_vfo ( RIG rig,
vfo_t  vfo,
split_t  split,
vfo_t  tx_vfo 
)

Set split operating mode.

Parameters:
rig must != NULL
vfo Rx vfo specifier token
split (ignored - why?)
tx_vfo Tx vfo specifier token
Returns:
RIG_OK or < 0 Sets Main Rx to "vfo"( A or B) , Main Tx to "tx_vfo" (A, B, or N).
Sub Rx is set to "None". That should be fixed!

static int tt565_set_ts ( RIG rig,
vfo_t  vfo,
shortfreq_t  ts 
)

Set Tuning Step for VFO A or B.

Parameters:
rig must != NULL
vfo 
ts Tuning Step, Hz
Returns:
RIG_OK or < 0

static int tt565_set_vfo ( RIG rig,
vfo_t  vfo 
)

set RIG_VFO_CURR and send info to physical rig.

Parameters:
rig must != NULL
vfo RIG_VFO_MAIN or RIG_VFO_SUB
Returns:
RIG_OK or < 0 Places Orion into Main or Sub Rx active state

static int tt565_set_xit ( RIG rig,
vfo_t  vfo,
shortfreq_t  xit 
)

Set Tx incremental tuning (Main TRx only).

Parameters:
rig must != NULL
vfo 
xit Tx incremental tuning, Hz
Returns:
RIG_OK or < 0

int tt565_transaction ( RIG rig,
const char *  cmd,
int  cmd_len,
char *  data,
int *  data_len 
)

tt565_transaction, adapted from tentec_transaction (tentec.c)

Parameters:
rig Rig descriptor
cmd command to send
cmd_len length of command string
data string to receive return data from Orion (NULL if no return desired)
data_len length of data string
Returns:
RIG_OK or < 0 if error This is the basic I/O transaction to/from the Orion.
Read variable number of bytes, up to buffer size, if data & data_len != NULL.
We assume that rig!=NULL, rig->state!= NULL. Otherwise, you'll get a nice seg fault. You've been warned!

static int tt565_vfo_op ( RIG rig,
vfo_t  vfo,
vfo_op_t  op 
)

perform a RIG_OP operation

Parameters:
rig != NULL
vfo 
op Operation to perform, a RIG_OP token
Returns:
RIG_OK or < 0 Supported operations:
RIG_OP_TO_VFO memory channel to VFO (includes bw, mode, etc)
RIG_OP_FROM_VFO stores VFO (& other data) to memory channel
RIG_OP_TUNE initiates a tuner cycle (if tuner present) MAY BE BROKEN
RIG_OP_UP increment VFO freq by tuning step
RIG_OP_DOWN decrement VFO freq by tuning step


Variable Documentation

tt565 transceiver capabilities.

All of the Orion's personality is defined here!

Protocol is documented at Tentec's firmware site http://www.rfsquared.com/


Hamlib documentation for version 1.2.8 -- Mon Dec 15 18:03:30 2008
Project page: http://hamlib.org