OSDN Git Service

bb0fb2fcef409f452eff78a55e95dd6fdbcf2805
[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 #include "helps.h"
53
54 #ifdef  __cplusplus
55 extern "C" {
56 #endif
57 #define USER_BAND_NUM 4
58     typedef struct {
59         unsigned char mode3k; // mode3k if am
60         unsigned char start;
61         unsigned char stop;
62         unsigned int freq;
63     } _userband_t;
64     
65 #define USER_MEMORY_NUM 22
66     typedef struct {
67         unsigned char band;
68         unsigned char fm;
69         unsigned int freq;
70     } _memoryfreq_t;
71     /*
72      * main.c
73      */
74 typedef struct {
75     unsigned int amfreq;
76     unsigned int fmfreq;
77     unsigned int amfreq_bank[AKC6955_BAND_AMEND];
78     unsigned int fmfreq_bank[AKC6955_BAND_FMEND];
79     unsigned char amband;
80     unsigned char fmband;
81     unsigned char fm;
82     unsigned char am_mode3k;
83     unsigned char am_userbandnum;
84     unsigned char fm_userbandnum;
85     unsigned char threshold_amcnr; // Reg 0x08
86     unsigned char threshold_fmcnr; // Reg 0x08
87     unsigned char threshold_width; // Reg 0x08
88     unsigned char threshold_fmstereo; // Reg 0x08
89     _userband_t am_usrbands[USER_BAND_NUM];
90     _userband_t fm_usrbands[USER_BAND_NUM];
91     banddesc am_userband_freq[USER_BAND_NUM];
92     banddesc fm_userband_freq[USER_BAND_NUM];
93     unsigned char stereo;
94     unsigned char volume;
95     unsigned char prevolume;
96     unsigned char fmbandwidth;
97     unsigned char lowboost;
98     int backlight_long;
99     int backlight_level;
100     unsigned int ui_idlecount;
101     unsigned char memorynum;
102     _memoryfreq_t memoryfreqs[USER_MEMORY_NUM];
103 } __radioset_t;
104
105     extern __radioset_t setup;
106     extern unsigned char scanflag;
107
108     extern unsigned char stereoflag;
109     extern unsigned char tuneflag;
110     extern unsigned char cnrlevel;
111     extern int diffstat;
112     extern unsigned int batlevel_6955;
113     extern unsigned int battlevel;
114
115     extern int recv_signal;
116     extern int backlight_counter;
117     extern unsigned char backlight_level;
118     extern unsigned char pollkeybuf[33];
119     extern unsigned char scanflag;
120
121     extern void update_display(void);
122     extern void update_status(void);
123     extern void save_eeprom(void);
124     extern unsigned char load_eeprom(void);
125     extern void check_eeprom(void);
126
127     extern void setfreq_updown(unsigned char ctlword);
128     extern void setdefault(void);
129
130     /*
131      * menu.c
132      */
133     extern void main_menu(void);
134     extern void input_userband(void);
135     extern void set_userband(void);
136     extern void call_userband(unsigned char num);
137     extern void setband_direct(void);
138     extern void setfreq_direct(void);
139     extern void set_stereo(void);
140
141     extern void scan_start(void);
142     extern void set_volume(void);
143     extern void toggle_amfm(void);
144     extern void setup_menu(void);
145
146     extern void print_freq(unsigned char y);
147     extern void setup_akc6955(void);
148     extern void setdefault(void);
149     extern void valinit(void);
150
151 #ifdef  __cplusplus
152 }
153 #endif
154
155 #endif  /* MENU_H */
156