Library for EarthLCD ezLCD3xx line of products
Diff: ezLCDLib.cpp
- Revision:
- 5:4a6254e2012f
- Parent:
- 3:28e71ce23bfd
- Child:
- 6:83cada1140d4
--- a/ezLCDLib.cpp Mon Apr 29 04:44:16 2013 +0000 +++ b/ezLCDLib.cpp Thu May 02 02:32:26 2013 +0000 @@ -1,3 +1,13 @@ +/** +* +* +* +* +* +* +*/ + + #include "mbed.h" #include "ezLCDLib.h" @@ -32,8 +42,6 @@ // Stop if buffer full while ((_ser.readable()) || (((rx_in + 1) % buffer_size) == rx_out)) { rx_buffer[rx_in] = _ser.getc(); -// Uncomment to Echo to USB serial to watch data flow -// monitor_device.putc(rx_buffer[rx_in]); rx_in = (rx_in + 1) % buffer_size; } return; @@ -212,7 +220,22 @@ _ser.putc('\r'); waitForCR(); } - +void ezLCD3::lineType( int type ) +{ + sendInt(Line_Type); + _ser.putc(' '); + sendInt(type); + _ser.putc('\r'); + waitForCR(); +} +void ezLCD3::lineWidth( int width ) +{ + sendInt(Line_Width); + _ser.putc(' '); + sendInt(width); + _ser.putc('\r'); + waitForCR(); +} void ezLCD3::circle(int radius, bool filled) { sendInt(Circle); @@ -298,13 +321,10 @@ void ezLCD3::print( char *str ) { -// unsigned char c; sendInt(Print); _ser.putc(' '); _ser.putc('\"'); sendString(str); -// while( (c = *str++) ) -// _ser.putc(c); _ser.putc('\"'); _ser.putc('\r'); waitForCR(); @@ -322,6 +342,53 @@ waitForCR(); } +void ezLCD3::font( char *str) +{ + sendInt(Font); + _ser.putc(' '); + sendString(str); + _ser.putc('\r'); + waitForCR(); +} + +void ezLCD3::fontO( bool dir ) +{ + sendInt(Font_Orient); + _ser.putc(' '); + if(dir) + _ser.putc('1'); + else + _ser.putc('0'); + _ser.putc('\r'); + waitForCR(); +} + +void ezLCD3::clipArea( int l, int t, int r, int b) +{ + sendInt(ClipArea); + _ser.putc(' '); + sendInt(l); + _ser.putc(' '); + sendInt(t); + _ser.putc(' '); + sendInt(r); + _ser.putc(' '); + sendInt(b); + _ser.putc(' '); + _ser.putc('\r'); + waitForCR(); +} +void ezLCD3::clipEnable( bool enable) +{ + sendInt(ClipEnable); + _ser.putc(' '); + if(enable) + _ser.putc('1'); + else + _ser.putc('0'); + _ser.putc('\r'); + +} void ezLCD3::theme(int ID, int EmbossDkColor, int EmbossLtColor, int TextColor0, int TextColor1, int TextColorDisabled, int Color0, int Color1, int ColorDisabled, int CommonBkColor, int Fontw) { sendInt(Widget_Theme); @@ -350,8 +417,29 @@ _ser.putc('\r'); waitForCR(); } +void ezLCD3::groupBox( int ID, int x, int y, int w, int h, int options, int theme, int stringID) +{ + sendInt(Set_Gbox); + _ser.putc(' '); + sendInt(ID); + _ser.putc(' '); + sendInt(x); + _ser.putc(' '); + sendInt(y); + _ser.putc(' '); + sendInt(w); + _ser.putc(' '); + sendInt(h); + _ser.putc(' '); + sendInt(options); + _ser.putc(' '); + sendInt(theme); + _ser.putc(' '); + sendInt(stringID); + _ser.putc('\r'); + waitForCR(); +} -//ameter [ID][x][y][width][height][options][value][min][max][theme][stringID][type] void ezLCD3::ameter( int ID, int x, int y, int w, int h, int options, int value, int min, int max, int theme, int stringID, int type) { sendInt(Set_AMeter); @@ -469,6 +557,33 @@ waitForCR(); } +void ezLCD3::slider(int ID, int x, int y, int w, int h, int option, int range, int res, int value, int theme) +{ + sendInt(Set_Slider); + _ser.putc(' '); + sendInt(ID); + _ser.putc(' '); + sendInt(x); + _ser.putc(' '); + sendInt(y); + _ser.putc(' '); + sendInt(w); + _ser.putc(' '); + sendInt(h); + _ser.putc(' '); + sendInt(option); + _ser.putc(' '); + sendInt(range); + _ser.putc(' '); + sendInt(res); + _ser.putc(' '); + sendInt(value); + _ser.putc(' '); + sendInt(theme); + _ser.putc('\r'); + waitForCR(); +} + void ezLCD3::image( int x, int y, char *str ) { sendInt(Picture);