4 * Copyright (C) 2013-06-21 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"
35 void toggle_amfm(void)
40 setup.fmfreq_bank[setup.fmband] = setup.fmfreq;
41 // akc6955_set_amband(amband);
42 freq = setup.amfreq_bank[setup.amband];
45 setup.amfreq_bank[setup.amband] = setup.amfreq;
46 // akc6955_set_fmband(fmband);
47 freq = setup.fmfreq_bank[setup.fmband];
49 akc6955_chg_fm(setup.fm, freq);
51 // akc6955_set_freq(freq);
56 void set_stereomode(void)
60 if(setup.stereo == 0x00){
61 mode.b0 = 1; // Force mono
62 } else if(setup.stereo < 0x80){
63 mode.b1 = 1; // Force stereo
65 akc6955_set_stereomode(mode.byte);
71 if(setup.stereo == 0xff) {// Force Mono
73 } else if(setup.stereo == 0x00) { //Mono->Stereo
75 } else { // Default, Stereo->auto
81 void setfreq_direct(void)
86 printstr("Set Freq:");
92 val = read_numeric(val, 5, 7, 1);
93 if((val & 0x80000000) != 0) return;
99 val = read_numeric(val, 5, 7, 1);
100 if((val & 0x80000000) != 0) return;
103 akc6955_set_freq(val);
106 void setband_direct(void)
114 printstr("Set Band:FM#");
115 band2 = setup.fmband & 7;
116 setup.fmfreq_bank[setup.fmband] = setup.fmfreq;
117 band2 = pollkey_numeric(band2);
119 setup.fmband = band2 & 7;
120 setup.fmfreq = setup.fmfreq_bank[setup.fmband];
121 akc6955_set_fmband(setup.fmband);
124 akc6955_set_fmband(setup.fmband);
127 printstr("Set Band:AM#");
128 band = setup.amband & 0x1f;
129 setup.amfreq_bank[setup.amband] = setup.amfreq;
130 band = read_numeric(band, 2, 7, 1);
131 if((band & 0x80000000) != 0) return;
132 setup.amband = band & 0x1f;
133 setup.amfreq = setup.amfreq_bank[setup.amband];
135 case AKC6955_BAND_LW:
136 case AKC6955_BAND_MW2:
137 setup.am_mode3k = 0xff;
139 case AKC6955_BAND_MW1:
140 case AKC6955_BAND_MW3:
141 case AKC6955_BAND_MW4:
142 setup.am_mode3k = 0x00;
148 akc6955_set_amband(setup.amband);
152 akc6955_set_freq(freq);
155 void menu_poweroff(void)
158 c = printhelp_2lines("Poweroff", "A=Yes");
159 if(c == charcode_a) {
164 void setup_akc6955(void)
166 akc6955_writecmd(AKC6955_POWER, 0xc0); // You musto *not* mute, set b2 to '0".
167 akc6955_writecmd(AKC6955_VOLUME, 0xc0); // You must select to radio(b1 = '0).
169 akc6955_set_amband(setup.amband);
170 if(setup.amband == AKC6955_BAND_AMUSER) call_userband(setup.am_userbandnum);
171 setup.amfreq = setup.amfreq_bank[setup.amband];
172 akc6955_chg_fm(0, setup.amfreq); // Set to AM
173 akc6955_set_freq(setup.amfreq);
175 akc6955_set_fmband(setup.fmband);
176 if(setup.fmband == AKC6955_BAND_FMUSER) call_userband(setup.fm_userbandnum);
177 setup.fmfreq = setup.fmfreq_bank[setup.fmband];
178 akc6955_chg_fm(0xff, setup.fmfreq); // Set to AM
179 akc6955_set_freq(setup.fmfreq);
180 }// Dummy, TBS (954KHz)
181 akc6955_set_power(0xff); // Power ON
182 akc6955_setvolume(36); // Temporally
183 akc6955_set_thresh_fmcnr(setup.threshold_fmcnr);
184 akc6955_set_thresh_amcnr(setup.threshold_amcnr);
185 akc6955_set_thresh_width(setup.threshold_width);
186 akc6955_set_thresh_fmstereo(setup.threshold_fmstereo);
187 akc6955_setvolumemode(0);
188 akc6955_set_lowboost(setup.lowboost);
193 * Main Menu : initial-screen -> 'F'.
202 printhelp_2lines("Menu:F=HELP", "B=CANCEL");
203 c = pollkey_single(); // 1012ms
231 freq = akc6955_get_freq();
232 akc6955_set_freq(freq);