3 * Menu sub-routines: Memory Freq.
4 * Copyright (C) 2013-08-14 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.
31 #include "commondef.h"
35 void call_freqbank(unsigned char num)
39 unsigned char _userband;
40 if(num >= USER_MEMORY_NUM) return;
42 _fm = setup.memoryfreqs[num].fm;
43 _userband = setup.memoryfreqs[num].band;
44 _band = _userband & 0x1f;
45 _userband = _userband >> 5;
48 setup.fm_userbandnum = _userband;
51 setup.am_userbandnum = _userband;
53 akc6955_chg_fm(_fm, setup.memoryfreqs[num].freq);
57 void set_freqbank(unsigned char num)
61 unsigned char _userband;
64 if(num >= USER_MEMORY_NUM) return;
68 _userband = setup.am_userbandnum;
71 _userband = setup.fm_userbandnum;
75 setup.memoryfreqs[num].fm = _fm;
76 setup.memoryfreqs[num].band = (_userband << 5) | (_band & 0x1f);
77 setup.memoryfreqs[num].freq = _freq;
81 void on_call_userfreq(void)
83 unsigned int val = USER_MEMORY_NUM;
87 print_numeric_nosupress(USER_MEMORY_NUM - 1, 2);
88 val = read_numeric(val, 2, 4, 1);
92 void on_set_userfreq(void)
94 unsigned int val = USER_MEMORY_NUM;
99 printstr("Set Mem: 00-");
100 print_numeric_nosupress(USER_MEMORY_NUM - 1, 2);
101 val = read_numeric(val, 2, 4, 1);
104 printstr("OK? A=OK ");
106 n = pollkeys(pollkeybuf, 19, 1);
109 if(c != charcode_a) return;
114 void on_updown_userfreq(void)
119 unsigned char _userband;
124 _freq = setup.amfreq;
125 _userband = setup.am_userbandnum;
126 _band = setup.amband;
128 _userband = setup.fm_userbandnum;
129 _band = setup.fmband;
130 _freq = setup.fmfreq;
137 print_numeric_nosupress(setup.memorynum, 2);
142 c = pollkey_single_timeout(44, 1); // About 1s
144 case charcode_8: // UP CH
146 if(setup.memorynum >= USER_MEMORY_NUM) setup.memorynum = 0;
147 call_freqbank(setup.memorynum);
149 case charcode_2: // Down CH
150 if(setup.memorynum == 0) setup.memorynum = USER_MEMORY_NUM;
152 call_freqbank(setup.memorynum);
154 case charcode_d: // Reset
156 setup.fmband = _band;
157 setup.fm_userbandnum = _userband;
158 setup.fmfreq = _freq;
160 setup.amband = _band;
161 setup.am_userbandnum = _userband;
162 setup.amfreq = _freq;
164 akc6955_chg_fm(_fm, _freq);
166 case charcode_5: // exit