3 * Menu sub-routines / USER BAND.
4 * Copyright (C) 2013-09-11 K.Ohta <whatisthis.sowhat ai gmail.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2,
10 * or (at your option) any later version.
11 * This library / program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this library; see the file COPYING. If not, write to the
18 * Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
21 * As a special exception, if you link this(includeed from sdcc) library
22 * with other files, some of which are compiled with SDCC,
23 * to produce an executable, this library does not by itself cause
24 * the resulting executable to be covered by the GNU General Public License.
25 * This exception does not however invalidate any other reasons why
26 * the executable file might be covered by the GNU General Public License.
30 #include "menu_memoryfreq.h"
32 #include "commondef.h"
33 #include "backlight.h"
34 #include "eeprom_util.h"
36 void call_userband(unsigned char num)
46 if(num >= USER_BAND_NUM) return;
49 p = &(userband.fm_usrbands[num]);
52 ch = ((freq - 3000) / 5) * 2;
53 setup.fmband = AKC6955_BAND_FMUSER;
56 p = &(userband.am_usrbands[num]);
60 if(mode3k != 0) q = 3;
62 setup.amband = AKC6955_BAND_AMUSER;
64 setup.am_mode3k = mode3k;
70 akc6955_set_userband(start, end, ch, mode3k);
73 void set_userband(void)
75 unsigned long from,to, tmp;
85 c = pollkey_numeric(c);
86 if(c >= USER_BAND_NUM) return;
89 from = userband.fm_usrbands[c].start * 80 + 3000; // 32*25/10
90 to = userband.fm_usrbands[c].stop * 80 + 3000;
94 print_numeric_nosupress(c, 1);
97 from = read_numeric(from, 5, 7, 1);
98 if((from & 0x80000000) != 0) goto _l0;
101 to = read_numeric(to, 5, 7, 1);
102 if((to & 0x80000000) != 0) goto _l0;
108 userband.fm_usrbands[c].start = (from - 3000) / 80;
109 userband.fm_usrbands[c].stop = (to - 3000) / 80 + 1;
110 userband.fm_usrbands[c].freq = from;
111 setup.fm_userbandnum = c;
113 mode3k = userband.am_usrbands[c].mode3k;
115 if(mode3k == 0) pp = 160; // 5*32
116 from = userband.am_usrbands[c].start * pp;
117 to = userband.am_usrbands[c].stop * pp;
121 print_numeric_nosupress(c, 1);
124 printstr("0=3k 1=5k");
125 cc = pollkey_single();
126 if(cc == charcode_0){
129 } else if(cc = charcode_1) {
136 print_numeric_nosupress(c, 1);
139 from = read_numeric(from, 5, 7, 1);
140 if((from & 0x80000000) != 0) goto _l0;
143 to = read_numeric(to, 5, 7, 1);
144 if((to & 0x80000000) != 0) goto _l0;
150 userband.am_usrbands[c].start = from / pp;
151 userband.am_usrbands[c].stop = to / pp + 1;
152 userband.am_usrbands[c].mode3k = mode3k;
153 userband.am_usrbands[c].freq = from;
154 setup.am_userbandnum = c;
162 void input_userband(void)
166 c = printhelp_2lines("User Band", " #");
167 if((c > charcode_a) && (c <= charcode_f)){
171 d = load_userbands();
172 if(d < 0) format_userbands();
178 setup.fm_userbandnum = c;
180 setup.am_userbandnum = c;