Usb Device Interface, protocol, and programming homework #4 Audio Control device
Dependencies: C12832_lcd USBDevice mbed
Diff: bargraph.h
- Revision:
- 3:6da430f4818a
- Parent:
- 0:69eb9d19fb91
diff -r dec5e78d579b -r 6da430f4818a bargraph.h --- a/bargraph.h Thu Aug 01 20:12:41 2013 +0000 +++ b/bargraph.h Mon Aug 05 02:02:58 2013 +0000 @@ -2,22 +2,37 @@ class bargraph { public: + /* + * Constructor , Requires a pointer to the LCD + */ bargraph(C12832_LCD *inlcd,int maxlevelsIn=32,int Xin=0,int Yin=0,int widthIn=128,int heightIn=32); - int level; + // This variable is used to draw the current volume level + unsigned int level; + // This variable represents the maximum volume Volume leveles are percents of maxlevel when graphed. + unsigned int maxlevels; + + //This function will redraw the Bar graph void updateBargraph(); - void setMaxLevel(int maxlevels); - void setLevel(int level); - + + //this fuction will reset the maxlevels and clea the current level + void setMaxLevel(unsigned int maxlevels); + //This function will set the level value. The input is 0x00 to 0xff and is normalized to a percent of maximum level. + void setLevel(unsigned int level); + private: + //How wide and tall the grpah is as where as where it should start. int x; int y; int width; int height; - int maxlevels; + + //When drawing bars how tall and wide should they be. int leveladjust; int levelwidth; - int lastLevel; + + //What was the last drawn state so we delete only what was drawn + unsigned int lastLevel; C12832_LCD *lcd; };