Sonoma (MAXREFDES14#) Code Documentation V01.00 Isolated EMP (Energy Measurement Processor)

- 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 "MAXREFDES14.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 u8 menu_retrieve_keypress(u32 nUartAddress)
178 {
179 u8 uchInput;
180
181 uchInput = getUartByte(nUartAddress);
182
183 if(uchInput>=97 && uchInput<=122)
184 uchInput -=32; // convert lowercase to uppercase
185
186 return(uchInput);
187 }
188
189 void menu_print_main_menu()
196 {
197 menu_print_maxim_banner();
198
199 printf("Press a number to select read or write operation:\r\n");
200
201 printf("{0} Register Read\n"\
202 "{1} Register Write\n");
203
204 menu_print_prompt();
205 }
206
207