OSDN Git Service

[Menu] Fix CNR/Stereo/FD threshold bugs.
[openi2cradio/OpenI2CRadio.git] / menu.h
1 /*
2  * OpenI2CRADIO
3  * Menu sub-routines.
4  * Copyright (C) 2013-06-21 K.Ohta <whatisthis.sowhat ai gmail.com>
5  * License: GPL2+LE
6  *
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.
15  *
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,
19  *  MA 02110-1301, USA.
20  *
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.
27  */
28
29 #ifndef MENU_H
30 #define MENU_H
31
32 #include <stdarg.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #if defined(__SDCC)
37 #include <sdcc-lib.h>
38 #include <pic18fregs.h> /* ONLY FOR PIC18x */
39 #include <delay.h>
40 #else
41 #include <xc.h>
42 #endif
43
44 #include "iodef.h"
45 #include "idle.h"
46 #include "i2c_io.h"
47 #include "akc6955.h"
48 #include "lcd_acm1602.h"
49 #include "ui.h"
50 #include "eeprom.h"
51 #include "ioports.h"
52
53 #ifdef  __cplusplus
54 extern "C" {
55 #endif
56 #define USER_BAND_NUM 4
57     typedef struct {
58         unsigned char mode3k; // mode3k if am
59         unsigned char start;
60         unsigned char stop;
61         unsigned int freq;
62     } _userband_t;
63     /*
64      * main.c
65      */
66     extern unsigned int amfreq;
67     extern unsigned int fmfreq;
68     extern unsigned int amfreq_bank[AKC6955_BAND_AMEND];
69     extern unsigned int fmfreq_bank[AKC6955_BAND_FMEND];
70     extern unsigned char amband;
71     extern unsigned char fmband;
72     extern unsigned char fm;
73     extern unsigned char am_mode3k;
74     extern unsigned char am_userbandnum;
75     extern unsigned char fm_userbandnum;
76     extern unsigned char threshold_amcnr;
77     extern unsigned char threshold_fmcnr;
78     extern unsigned char threshold_width;
79     extern unsigned char threshold_fmstereo;
80     extern unsigned char lowboost;
81     extern unsigned char stereo;
82     extern _userband_t am_usrbands[USER_BAND_NUM];
83     extern _userband_t fm_usrbands[USER_BAND_NUM];
84     extern banddesc am_userband_freq[USER_BAND_NUM];
85     extern banddesc fm_userband_freq[USER_BAND_NUM];
86     extern unsigned char volume;
87     extern unsigned char prevolume;
88     extern unsigned char fmbandwidth;
89
90     extern int backlight_long;
91     extern unsigned int ui_idlecount;
92
93
94     extern unsigned char stereoflag;
95     extern unsigned char tuneflag;
96     extern unsigned char cnrlevel;
97     extern int diffstat;
98     extern unsigned int batlevel_6955;
99     extern unsigned int battlevel;
100
101     extern int recv_signal;
102     extern int backlight_counter;
103     extern unsigned char backlight_level;
104     extern unsigned char pollkeybuf[33];
105     extern unsigned char scanflag;
106
107     extern void update_display(void);
108     extern void update_status(void);
109     extern void save_eeprom(void);
110     extern unsigned char load_eeprom(void);
111     extern void check_eeprom(void);
112
113     extern void setfreq_updown(unsigned char ctlword);
114     extern void setdefault(void);
115
116     /*
117      * menu.c
118      */
119     extern void main_menu(void);
120     extern void input_userband(void);
121     extern void set_userband(void);
122     extern void call_userband(unsigned char num);
123     extern void setband_direct(void);
124     extern void setfreq_direct(void);
125     extern void set_stereo(void);
126     extern void set_thresh_fmstereo(unsigned char a);
127     extern void set_thresh_fmcnr(unsigned char a);
128     extern void set_thresh_amcnr(unsigned char a);
129     extern void set_thresh_width(unsigned char a);
130
131     extern void scan_start(void);
132     extern void set_volume(void);
133     extern void toggle_amfm(void);
134
135     extern unsigned char printhelp_2lines(char *l1, char *l2);
136     extern void setup_menu(void);
137     extern void updown_help(void);
138     extern void mainmenu_help(void);
139     extern void print_freq(unsigned char y);
140     extern void setup_akc6955(void);
141     extern void setdefault(void);
142     extern void valinit(void);
143
144 #ifdef  __cplusplus
145 }
146 #endif
147
148 #endif  /* MENU_H */
149