MAXREFDES71# Code Documentation
V01.00
MAXREFDES71# 2-Channel Analog Input/Analog Output
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Macros
Pages
menu.c
Go to the documentation of this file.
1
29
/*
30
* Copyright (C) 2012 Maxim Integrated Products, Inc., All Rights Reserved.
31
*
32
* Permission is hereby granted, free of charge, to any person obtaining a
33
* copy of this software and associated documentation files (the "Software"),
34
* to deal in the Software without restriction, including without limitation
35
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
36
* and/or sell copies of the Software, and to permit persons to whom the
37
* Software is furnished to do so, subject to the following conditions:
38
*
39
* The above copyright notice and this permission notice shall be included
40
* in all copies or substantial portions of the Software.
41
*
42
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
43
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
* IN NO EVENT SHALL MAXIM INTEGRATED PRODUCTS BE LIABLE FOR ANY CLAIM, DAMAGES
46
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
47
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
48
* OTHER DEALINGS IN THE SOFTWARE.
49
*
50
* Except as contained in this notice, the name of Maxim Integrated Products
51
* shall not be used except as stated in the Maxim Integrated Products
52
* Branding Policy.
53
*
54
* The mere transfer of this software does not imply any licenses
55
* of trade secrets, proprietary technology, copyrights, patents,
56
* trademarks, maskwork rights, or any other form of intellectual
57
* property whatsoever. Maxim Integrated Products retains all ownership rights.
58
*
59
***************************************************************************/
60
61
#include <stdio.h>
62
#include "
platform.h
"
63
#include "xparameters.h"
64
#include "
utilities.h
"
65
#include "string.h"
66
#include "
MAXREFDES71.h
"
67
#include "
maximDeviceSpecificUtilities.h
"
68
#include "
menu.h
"
69
70
void
menu_cls
()
78
{
79
// The following code will cause a clear screen event on Hyperterminal and many other terminal emulators
80
printf(
"\033[2J"
);
81
}
82
83
84
void
menu_print_maxim_banner
()
92
{
93
printf(
"\r\n"
);
94
printf(
"///////////////////////////////////////////////////////////////////\r\n"
);
95
printf(
"// _____ _____ //\r\n"
);
96
printf(
"// / __ \\ / __ \\ //\r\n"
);
97
printf(
"// | | \\/ / / | | //\r\n"
);
98
printf(
"// | | / / | | //\r\n"
);
99
printf(
"// | | / \\ | | //\r\n"
);
100
printf(
"// | | / /\\ \\ | | //\r\n"
);
101
printf(
"// |_| /_/ \\_\\ |_| //\r\n"
);
102
printf(
"// //\r\n"
);
103
printf(
"///////////////////////////////////////////////////////////////////\r\n"
);
104
printf(
"\r\n"
);
105
}
106
107
108
void
menu_print_maxim_banner_big
()
116
{
117
printf(
"\r\n"
);
118
printf(
"///////////////////////////////////////////////////////////////////\r\n"
);
119
printf(
"// ### ### //\r\n"
);
120
printf(
"// ## ## //\r\n"
);
121
printf(
"// //\r\n"
);
122
printf(
"// ## _____ _____ ## //\r\n"
);
123
printf(
"// / __ \\ / __ \\ //\r\n"
);
124
printf(
"// ## | | \\/ / / | | ## //\r\n"
);
125
printf(
"// | | / / | | //\r\n"
);
126
printf(
"// | | / \\ | | //\r\n"
);
127
printf(
"// ## | | / /\\ \\ | | ## //\r\n"
);
128
printf(
"// |_| /_/ \\_\\ |_| //\r\n"
);
129
printf(
"// ## ## //\r\n"
);
130
printf(
"// //\r\n"
);
131
printf(
"// ## ## //\r\n"
);
132
printf(
"// ### ### //\r\n"
);
133
printf(
"// //\r\n"
);
134
printf(
"// M A X I M I N T E G R A T E D //\r\n"
);
135
printf(
"// //\r\n"
);
136
printf(
"///////////////////////////////////////////////////////////////////\r\n"
);
137
138
printf(
"\r\n\r\n"
);
139
}
140
141
void
menu_print_prompt
()
149
{
150
printf(
"\r\n>> "
);
151
fflush(stdout);
152
}
153
154
155
void
menu_print_line
()
163
{
164
printf(
"----------------------------------------------------\r\n\r\n"
);
165
}
166
167
168
u8
menu_retrieve_keypress
(u32 nUartAddress)
181
{
182
u8 uchInput;
183
184
uchInput =
getUartByte
(nUartAddress);
185
186
if
(uchInput==27)
// Escape sequence (likely an arrow key)
187
{
188
uchInput =
getUartByte
(nUartAddress);
189
if
(uchInput==91)
// Left bracket (part #2 of the 3 part escape sequence)
190
{
191
uchInput =
getUartByte
(nUartAddress);
192
if
(uchInput==65)
193
uchInput =
KEYPRESS_ARROW_UP
-10;
194
if
(uchInput==66)
195
uchInput =
KEYPRESS_ARROW_DOWN
-10;
196
if
(uchInput==67)
197
uchInput =
KEYPRESS_ARROW_RIGHT
-10;
198
if
(uchInput==68)
199
uchInput =
KEYPRESS_ARROW_LEFT
-10;
200
if
(uchInput==75)
201
uchInput =
KEYPRESS_END
- 10;
202
}
203
}
204
else
if
(uchInput>=48 && uchInput <=57)
// digits 0..9
205
uchInput -=48;
// subtract 48 to get the real number converted from the ASCII digit
206
else
if
(uchInput>=97 && uchInput<=122)
207
uchInput -=32;
// convert lowercase to uppercase
208
209
return
(uchInput);
210
}
211
212
void
menu_print_main_menu
()
219
{
220
menu_print_maxim_banner
();
221
222
printf(
"Press a number to select operation mode:\r\n"
);
223
224
printf(
"{0} ADC Conversion \n"
\
225
"{1} Signal Replication\n"
);
226
menu_print_prompt
();
227
}
228
229
void
menu_print_ADC_menu
()
236
{
237
menu_print_maxim_banner
();
238
239
printf(
"Press a number to select sampling mode:\r\n"
);
240
241
printf(
"{0} Continuous Sampling \n"
\
242
"{1} Block Sampling\n"
);
243
menu_print_prompt
();
244
}
245
246
void
menu_print_channel_menu
()
247
{
248
menu_print_maxim_banner
();
249
250
printf(
"Press a number to select analog input channel:\r\n"
);
251
252
printf(
"{0} Channel 1\n"
\
253
"{1} Channel 2\n"
\
254
"{2} Both channels\n"
);
255
menu_print_prompt
();
256
}
257
258
void
menu_print_sample_rate_menu
()
265
{
266
menu_print_maxim_banner
();
267
268
printf(
"Press a number to select the sample rate:\r\n"
);
269
270
printf(
"{0} 1ksps\n"
\
271
"{1} 10ksps\n"
\
272
"{2} 20ksps\n"
\
273
"{3} 50ksps\n"
\
274
"{4} 100ksps\n"
\
275
"{5} 400ksps\n"
);
276
menu_print_prompt
();
277
}
278
279
void
menu_print_sample_size_menu
()
286
{
287
menu_print_maxim_banner
();
288
289
printf(
"Press a key/number to select the sample size:\r\n"
);
290
291
printf(
"{0} 65536\n"
\
292
"{1} 131072\n"
\
293
"{2} 524288\n"
\
294
"{3} 1048576\n"
);
295
menu_print_prompt
();
296
}
297
298
void
menu_print_replication_rate_menu
()
305
{
306
menu_print_maxim_banner
();
307
308
printf(
"Press a number to select replication sample rate:\r\n"
);
309
310
printf(
"{0} 1ksps\n"
\
311
"{1} 5ksps\n"
\
312
"{2} 10ksps\n"
\
313
"{3} 60.024ksps\n"
);
314
menu_print_prompt
();
315
}
src
menu.c
Generated on Mon Apr 14 2014 12:22:25 for MAXREFDES71# Code Documentation by
1.8.2