~ubuntu-branches/ubuntu/wily/flrig/wily

« back to all changes in this revision

Viewing changes to .pc/0001-License-Declaration.patch/src/rigs/FT1000.cxx

  • Committer: Package Import Robot
  • Author(s): Kamal Mostafa
  • Date: 2014-10-25 11:17:10 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20141025111710-n32skgya3l9u1brw
Tags: 1.3.17-1
* New upstream release (Closes: #761839)
* Debian Standards-Version: 3.9.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Yaesu FT-1000 drivers
3
 
 *
4
 
 * a part of flrig
5
 
 *
6
 
 * Copyright 2009, Dave Freese, W1HKJ
7
 
 *
8
 
 */
9
 
 
10
 
#include "FT1000.h"
11
 
 
12
 
static const char FT1000name_[] = "FT-1000 **";
13
 
 
14
 
static const char *FT1000modes_[] = {
15
 
        "LSB", "USB", "CW-2.4", "CW-500", "AM-6", 
16
 
        "AM-2.4", "FM", "FM", "RTTY-L", "RTTY-U",
17
 
        "PKT-LSB", "PKT-FM", NULL};
18
 
 
19
 
static const char FT1000_mode_type[] = {
20
 
        'L', 'U', 'L', 'L', 'U', 
21
 
        'U', 'U', 'U', 'L', 'U',
22
 
        'L', 'U' };
23
 
 
24
 
static const char *FT1000_widths[] = {
25
 
"2400", "2000", "500", "250", "6000", NULL };
26
 
 
27
 
 
28
 
// FT1000 class
29
 
RIG_FT1000::RIG_FT1000() {
30
 
// base class values
31
 
        name_ = FT1000name_;
32
 
        modes_ = FT1000modes_;
33
 
        bandwidths_ = FT1000_widths;
34
 
        comm_baudrate = BR4800;
35
 
        stopbits = 2;
36
 
        comm_retries = 2;
37
 
        comm_wait = 5;
38
 
        comm_timeout = 50;
39
 
        serloop_timing = 5000; // every 5 seconds FT1000 is a very slow beast!
40
 
        comm_rtscts = false;
41
 
        comm_rtsplus = false;
42
 
        comm_dtrplus = true;
43
 
        comm_catptt = true;
44
 
        comm_rtsptt = false;
45
 
        comm_dtrptt = false;
46
 
        modeA = 1;
47
 
        bwA = 0;
48
 
 
49
 
        has_mode_control =
50
 
        has_bandwidth_control =
51
 
        has_ptt_control =
52
 
        has_tune_control = true;
53
 
 
54
 
        precision = 10;
55
 
        ndigits = 7;
56
 
 
57
 
};
58
 
 
59
 
// from hamlib
60
 
/*
61
 
yaesu_cmd_set_t
62
 
  { 0x00, 0x00, 0x00, 0x00, 0x01 }, // Split (OFF) 
63
 
  { 0x00, 0x00, 0x00, 0x01, 0x01 }, // Split (On)  
64
 
  { 0x00, 0x00, 0x00, 0x00, 0x02 }, // Recall Memory 
65
 
  { 0x00, 0x00, 0x00, 0x00, 0x03 }, // Memory Operations 
66
 
  { 0x00, 0x00, 0x00, 0x00, 0x04 }, // Lock (OFF) 
67
 
  { 0x00, 0x00, 0x00, 0x01, 0x04 }, // Lock (ON) 
68
 
  { 0x00, 0x00, 0x00, 0x00, 0x05 }, // Select VFO (A) 
69
 
  { 0x00, 0x00, 0x00, 0x01, 0x05 }, // Select VFO (B) 
70
 
  { 0x00, 0x00, 0x00, 0x00, 0x06 }, // Copy Memory Data to VFO A 
71
 
  { 0x00, 0x00, 0x00, 0x00, 0x07 }, // OP Freq Up 0.1MHz 
72
 
  { 0x00, 0x00, 0x01, 0x00, 0x07 }, // OP Freq Up 1MHz 
73
 
  { 0x00, 0x00, 0x00, 0x00, 0x08 }, // OP Freq Down 0.1MHz 
74
 
  { 0x00, 0x00, 0x01, 0x00, 0x08 }, // OP Freq Down 1MHz 
75
 
  { 0x00, 0x00, 0x00, 0x00, 0x09 }, // RX Clarifier (OFF) 
76
 
  { 0x00, 0x00, 0x00, 0x01, 0x09 }, // RX Clarifier (ON) 
77
 
  { 0x00, 0x00, 0x00, 0x80, 0x09 }, // TX Clarifier (OFF) 
78
 
  { 0x00, 0x00, 0x00, 0x81, 0x09 }, // TX Clarifier (ON) 
79
 
  { 0x00, 0x00, 0x00, 0xff, 0x09 }, // Clear Clarifier Offset 
80
 
  { 0x00, 0x00, 0x00, 0x00, 0x09 }, // Clarifier 
81
 
  { 0x00, 0x00, 0x00, 0x00, 0x0a }, // Set Op Freq 
82
 
  { 0x00, 0x00, 0x00, 0x00, 0x0c }, // OP Mode Set LSB 
83
 
  { 0x00, 0x00, 0x00, 0x01, 0x0c }, // OP Mode Set USB 
84
 
  { 0x00, 0x00, 0x00, 0x02, 0x0c }, // OP Mode Set CW 2.4KHz 
85
 
  { 0x00, 0x00, 0x00, 0x03, 0x0c }, // OP Mode Set CW 500Hz 
86
 
  { 0x00, 0x00, 0x00, 0x04, 0x0c }, // OP Mode Set AM 6KHz 
87
 
  { 0x00, 0x00, 0x00, 0x05, 0x0c }, // OP Mode Set AM 2.4KHz 
88
 
  { 0x00, 0x00, 0x00, 0x06, 0x0c }, // OP Mode Set FM 
89
 
  { 0x00, 0x00, 0x00, 0x08, 0x0c }, // OP Mode Set RTTY LSB 
90
 
  { 0x00, 0x00, 0x00, 0x09, 0x0c }, // OP Mode Set RTTY USB 
91
 
  { 0x00, 0x00, 0x00, 0x0a, 0x0c }, // OP Mode Set PKT LSB 
92
 
  { 0x00, 0x00, 0x00, 0x0b, 0x0c }, // OP Mode Set PKT FM 
93
 
  { 0x00, 0x00, 0x00, 0x00, 0x0e }, // Pacing 
94
 
  { 0x00, 0x00, 0x00, 0x00, 0x0f }, // PTT (OFF) 
95
 
  { 0x00, 0x00, 0x00, 0x01, 0x0f }, // PTT (ON) 
96
 
  { 0x00, 0x00, 0x00, 0x00, 0x10 }, // Update All Data (1508 bytes) 
97
 
  { 0x00, 0x00, 0x00, 0x01, 0x10 }, // Update Memory Ch Number 
98
 
  { 0x00, 0x00, 0x00, 0x02, 0x10 }, // Update Op Data 
99
 
  { 0x00, 0x00, 0x00, 0x03, 0x10 }, // Update VFO Data 
100
 
  { 0x00, 0x00, 0x00, 0x04, 0x10 }, // Update Memory Ch Data 
101
 
  { 0x00, 0x00, 0x00, 0x00, 0x81 }, // Tuner (OFF) 
102
 
  { 0x00, 0x00, 0x00, 0x01, 0x81 }, // Tuner (ON) 
103
 
  { 0x00, 0x00, 0x00, 0x00, 0x82 }, // Tuner (Start) 
104
 
  { 0x00, 0x00, 0x00, 0x00, 0x84 }, // Repeater Mode (OFF) 
105
 
  { 0x00, 0x00, 0x00, 0x01, 0x84 }, // Repeater Mode (Minus) 
106
 
  { 0x00, 0x00, 0x00, 0x02, 0x84 }, // Repeater Mode (Plus) 
107
 
  { 0x00, 0x00, 0x00, 0x00, 0x85 }, // Copy displayed VFO (A=B || B=A) 
108
 
  { 0x00, 0x00, 0x00, 0x00, 0x8C }, // Select Bandwidth 
109
 
  { 0x00, 0x00, 0x00, 0x00, 0x8E }, // Step Operating Frequency Up 
110
 
  { 0x00, 0x00, 0x00, 0x01, 0x8E }, // Step Operating Frequency Down 
111
 
  { 0x00, 0x00, 0x00, 0x00, 0xf7 }, // Read Meter 
112
 
  { 0x00, 0x00, 0x00, 0x00, 0xf8 }, // DIM Level 
113
 
  { 0x00, 0x00, 0x00, 0x00, 0xf9 }, // Set Offset for Repeater Shift 
114
 
  { 0x00, 0x00, 0x00, 0x00, 0xfa }, // Read Status Flags 
115
 
*/
116
 
 
117
 
void RIG_FT1000::init_cmd()
118
 
{
119
 
        cmd = "00000";
120
 
        for (size_t i = 0; i < 5; i++) cmd[i] = 0;
121
 
}
122
 
 
123
 
int  RIG_FT1000::adjust_bandwidth(int m)
124
 
{
125
 
        if (m == 0 || m == 1 || m == 8 || m == 9 || m == 10 || m == 11)
126
 
                return 0;
127
 
        if ( m == 3 ) return 0;
128
 
        if ( m == 4 ) return 2;
129
 
        if ( m == 4 ) return 4;
130
 
        if ( m == 5 ) return 0;
131
 
        if ( m == 6 || m == 7 || m == 11) return 0;
132
 
        return 0;
133
 
}
134
 
 
135
 
long RIG_FT1000::get_vfoA ()
136
 
{
137
 
        init_cmd();
138
 
        cmd[3] = 2; cmd[4] = 0x10;
139
 
        int ret = sendCommand(cmd);
140
 
        if (ret < 17) return freqA;
141
 
        replybuff[9] = 0;
142
 
        freqA = fm_bcd(&replybuff[6], 8) * 10;
143
 
        bwA = replybuff[13] & 0x07;
144
 
        return freqA;
145
 
}
146
 
 
147
 
void RIG_FT1000::set_vfoA (long freq)
148
 
{
149
 
        freqA = freq;
150
 
        freq /=10; // 1000 does not support 1 Hz resolution
151
 
        cmd = to_bcd(freq, 8);
152
 
        cmd += 0x0A;
153
 
        sendCommand(cmd, 0);
154
 
}
155
 
 
156
 
int RIG_FT1000::get_modeA()
157
 
{
158
 
        init_cmd();
159
 
        cmd[4] = 0x0C;
160
 
        int ret = sendCommand(cmd);
161
 
        if (ret < 5) return modeA;
162
 
        modeA = cmd[4];
163
 
        return modeA;
164
 
}
165
 
 
166
 
void RIG_FT1000::set_modeA(int val)
167
 
{
168
 
        modeA = val;
169
 
        init_cmd();
170
 
        cmd[3] = val;
171
 
        cmd[4] = 0x0C;
172
 
        sendCommand(cmd, 0);
173
 
}
174
 
 
175
 
int RIG_FT1000::get_modetype(int n)
176
 
{
177
 
        return FT1000_mode_type[n];
178
 
}
179
 
 
180
 
void RIG_FT1000::set_bwA(int n)
181
 
{
182
 
        init_cmd();
183
 
        cmd[3] = n;
184
 
        cmd[4] = 0x8C;
185
 
        sendCommand(cmd, 0);
186
 
        bwA = n;
187
 
}
188
 
 
189
 
int RIG_FT1000::get_bwA()
190
 
{
191
 
        return bwA;
192
 
}
193
 
 
194
 
// Tranceiver PTT on/off
195
 
void RIG_FT1000::set_PTT_control(int val)
196
 
{
197
 
        init_cmd();
198
 
        if (val) cmd[3] = 1;
199
 
        else     cmd[3] = 0;
200
 
        cmd[4] = 0x0F;
201
 
        sendCommand(cmd, 0);
202
 
}
203
 
 
204
 
void RIG_FT1000::tune_rig()
205
 
{
206
 
        init_cmd();
207
 
        cmd[4] = 0x82;
208
 
        sendCommand(cmd, 0);
209
 
}
210
 
 
211
 
int  RIG_FT1000::get_power_out(void)
212
 
{
213
 
        init_cmd();
214
 
        cmd[4] = 0xF7;
215
 
        int ret = sendCommand(cmd);
216
 
        if (ret < 5) return 0;
217
 
        return replybuff[0] && 0x0F;
218
 
}
219
 
 
220
 
int  RIG_FT1000::get_smeter(void)
221
 
{
222
 
        init_cmd();
223
 
        cmd[4] = 0xF7;
224
 
        int ret = sendCommand(cmd);
225
 
        if (ret < 5) return 0;
226
 
        return replybuff[0] && 0x0F;
227
 
}
228