4 * Copyright (C) 2013-06-10 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.
35 #include <pic18fregs.h> /* ONLY FOR PIC18x */
46 #include "lcd_acm1602.h"
54 void setfreq_updown(unsigned char ctlword)
57 if((ctlword != charcode_e) && (ctlword >= charcode_1)
58 && (ctlword <= charcode_f)) {
59 backlight_counter = backlight_long;
60 lcd_setbacklight(0xff, backlight_level); // Turn ON
61 } else if(ctlword == charcode_e){
62 if(backlight_counter != 0){
63 backlight_counter = 0;
65 backlight_counter = backlight_long;
72 case charcode_8: // Change band
74 amfreq_bank[amband] = amfreq;
75 if(amband >= AKC6955_BAND_MW4) {
80 akc6955_set_amband(amband);
81 freq = amfreq_bank[amband];
83 fmfreq_bank[fmband] = fmfreq;
84 if(fmband >= AKC6955_BAND_FMUSER) {
89 freq = fmfreq_bank[fmband];
90 akc6955_set_fmband(fmband);
92 idle_time_62_5ms(); // 62.5ms
94 akc6955_set_freq(freq);
96 case charcode_2: // Change band
98 amfreq_bank[amband] = amfreq;
100 amband = AKC6955_BAND_MW4;
104 akc6955_set_amband(amband);
105 freq = amfreq_bank[amband];
107 fmfreq_bank[fmband] = fmfreq;
109 fmband = AKC6955_BAND_FMUSER;
113 freq = fmfreq_bank[fmband];
114 akc6955_set_fmband(fmband);
116 idle_time_62_5ms(); // 62.5ms
118 akc6955_set_freq(freq);
120 case charcode_4: // Down Freq;
121 akc6955_down_freq(30);
123 case charcode_6: // Down Freq;
126 case charcode_9: // Down Fast;
127 akc6955_up_freq(100);
129 case charcode_7: // Down Fast;
130 akc6955_down_freq(100);
132 case charcode_1: // Down Slow;
134 freq = 3; // DOWN 30KHz
136 if(amband == AKC6955_BAND_MW2) {
138 } else if(amband == AKC6955_BAND_MW3) {
140 } else if(am_mode3k == 0x00) {
141 freq = 3; // DOWN 50KHz
143 freq = 5; // DOWN 50KHz
146 akc6955_down_freq(3);
148 case charcode_3: // Down Slow;
150 freq = 3; // DOWN 30KHz
152 if(amband == AKC6955_BAND_MW2) {
154 } else if(amband == AKC6955_BAND_MW3) {
156 } else if(am_mode3k == 0x00) {
157 freq = 3; // DOWN 50KHz
159 freq = 5; // DOWN 50KHz
164 case charcode_0: // Step
171 akc6955_mode3k(am_mode3k);
174 case charcode_a: // Toggle FM
200 amband = akc6955_get_amband();
201 amfreq = akc6955_get_freq();
202 amfreq_bank[amband] = amfreq;
204 fmband = akc6955_get_fmband();
205 fmfreq = akc6955_get_freq();
206 fmfreq_bank[fmband] = fmfreq;