OSDN Git Service

[Schematic][v2.0] For v2.00. Some of circuit is changed(see diff).
[openi2cradio/OpenI2CRadio.git] / helps.c
1 /*
2  * OpenI2CRADIO
3  * Menu:HELP.
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 #include "menu.h"
30 #include "power.h"
31 #include "commondef.h"
32
33 const char *updown_helpstr[20] = {
34         "Help", "F=exit any=continue",
35         "5: Menu", " ",
36         "1: Slow Down", "3: Slow Up",
37         "4: Down", "6: Up",
38         "7: Fast Down", "9: Fast Up",
39         "2: Band Down", "8: Band Up",
40         "0: Mode3K", " ",
41         "a: AM/FM", "b: Volume",
42         "c: Scan", "d: Stereo mode",
43         "e: Backlight", "f: (Exit) Help",
44     };
45
46 const char *setup_helpstr[14] = {
47         "Help", "F=exit any=continue",
48         "0: Power OFF", "C: Save status",
49         "d: Reset default", "E: BL time",
50         "A: Load", "",
51         "1: FM CNR", "2: AM CNR"
52         "3: FM STEREO", "4: Reserve"
53         "5: Cancel", "f: (Exit) Help",
54     };
55
56 const char *mainmenu_helpstr[16] = {
57         "Help", "F=exit any=continue",
58         "0: Setup", "1: Band",
59         "3: Freq", ""
60         "4: Call user", "6: Set user",
61         "7: Power Off", "8: Volume",
62         "9: Width", "a: AM/FM",
63         "b: Cancel","c: Set user",
64         "d: Input user","f: (Exit) Help",
65 };
66
67 const char *numeric_helpstr[10] = {
68      "On numeric input", " ",
69     "0-9: Numeric", "f: enter",
70     "a: Delete", "b: Reset value",
71     "d: Left", "e: Right",
72     "Press any key", " to continue."
73 };
74
75
76 void setup_help(void)
77 {
78     unsigned char c;
79     char l;
80     l = 0;
81     do {
82         c = printhelp_2lines(setup_helpstr[l], setup_helpstr[l + 1]);
83         if(c == charcode_f) return;
84         l += 2;
85         if(l >= 16) {
86             c = numeric_help();
87             if(c == charcode_f) return;
88             l = 0;
89         }
90     } while(1);
91
92 }
93
94 unsigned char printhelp_2lines(const char *l1, const char *l2)
95 {
96     _CLS();
97     _LOCATE(0,0);
98     printstr(l1);
99     _LOCATE(0,1);
100     printstr(l2);
101     _HOME();
102     return pollkey_single();
103 }
104
105 unsigned char numeric_help(void)
106 {
107     unsigned char c;
108     char l;
109     l = 0;
110     do {
111         c = printhelp_2lines(numeric_helpstr[l], numeric_helpstr[l + 1]);
112         if(c == charcode_f) return charcode_f;
113         l += 2;
114     } while(l < 10);
115     return c;
116 }
117
118 void mainmenu_help(void)
119 {
120     unsigned char c;
121
122     char l;
123     l = 0;
124     do {
125         c = printhelp_2lines(mainmenu_helpstr[l], mainmenu_helpstr[l + 1]);
126         if(c == charcode_f) return;
127         l += 2;
128         if(l >= 16) {
129             c = numeric_help();
130             if(c == charcode_f) return;
131             l = 0;
132         }
133     } while(1);
134 }
135
136 void updown_help(void)
137 {
138     unsigned char c;
139     char l;
140
141     l = 0;
142     do {
143         c = printhelp_2lines(updown_helpstr[l], updown_helpstr[l + 1]);
144         if(c == charcode_f) return;
145         l += 2;
146         if(l >= 20) {
147             c = numeric_help();
148             if(c == charcode_f) return;
149             l = 0;
150         }
151     } while(1);
152 }