|
1 |
# Copyright 2010 Dan Smith <dsmith@danplanet.com>
|
|
2 |
#
|
|
3 |
# This program is free software: you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation, either version 3 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15 |
|
|
16 |
from chirp import chirp_common, icf, directory
|
|
17 |
from chirp import bitwise
|
|
18 |
|
|
19 |
mem_format = """
|
|
20 |
struct {
|
|
21 |
bbcd freq[3];
|
|
22 |
bbcd offset[2];
|
|
23 |
u8 unknown;
|
|
24 |
u8 rtone;
|
|
25 |
u8 ctone;
|
|
26 |
} memory[60];
|
|
27 |
|
|
28 |
#seekto 0x0270;
|
|
29 |
struct {
|
|
30 |
u8 empty:1,
|
|
31 |
tmode:2,
|
|
32 |
duplex:2,
|
|
33 |
unknown3:1,
|
|
34 |
skip:1,
|
|
35 |
unknown4:1;
|
|
36 |
} flags[60];
|
|
37 |
"""
|
|
38 |
|
|
39 |
TMODES = ["", "", "Tone", "TSQL", "TSQL"] # last one is pocket beep
|
|
40 |
DUPLEX = ["", "", "-", "+"]
|
|
41 |
MODES = ["FM"]
|
|
42 |
STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0]
|
|
43 |
|
|
44 |
@directory.register
|
|
45 |
class ICT7HRadio(icf.IcomCloneModeRadio):
|
|
46 |
VENDOR = "Icom"
|
|
47 |
MODEL = "IC-T7H"
|
|
48 |
|
|
49 |
_model = "\x18\x10\x00\x01"
|
|
50 |
_memsize = 0x03B0
|
|
51 |
_endframe = "Icom Inc\x2e"
|
|
52 |
|
|
53 |
_ranges = [(0x0000, _memsize, 16)]
|
|
54 |
|
|
55 |
def get_features(self):
|
|
56 |
rf = chirp_common.RadioFeatures()
|
|
57 |
rf.memory_bounds = (0, 59)
|
|
58 |
rf.valid_modes = list(MODES)
|
|
59 |
rf.valid_tmodes = list(TMODES)
|
|
60 |
rf.valid_duplexes = list(DUPLEX)
|
|
61 |
rf.valid_bands = [( 30000000, 823995000),
|
|
62 |
(849000000, 868995000),
|
|
63 |
(894000000, 1309995000)]
|
|
64 |
rf.valid_skips = ["", "S"]
|
|
65 |
rf.has_dtcs = False
|
|
66 |
rf.has_dtcs_polarity = False
|
|
67 |
rf.has_bank = False
|
|
68 |
rf.has_name = False
|
|
69 |
rf.has_tuning_step = False
|
|
70 |
return rf
|
|
71 |
|
|
72 |
def process_mmap(self):
|
|
73 |
self._memobj = bitwise.parse(mem_format, self._mmap)
|
|
74 |
|
|
75 |
def get_raw_memory(self, number):
|
|
76 |
return repr(self._memobj.memory[number])
|
|
77 |
|
|
78 |
def get_memory(self, number):
|
|
79 |
_mem = self._memobj.memory[number]
|
|
80 |
_flag = self._memobj.flags[number]
|
|
81 |
|
|
82 |
mem = chirp_common.Memory()
|
|
83 |
mem.number = number
|
|
84 |
|
|
85 |
mem.empty = _flag.empty == 1 and True or False
|
|
86 |
mem.freq = int(_mem.freq) * 1000
|
|
87 |
mem.offset = int(_mem.offset) * 10000
|
|
88 |
mem.rtone = chirp_common.TONES[_mem.rtone-1]
|
|
89 |
mem.ctone = chirp_common.TONES[_mem.ctone-1]
|
|
90 |
mem.tmode = TMODES[_flag.tmode]
|
|
91 |
mem.duplex = DUPLEX[_flag.duplex]
|
|
92 |
mem.mode = "FM" #MODES[_flag.mode]
|
|
93 |
if _flag.skip:
|
|
94 |
mem.skip = "S"
|
|
95 |
|
|
96 |
return mem
|
|
97 |
|
|
98 |
def set_memory(self, mem):
|
|
99 |
_mem = self._memobj.memory[mem.number]
|
|
100 |
_flag = self._memobj.flags[mem.number]
|
|
101 |
|
|
102 |
_mem.freq = mem.freq / 1000
|
|
103 |
_mem.offset = mem.offset / 10000
|
|
104 |
_mem.rtone = chirp_common.TONES.index(mem.rtone)+1
|
|
105 |
_mem.ctone = chirp_common.TONES.index(mem.ctone)+1
|
|
106 |
_flag.tmode = TMODES.index(mem.tmode)
|
|
107 |
_flag.duplex = DUPLEX.index(mem.duplex)
|
|
108 |
_flag.skip = mem.skip == "S" and 1 or 0
|
|
109 |
_flag.empty = mem.empty and 1 or 0
|