Usb Device Interface, protocol, and programming homework #4 Audio Control device
Dependencies: C12832_lcd USBDevice mbed
bargraph.h@3:6da430f4818a, 2013-08-05 (annotated)
- Committer:
- jakowisp
- Date:
- Mon Aug 05 02:02:58 2013 +0000
- Revision:
- 3:6da430f4818a
- Parent:
- 0:69eb9d19fb91
Fixed several known issues to complete the assignment
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jakowisp | 0:69eb9d19fb91 | 1 | #include "C12832_lcd.h" |
jakowisp | 0:69eb9d19fb91 | 2 | |
jakowisp | 0:69eb9d19fb91 | 3 | class bargraph { |
jakowisp | 0:69eb9d19fb91 | 4 | public: |
jakowisp | 3:6da430f4818a | 5 | /* |
jakowisp | 3:6da430f4818a | 6 | * Constructor , Requires a pointer to the LCD |
jakowisp | 3:6da430f4818a | 7 | */ |
jakowisp | 0:69eb9d19fb91 | 8 | bargraph(C12832_LCD *inlcd,int maxlevelsIn=32,int Xin=0,int Yin=0,int widthIn=128,int heightIn=32); |
jakowisp | 0:69eb9d19fb91 | 9 | |
jakowisp | 3:6da430f4818a | 10 | // This variable is used to draw the current volume level |
jakowisp | 3:6da430f4818a | 11 | unsigned int level; |
jakowisp | 3:6da430f4818a | 12 | // This variable represents the maximum volume Volume leveles are percents of maxlevel when graphed. |
jakowisp | 3:6da430f4818a | 13 | unsigned int maxlevels; |
jakowisp | 3:6da430f4818a | 14 | |
jakowisp | 3:6da430f4818a | 15 | //This function will redraw the Bar graph |
jakowisp | 0:69eb9d19fb91 | 16 | void updateBargraph(); |
jakowisp | 3:6da430f4818a | 17 | |
jakowisp | 3:6da430f4818a | 18 | //this fuction will reset the maxlevels and clea the current level |
jakowisp | 3:6da430f4818a | 19 | void setMaxLevel(unsigned int maxlevels); |
jakowisp | 3:6da430f4818a | 20 | //This function will set the level value. The input is 0x00 to 0xff and is normalized to a percent of maximum level. |
jakowisp | 3:6da430f4818a | 21 | void setLevel(unsigned int level); |
jakowisp | 3:6da430f4818a | 22 | |
jakowisp | 0:69eb9d19fb91 | 23 | private: |
jakowisp | 3:6da430f4818a | 24 | //How wide and tall the grpah is as where as where it should start. |
jakowisp | 0:69eb9d19fb91 | 25 | int x; |
jakowisp | 0:69eb9d19fb91 | 26 | int y; |
jakowisp | 0:69eb9d19fb91 | 27 | int width; |
jakowisp | 0:69eb9d19fb91 | 28 | int height; |
jakowisp | 3:6da430f4818a | 29 | |
jakowisp | 3:6da430f4818a | 30 | //When drawing bars how tall and wide should they be. |
jakowisp | 0:69eb9d19fb91 | 31 | int leveladjust; |
jakowisp | 0:69eb9d19fb91 | 32 | int levelwidth; |
jakowisp | 3:6da430f4818a | 33 | |
jakowisp | 3:6da430f4818a | 34 | //What was the last drawn state so we delete only what was drawn |
jakowisp | 3:6da430f4818a | 35 | unsigned int lastLevel; |
jakowisp | 0:69eb9d19fb91 | 36 | |
jakowisp | 0:69eb9d19fb91 | 37 | C12832_LCD *lcd; |
jakowisp | 0:69eb9d19fb91 | 38 | }; |
jakowisp | 0:69eb9d19fb91 | 39 | |
jakowisp | 0:69eb9d19fb91 | 40 |