yuhang zhu / Mbed 2 deprecated ADAM_menu

Dependencies:   mbed

Revision:
26:5c264e20402f
Parent:
25:57de395d89aa
Child:
27:231333972023
--- a/main.cpp	Tue Jul 23 06:03:27 2013 +0000
+++ b/main.cpp	Tue Jul 23 17:55:40 2013 +0000
@@ -8,6 +8,7 @@
 This main function implements a mode transfer.
 When MCU resets, it's in MODE_IDLE. Then depends on the keyboard input(1 to 7), 
 mode switches to transition modes such as 
+MODE_SPI_RAW, which is for inputting 16 bit SPI stream directly
 MODE_CHAxPHA, which is for phase input of channel x, or
 MODE_CHAxAMP, which is for attenuation input of channel x, or
 MODE_DISPLAY, which is for displaying the current parameters, or
@@ -73,9 +74,9 @@
                 pc.printf("%s", main_menu);
                 recv = pc.getc();
                 mode_idle_handler(&state, recv);  //Change state based on recv input
-                
+                 
                 break;
-            case MODE_SPI_RAW:                    //Input the SPI raw bits
+            case MODE_SPI_RAW:                    //Input the SPI raw bits mode
                 pc.printf("%s", cmd5);
                 line_buf[3] = 255;
                 line_buf[2] = 255;
@@ -111,7 +112,7 @@
                         if(line_length > 0)
                             line_length --;
                     }
-                    else if( (recv >= '0' && recv <= '9')||(recv >= 'a' && recv <= 'f')||(recv >= 'A' && recv <= 'F') )
+                    else if( (recv >= '0' && recv <= '9')||(recv >= 'a' && recv <= 'f')||(recv >= 'A' && recv <= 'F') )  //Input one char
                     {
                         pc.putc(recv);
                         line_length ++;
@@ -125,6 +126,7 @@
                     }
                 
                 }
+            // Input over, checking
             ret = parse_spi_raw(line_buf, line_length, &cha1_pha, &cha2_pha, &cha1_amp, &cha2_amp);
             
             if(ret == PARSE_LONG)   //Input string too long
@@ -132,13 +134,13 @@
                 pc.printf("%s", msg_strlong);
                 pc.getc();
             }
-            else if(ret == PARSE_EMPTY)
+            else if(ret == PARSE_EMPTY)  //Empty string
             {
                 pc.printf("%s", msg_empty);
                 pc.printf("%s", msg_ret);
                 pc.getc();
             }
-            else if(ret == PARSE_SHORT) //Input string has error
+            else if(ret == PARSE_SHORT) //Input string too short
             {
                  pc.printf("%s", msg_strshort);
                  pc.getc();