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"
36 void call_userband(unsigned char num)
46 if(num >= USER_BAND_NUM) return;
48 p = &(setup.am_usrbands[num]);
50 p = &(setup.fm_usrbands[num]);
57 ch = ((freq - 3000) / 5) * 2;
58 setup.fmband = AKC6955_BAND_FMUSER;
61 if(mode3k != 0) q = 3;
63 setup.amband = AKC6955_BAND_AMUSER;
80 akc6955_set_userband(start, end, ch, mode3k);
83 void set_userband(void)
85 unsigned long from,to;
96 if(c > charcode_0) return;
97 if(c < charcode_1) return;
101 c = c - charcode_1 + 1;
103 if(c >= USER_BAND_NUM) return;
106 from = setup.fm_usrbands[c].start * 80 + 3000; // 32*25/10
107 to = setup.fm_usrbands[c].stop * 80 + 3000;
111 print_numeric_nosupress(c, 1);
114 from = read_numeric(from, 5, 7, 1);
115 if(from >= 0x80000000) goto _l0;
118 to = read_numeric(to, 5, 7, 1);
119 if(to >= 0x80000000) goto _l0;
120 setup.fm_usrbands[c].start = (from - 3000) / 80;
121 setup.fm_usrbands[c].stop = (to - 3000) / 80;
122 setup.fm_usrbands[c].freq = from;
123 setup.fm_userbandnum = c;
125 mode3k = setup.am_usrbands[c].mode3k;
127 if(mode3k == 0) pp = 160; // 5*32
128 from = setup.am_usrbands[c].start * pp;
129 to = setup.am_usrbands[c].stop * pp;
133 print_numeric_nosupress(c, 1);
136 printstr("0=3k 1=5k");
137 cc = pollkey_single();
138 if(cc == charcode_0){
141 } else if(cc = charcode_1) {
148 print_numeric_nosupress(c, 1);
151 from = read_numeric(from, 5, 7, 1);
152 if(from >= 0x80000000) goto _l0;
155 to = read_numeric(to, 5, 7, 1);
156 if(to >= 0x80000000) goto _l0;
157 setup.am_usrbands[c].start = from / pp;
158 setup.am_usrbands[c].stop = to / pp;
159 setup.am_usrbands[c].mode3k = mode3k;
160 setup.am_usrbands[c].freq = from;
161 setup.am_userbandnum = c;
168 void input_userband(void)
172 c = printhelp_2lines("User Band", " #");
173 if((c >= charcode_a) && (c <= charcode_f)){
176 if(c == charcode_0) {
179 setup.fm_userbandnum = 0;
181 setup.am_userbandnum = 0;
185 c = c - charcode_1 + 1;
186 if(c < USER_BAND_NUM) {
189 setup.fm_userbandnum = c;
191 setup.am_userbandnum = c;
196 idle(setup.ui_idlecount);