const char *mainmenu_helpstr[14] = {
"Help", "F=exit any=continue",
"0: Setup", "1: Band",
- "3: Freq", "5: Scan"
- "7: Power Off", "9: Width",
- "a: AM/FM", "b: Cancel",
- "c: Set user", "d: Input user",
- "e: Reserve", "f: (Exit) Help"
+ "3: Freq", "5: "
+ "4: Call user", "6: Set user",
+ "7: Power Off", "8: Volume",
+ "9: Width", "a: AM/FM",
+ "b: Cancel","c: Set user",
+ "d: Input user","f: (Exit) Help"
};
const char *numeric_helpstr[10] = {
c = printhelp_2lines(mainmenu_helpstr[l], mainmenu_helpstr[l + 1]);
if(c == charcode_f) return;
l += 2;
- if(l >= 18) {
+ if(l >= 16) {
c = numeric_help();
if(c == charcode_f) return;
l = 0;
*/
#include "menu.h"
+#include "menu_memoryfreq.h"
#include "power.h"
#include "commondef.h"
} else if(c == charcode_3){
// Band
setfreq_direct();
+ }else if(c == charcode_4){
+ on_call_userfreq();
+ // Scan
}else if(c == charcode_5){
- scan_start();
+ // scan_start();
+ // Scan
+ }else if(c == charcode_6){
+ on_set_userfreq();
// Scan
} else if(c == charcode_7){
menu_poweroff();
unsigned char stop;
unsigned int freq;
} _userband_t;
+
+#define USER_MEMORY_NUM 22
+ typedef struct {
+ unsigned char band;
+ unsigned char fm;
+ unsigned int freq;
+ } _memoryfreq_t;
/*
* main.c
*/
int backlight_long;
int backlight_level;
unsigned int ui_idlecount;
+ _memoryfreq_t memoryfreqs[USER_MEMORY_NUM];
} __radioset_t;
extern __radioset_t setup;
p->threshold_fmcnr = 0;
p->threshold_fmstereo = 0;
p->threshold_width = 0;
- for(i = 0; i < 4; i++){
+ for(i = 0; i < USER_BAND_NUM; i++){
p->am_usrbands[i].start = 0x19;
p->am_usrbands[i].stop = 0x32;
}
- for(i = 0; i < 4; i++){
+ for(i = 0; i < USER_BAND_NUM; i++){
p->fm_usrbands[i].start = 0x19;
p->fm_usrbands[i].stop = 0x32;
}
- for(i =0; i < 18; i++){
+ for(i =0; i < AKC6955_BAND_AMEND; i++){
p->amfreq_bank[i] = ((ambands[i].end - ambands[i].start) / 2) + ambands[i].start;
}
- for(i =0; i < 8; i++){
+ for(i =0; i < AKC6955_BAND_FMEND ; i++){
p->fmfreq_bank[i] = ((fmbands[i].end - fmbands[i].start) / 2) + fmbands[i].start;
}
+ for(i = 0; i < USER_MEMORY_NUM; i++) {
+ p->memoryfreqs[i].band = AKC6955_BAND_MW2;
+ p->memoryfreqs[i].fm = 0;
+ p->memoryfreqs[i].freq = 594; // NHK1 Tokyo.
+ }
+
p->fmfreq = p->fmfreq_bank[p->fmband];
p->amfreq = p->amfreq_bank[p->amband];
p->stereo = 0xff; // Auto
--- /dev/null
+/*
+ * OpenI2CRADIO
+ * Menu sub-routines: Memory Freq.
+ * Copyright (C) 2013-08-14 K.Ohta <whatisthis.sowhat ai gmail.com>
+ * License: GPL2+LE
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ * This library / program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library; see the file COPYING. If not, write to the
+ * Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * As a special exception, if you link this(includeed from sdcc) library
+ * with other files, some of which are compiled with SDCC,
+ * to produce an executable, this library does not by itself cause
+ * the resulting executable to be covered by the GNU General Public License.
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ */
+
+#include "menu.h"
+#include "power.h"
+#include "commondef.h"
+#include "eeprom.h"
+
+
+void call_freqbank(unsigned char num)
+{
+ unsigned char _fm;
+ unsigned char _band;
+ unsigned char _userband;
+ if(num >= USER_MEMORY_NUM) return;
+ _fm = setup.memoryfreqs[num].fm;
+ _userband = setup.memoryfreqs[num].band;
+ _band = _userband & 0x1f;
+ _userband = (_userband >> 5) & 0x07;
+ if(_fm) { // AM
+ setup.fmband = _band;
+ setup.fm_userbandnum = _userband;
+ } else {
+ setup.amband = _band;
+ setup.am_userbandnum = _userband;
+ }
+ akc6955_chg_fm(_fm, setup.memoryfreqs[num].freq);
+}
+
+
+void set_freqbank(unsigned char num)
+{
+ unsigned char _fm;
+ unsigned char _band;
+ unsigned char _userband;
+ unsigned int _freq;
+
+ if(num >= USER_MEMORY_NUM) return;
+
+ _fm = setup.fm;
+ _freq = setup.amfreq;
+ _userband = setup.am_userbandnum;
+ _band = setup.amband;
+ if(_fm){
+ _userband = setup.fm_userbandnum;
+ _band = setup.fmband;
+ _freq = setup.fmfreq;
+ }
+ setup.memoryfreqs[num].fm = _fm;
+ setup.memoryfreqs[num].band = (_userband << 5) | (_band & 0x1f);
+ setup.memoryfreqs[num].freq = _freq;
+}
+
+
+void on_call_userfreq(void)
+{
+ unsigned int val = USER_MEMORY_NUM;
+ _CLS();
+ _LOCATE(0,0);
+ printstr("Mem: 00-");
+ print_numeric_nosupress(USER_MEMORY_NUM - 1, 2);
+ val = read_numeric(val, 2, 4, 1);
+ if(val >= USER_MEMORY_NUM) return;
+ call_freqbank(val);
+}
+
+void on_set_userfreq(void)
+{
+ unsigned int val = USER_MEMORY_NUM;
+ _CLS();
+ _LOCATE(0,0);
+ printstr("Set Mem: 00-");
+ print_numeric_nosupress(USER_MEMORY_NUM - 1, 2);
+ val = read_numeric(val, 2, 4, 1);
+ if(val >= USER_MEMORY_NUM) return;
+ set_freqbank(val);
+ save_eeprom();
+}
\ No newline at end of file
--- /dev/null
+/*
+ * OpenI2CRADIO
+ * Menu sub-routines: Memory Freq.
+ * Copyright (C) 2013-08-14 K.Ohta <whatisthis.sowhat ai gmail.com>
+ * License: GPL2+LE
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ * This library / program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library; see the file COPYING. If not, write to the
+ * Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * As a special exception, if you link this(includeed from sdcc) library
+ * with other files, some of which are compiled with SDCC,
+ * to produce an executable, this library does not by itself cause
+ * the resulting executable to be covered by the GNU General Public License.
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ */
+
+#ifndef MENU_MEMORYFREQ_H
+#define MENU_MEMORYFREQ_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void call_freqbank(unsigned char num);
+extern void set_freqbank(unsigned char num);
+extern void on_call_userfreq(void);
+extern void on_set_userfreq(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MENU_MEMORYFREQ_H */
+
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE}
# Source Files Quoted if spaced
-SOURCEFILES_QUOTED_IF_SPACED=ui.c i2c_io.c main.c idle.c lcd_acm1602.c akc6955.c eeprom.c ioports.c menu.c power.c adc_int.c menu_defs.c eepromutil.c ui_updown.c ui_display.c radio_getstat.c helps.c
+SOURCEFILES_QUOTED_IF_SPACED=ui.c i2c_io.c main.c idle.c lcd_acm1602.c akc6955.c eeprom.c ioports.c menu.c power.c adc_int.c menu_defs.c eepromutil.c ui_updown.c ui_display.c radio_getstat.c helps.c menu_memoryfreq.c
# Object Files Quoted if spaced
-OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/ui.o ${OBJECTDIR}/i2c_io.o ${OBJECTDIR}/main.o ${OBJECTDIR}/idle.o ${OBJECTDIR}/lcd_acm1602.o ${OBJECTDIR}/akc6955.o ${OBJECTDIR}/eeprom.o ${OBJECTDIR}/ioports.o ${OBJECTDIR}/menu.o ${OBJECTDIR}/power.o ${OBJECTDIR}/adc_int.o ${OBJECTDIR}/menu_defs.o ${OBJECTDIR}/eepromutil.o ${OBJECTDIR}/ui_updown.o ${OBJECTDIR}/ui_display.o ${OBJECTDIR}/radio_getstat.o ${OBJECTDIR}/helps.o
-POSSIBLE_DEPFILES=${OBJECTDIR}/ui.o.d ${OBJECTDIR}/i2c_io.o.d ${OBJECTDIR}/main.o.d ${OBJECTDIR}/idle.o.d ${OBJECTDIR}/lcd_acm1602.o.d ${OBJECTDIR}/akc6955.o.d ${OBJECTDIR}/eeprom.o.d ${OBJECTDIR}/ioports.o.d ${OBJECTDIR}/menu.o.d ${OBJECTDIR}/power.o.d ${OBJECTDIR}/adc_int.o.d ${OBJECTDIR}/menu_defs.o.d ${OBJECTDIR}/eepromutil.o.d ${OBJECTDIR}/ui_updown.o.d ${OBJECTDIR}/ui_display.o.d ${OBJECTDIR}/radio_getstat.o.d ${OBJECTDIR}/helps.o.d
+OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/ui.o ${OBJECTDIR}/i2c_io.o ${OBJECTDIR}/main.o ${OBJECTDIR}/idle.o ${OBJECTDIR}/lcd_acm1602.o ${OBJECTDIR}/akc6955.o ${OBJECTDIR}/eeprom.o ${OBJECTDIR}/ioports.o ${OBJECTDIR}/menu.o ${OBJECTDIR}/power.o ${OBJECTDIR}/adc_int.o ${OBJECTDIR}/menu_defs.o ${OBJECTDIR}/eepromutil.o ${OBJECTDIR}/ui_updown.o ${OBJECTDIR}/ui_display.o ${OBJECTDIR}/radio_getstat.o ${OBJECTDIR}/helps.o ${OBJECTDIR}/menu_memoryfreq.o
+POSSIBLE_DEPFILES=${OBJECTDIR}/ui.o.d ${OBJECTDIR}/i2c_io.o.d ${OBJECTDIR}/main.o.d ${OBJECTDIR}/idle.o.d ${OBJECTDIR}/lcd_acm1602.o.d ${OBJECTDIR}/akc6955.o.d ${OBJECTDIR}/eeprom.o.d ${OBJECTDIR}/ioports.o.d ${OBJECTDIR}/menu.o.d ${OBJECTDIR}/power.o.d ${OBJECTDIR}/adc_int.o.d ${OBJECTDIR}/menu_defs.o.d ${OBJECTDIR}/eepromutil.o.d ${OBJECTDIR}/ui_updown.o.d ${OBJECTDIR}/ui_display.o.d ${OBJECTDIR}/radio_getstat.o.d ${OBJECTDIR}/helps.o.d ${OBJECTDIR}/menu_memoryfreq.o.d
# Object Files
-OBJECTFILES=${OBJECTDIR}/ui.o ${OBJECTDIR}/i2c_io.o ${OBJECTDIR}/main.o ${OBJECTDIR}/idle.o ${OBJECTDIR}/lcd_acm1602.o ${OBJECTDIR}/akc6955.o ${OBJECTDIR}/eeprom.o ${OBJECTDIR}/ioports.o ${OBJECTDIR}/menu.o ${OBJECTDIR}/power.o ${OBJECTDIR}/adc_int.o ${OBJECTDIR}/menu_defs.o ${OBJECTDIR}/eepromutil.o ${OBJECTDIR}/ui_updown.o ${OBJECTDIR}/ui_display.o ${OBJECTDIR}/radio_getstat.o ${OBJECTDIR}/helps.o
+OBJECTFILES=${OBJECTDIR}/ui.o ${OBJECTDIR}/i2c_io.o ${OBJECTDIR}/main.o ${OBJECTDIR}/idle.o ${OBJECTDIR}/lcd_acm1602.o ${OBJECTDIR}/akc6955.o ${OBJECTDIR}/eeprom.o ${OBJECTDIR}/ioports.o ${OBJECTDIR}/menu.o ${OBJECTDIR}/power.o ${OBJECTDIR}/adc_int.o ${OBJECTDIR}/menu_defs.o ${OBJECTDIR}/eepromutil.o ${OBJECTDIR}/ui_updown.o ${OBJECTDIR}/ui_display.o ${OBJECTDIR}/radio_getstat.o ${OBJECTDIR}/helps.o ${OBJECTDIR}/menu_memoryfreq.o
# Source Files
-SOURCEFILES=ui.c i2c_io.c main.c idle.c lcd_acm1602.c akc6955.c eeprom.c ioports.c menu.c power.c adc_int.c menu_defs.c eepromutil.c ui_updown.c ui_display.c radio_getstat.c helps.c
+SOURCEFILES=ui.c i2c_io.c main.c idle.c lcd_acm1602.c akc6955.c eeprom.c ioports.c menu.c power.c adc_int.c menu_defs.c eepromutil.c ui_updown.c ui_display.c radio_getstat.c helps.c menu_memoryfreq.c
CFLAGS=
${RM} ${OBJECTDIR}/helps.o
${MP_CC} --debug-ralloc --use-non-free --verbose -V --pstack-model=small --obanksel=2 --optimize-cmp --optimize-df libc18f.lib libio18f45k20.lib -c -mpic16 -p18f45k20 helps.c -o${OBJECTDIR}/helps.o
+${OBJECTDIR}/menu_memoryfreq.o: menu_memoryfreq.c nbproject/Makefile-${CND_CONF}.mk
+ ${MKDIR} ${OBJECTDIR}
+ ${RM} ${OBJECTDIR}/menu_memoryfreq.o
+ ${MP_CC} --debug-ralloc --use-non-free --verbose -V --pstack-model=small --obanksel=2 --optimize-cmp --optimize-df libc18f.lib libio18f45k20.lib -c -mpic16 -p18f45k20 menu_memoryfreq.c -o${OBJECTDIR}/menu_memoryfreq.o
+
else
${OBJECTDIR}/ui.o: ui.c nbproject/Makefile-${CND_CONF}.mk
${MKDIR} ${OBJECTDIR}
${RM} ${OBJECTDIR}/helps.o
${MP_CC} --debug-ralloc --use-non-free --verbose -V --pstack-model=small --obanksel=2 --optimize-cmp --optimize-df libc18f.lib libio18f45k20.lib -c -mpic16 -p18f45k20 helps.c -o${OBJECTDIR}/helps.o
+${OBJECTDIR}/menu_memoryfreq.o: menu_memoryfreq.c nbproject/Makefile-${CND_CONF}.mk
+ ${MKDIR} ${OBJECTDIR}
+ ${RM} ${OBJECTDIR}/menu_memoryfreq.o
+ ${MP_CC} --debug-ralloc --use-non-free --verbose -V --pstack-model=small --obanksel=2 --optimize-cmp --optimize-df libc18f.lib libio18f45k20.lib -c -mpic16 -p18f45k20 menu_memoryfreq.c -o${OBJECTDIR}/menu_memoryfreq.o
+
endif
# ------------------------------------------------------------------------------------
#
-#Tue Aug 13 23:15:40 JST 2013
+#Wed Aug 14 00:57:03 JST 2013
default.languagetoolchain.dir=/usr/local/bin
default.br-unifei-rmaalmeida-toolchainSDCC-SDCCtoolchain.md5=b67cce1ad75b450308d7806e430931b3
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=1c49f19f6a43b876c317e0d8d41c0854
<itemPath>radio_getstat.c</itemPath>
<itemPath>helps.c</itemPath>
<itemPath>helps.h</itemPath>
+ <itemPath>menu_memoryfreq.c</itemPath>
+ <itemPath>menu_memoryfreq.h</itemPath>
</logicalFolder>
<sourceRootList>
<Elem>/usr/local/share/sdcc/lib/src/pic16/libc</Elem>