|
1 |
# Copyright 2014 Tom Hayward <tom@tomh.us>
|
|
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 bitwise, directory, ftm350
|
|
17 |
|
|
18 |
|
|
19 |
mem_format = """
|
|
20 |
struct mem {
|
|
21 |
u8 used:1,
|
|
22 |
skip:2,
|
|
23 |
unknown1:5;
|
|
24 |
u8 unknown2:1,
|
|
25 |
mode:3,
|
|
26 |
unknown8:1,
|
|
27 |
oddsplit:1,
|
|
28 |
duplex:2;
|
|
29 |
bbcd freq[3];
|
|
30 |
u8 unknownA:1,
|
|
31 |
tmode:3,
|
|
32 |
unknownB:4;
|
|
33 |
bbcd split[3];
|
|
34 |
u8 power:2,
|
|
35 |
tone:6;
|
|
36 |
u8 unknownC:1,
|
|
37 |
dtcs:7;
|
|
38 |
u8 showalpha:1,
|
|
39 |
unknown5:7;
|
|
40 |
u8 unknown6;
|
|
41 |
u8 offset;
|
|
42 |
u8 unknown7[2];
|
|
43 |
};
|
|
44 |
|
|
45 |
struct lab {
|
|
46 |
u8 string[8];
|
|
47 |
};
|
|
48 |
|
|
49 |
#seekto 0x0508;
|
|
50 |
struct {
|
|
51 |
char call[6];
|
|
52 |
u8 ssid;
|
|
53 |
} aprs_my_callsign;
|
|
54 |
|
|
55 |
#seekto 0x0480;
|
|
56 |
struct mem left_memory_zero;
|
|
57 |
#seekto 0x04A0;
|
|
58 |
struct lab left_label_zero;
|
|
59 |
#seekto 0x04C0;
|
|
60 |
struct mem right_memory_zero;
|
|
61 |
#seekto 0x04E0;
|
|
62 |
struct lab right_label_zero;
|
|
63 |
|
|
64 |
#seekto 0x080;
|
|
65 |
struct mem left_memory[500];
|
|
66 |
|
|
67 |
#seekto 0x7c00;
|
|
68 |
struct mem right_memory[500];
|
|
69 |
|
|
70 |
#seekto 0x48C0;
|
|
71 |
struct lab left_label[518];
|
|
72 |
struct lab right_label[518];
|
|
73 |
"""
|
|
74 |
|
|
75 |
|
|
76 |
@directory.register
|
|
77 |
class FTM400Radio(ftm350.FTM350Radio):
|
|
78 |
"""Yaesu FTM-400"""
|
|
79 |
BAUD_RATE = 48000
|
|
80 |
VENDOR = "Yaesu"
|
|
81 |
MODEL = "FTM-400"
|
|
82 |
|
|
83 |
def get_sub_devices(self):
|
|
84 |
return [FTM400RadioLeft(self._mmap), FTM400RadioRight(self._mmap)]
|
|
85 |
|
|
86 |
def process_mmap(self):
|
|
87 |
self._memobj = bitwise.parse(mem_format, self._mmap)
|
|
88 |
|
|
89 |
@classmethod
|
|
90 |
def match_model(self, filedata, filename):
|
|
91 |
return filedata.startswith("AH034$")
|
|
92 |
|
|
93 |
|
|
94 |
class FTM400RadioLeft(FTM400Radio):
|
|
95 |
VARIANT = "Left"
|
|
96 |
_vfo = "left"
|
|
97 |
|
|
98 |
|
|
99 |
class FTM400RadioRight(FTM400Radio):
|
|
100 |
VARIANT = "Right"
|
|
101 |
_vfo = "right"
|