Usb Device Interface, protocol, and programming homework #4 Audio Control device

Dependencies:   C12832_lcd USBDevice mbed

Revision:
3:6da430f4818a
Parent:
1:948ffad3284f
diff -r dec5e78d579b -r 6da430f4818a MyDisplayClass.cpp
--- a/MyDisplayClass.cpp	Thu Aug 01 20:12:41 2013 +0000
+++ b/MyDisplayClass.cpp	Mon Aug 05 02:02:58 2013 +0000
@@ -1,8 +1,11 @@
 #include "MyDisplayClass.h"
-
+//Constructor
 MyDisplayClass::MyDisplayClass(){
+   //Create a new LCD instance
    lcd=new C12832_LCD();
+   //Create a new bargraph instance
    volume=new bargraph(lcd,32);
+   //Set the default feature modes. Volme Display off. Graphic mode off.
    volumeDisplayEnable=false;
    graphicModeEnable=false;
 }
@@ -38,6 +41,7 @@
       volume->setMaxLevel(level);
    }
 
+//When in Graphic mode update USB status with pictures.
 void MyDisplayClass::UpdateStatus(int state){
     switch(state) {
        case 2:  drawSuspend(lcd); break;
@@ -46,8 +50,8 @@
       }
 }
 
+//When in text mode update the USB status based on state
 void MyDisplayClass::UpdateTextStatus(int state){
-   
        lcd->locate(3,12);
        lcd->printf("         ");
        lcd->locate(3,12);
@@ -59,15 +63,19 @@
 
 }
 
+//Update the volume control display bsed on feature enable state, USB state and volume
 void MyDisplayClass::update(int state){
+      //Is volume display enabled
       if(volumeDisplayEnable)
+         //Volume:Is Graphic mode enabled or should messages be in text
          if(graphicModeEnable) {
+           //Call Graphic mode update function
            volume->updateBargraph();
          } else {
            lcd->locate(3,3);
-           lcd->printf("Volume: %2d",volume->level); 
+           lcd->printf("Volume: %3d PCT%",(volume->level * 100)/volume->maxlevels); 
          } 
-  
+         //USB:Is Graphic mode enabled or should messages be in text  
         if(graphicModeEnable)  
            UpdateStatus(state);
         else