-
Notifications
You must be signed in to change notification settings - Fork 1
/
menu.c
193 lines (176 loc) · 3.75 KB
/
menu.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*
* menu.c
*
* Created on: 29.05.2012
*****************************************************************************
* MCmega - Firmware for the Motorola MC micro radio
* to use it as an Amateur-Radio transceiver
*
* Copyright (C) 2013 Felix Erckenbrecht, DG1YFE
*
* ( AVR port of "MC70"
* Copyright (C) 2004 - 2013 Felix Erckenbrecht, DG1YFE)
*
* This file is part of MCmega.
*
* MCmega 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 3 of the License, or
* (at your option) any later version.
*
* MCmega 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 MCmega. If not, see <http://www.gnu.org/licenses/>.
*
****************************************************************************
*/
#include <stdint.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
#include "FreeRTOS.h"
#include "task.h"
#include "macros.h"
#include "regmem.h"
#include "io.h"
#include "menu.h"
#include "menu_sub.h"
#include "menu_input.h"
#include "menu_mem.h"
#include "menu_top.h"
#include "display.h"
const char m_ok_str[] PROGMEM = "OK";
const char m_no_lock_str[] PROGMEM = "NO LOCK ";
const char m_out_str[] PROGMEM = "out of";
const char m_range_str[] PROGMEM = "Range ";
const char m_writing[] PROGMEM = "writing";
const char m_stored_str[] PROGMEM = "stored";
const const char m_failed_str[] PROGMEM = "failed";
const char m_delete[] PROGMEM = "deleting";
const char m_offset[] PROGMEM = "TXSHIFT";
const char m_sq_on_str[] PROGMEM = "SQ ON";
const char m_sq_off_str[] PROGMEM = "SQ OFF";
//*****************************
// I N I T _ M E N U
//*****************************
void menu_init()
{
// initialize state variable
m_state = M_IDLE;
// disable menu timeout timer
m_timer_en = 0;
}
//
//*****************************
// M E N U
//*****************************
//
// "Men�" Subroutine
//
// Steuert die komplette Bedienung des Ger�tes
// Frequenzeingabe, Speicherkanalwahl, etc.
//
// Parameter : none
//
// Ergebnis : none
//
// changed Regs : A,B,X
//
//
void menu()
{
char c;
if( (sci_rx_m(&c) & 0x80) == 0 )
{
switch(m_state)
{
case F_IN:
m_f_in(c);
break;
case MEM_SELECT_STORE:
case MEM_SELECT:
m_mem_select(c);
break;
case MEM_STORE:
m_store_submenu(c);
break;
case MEM_RECALL_LOAD :
m_recall_submenu(c);
break;
case TXSHIFT_SW :
m_txshift(c);
break;
case TXSHIFT_DIGIT :
mts_digit(c);
break;
case MENU_SELECT:
m_submenu(c);
break;
case FREQ_DIGIT:
m_freq_digit(c);
break;
case POWER_SELECT:
m_power_submenu(c);
break;
case CONFIG_SELECT:
m_cfgsave_submenu(c);
break;
case CTCSS_SEL_RX:
case CTCSS_SEL_TX:
m_ctcss_submenu(c);
break;
case CAL:
m_cal_submenu(c);
break;
case DEBUG:
m_debug(c);
break;
case TEST:
m_test(c);
// no break
default:
case M_IDLE:
m_top(c);
break;
}
}
else
if(m_state == DEBUG)
{
m_debug(0);
}
// M_END
// check if menu timer is enabled
if (m_timer_en)
{
// if it reached zero
if(!m_timer)
{ // disable timer
m_timer_en = 0;
// restore previous display content
restore_dbuf();
// go back to IDLE state
m_state = M_IDLE;
}
}
}
void m_none(char key)
{
return;
}
//**************************************
////Eingabe Timeout zurücksetzen
void m_reset_timer()
{
m_timer = MENUTIMEOUT;
m_timer_en = 1;
}
void m_norestore()
{
m_timer_en = 0;
// go back to IDLE state
m_state = M_IDLE;
}