Driver for the Digole Serial universal LCD display adapter

Dependents:   DataBus

Revision:
1:959715b1d042
Parent:
0:3cf7c2683c3a
Child:
2:ca48a0077521
--- a/DigoleSerialDisp.h	Mon Feb 25 05:48:10 2013 +0000
+++ b/DigoleSerialDisp.h	Mon Feb 25 06:00:35 2013 +0000
@@ -1,6 +1,6 @@
 /** Digole Serial Display library, I2C
  *
- * @Author: Digole Digital Solutions : www.digole.com ported to mbed by Michael Shimniok www.bot-thoughts.com
+ * @Author: Digole Digital Solutions : www.digole.com ported from Arduino to mbed by Michael Shimniok http://www.bot-thoughts.com
  */
 #ifndef DigoleSerialDisp_h
 #define DigoleSerialDisp_h
@@ -26,37 +26,18 @@
 #define _GRAPH_ 1
 
 /** Digole Serial LCD/OLED Library
- *
- * Inherits from the Print class for all the fancy print/println stuff
+ * http://www.digole.com/index.php?productID=535
  *
- * Communication set up command
- *   "SB":Baud (ascII bytes end with 0x00/0x0A/0x0D) -- set UART Baud Rate
- *   "SI2CA":Address(1 byte <127) -- Set I2C address, default address is:0x27
- *   "DC":1/0(1byte) -- set config display on/off, if set to 1, displayer will display current commucation setting when power on
- * Text Function command
- *   "CL": -- Clear screen--OK
- *   "CS":1/0 (1 byte)-- Cursor on/off
- *   "TP":x(1 byte) y(1 byte) -- set text position
- *   "TT":string(bytes) end with 0x00/0x0A/0x0D -- display string under regular mode
- * Graphic function command
- *   "GP":x(1byte) y(1byte) -- set current graphic position
- *   "DM":"C/!/~/&/|/^"(ASCII 1byte) -- set drawing mode--C="Copy",! and ~ = "Not", & = "And", | = "Or", ^ = "Xor"
- *   "SC":1/0 (1byte) -- set draw color--only 1 and 0
- *   "LN":x0(1byte) y0(1byte) x1(1byte) y2(1byte)--draw line from x0,y0 to x1,y1,set new pot to x1,y1
- *   "LT":x(1byte) y(1byte) -- draw line from current pos to x,y
- *   "CC":x(1byte) y(1byte) ratio(byte) -- draw circle at x,y with ratio
- *   "DP":x(1byte) y(1byte) Color(1byte) -- draw a pixel--OK
- *   "DR":x0(1byte) y0(1byte) x1(1byte) y2(1byte)--draw rectangle, top-left:x0,y0; right-bottom:x1,y1
- *   "FR":x0(1byte) y0(1byte) x1(1byte) y2(1byte)--draw filled rectangle, top-left:x0,y0; right-bottom:x1,y1
+ * Includes Arduino Print class member functions
  */
 class DigoleSerialDisp {
 public:
 
     /** Create a new Digole Serial Display interface
      *
-     * @param sda - pin for I2C SDA
-     * @param scl - pin for I2C SCL
-     * @param address - 7-bit address (default is 0x27 for the device)
+     * @param sda is the pin for I2C SDA
+     * @param scl is the pin for I2C SCL
+     * @param address is the 7-bit address (default is 0x27 for the device)
      */
     DigoleSerialDisp(PinName sda, PinName scl, uint8_t address=0x27);
 
@@ -67,22 +48,22 @@
 
 
     /** Write out a raw character
-     * @param x - character
-     * @returns - 1
+     * @param x is the character to write
+     * @returns 1
      */
     size_t write(const char x);
 
 
     /** Write out raw data from a buffer
-     * @param buffer -- buffer to write
-     * @param size -- the number of bytes to write
+     * @param buffer is the char array to write
+     * @param size is the the number of bytes to write
      * @returns size
      */
     size_t write(const char *buffer, size_t size);
 
 
     /** Write out raw string
-     * @param str -- string to write
+     * @param str is the string to write
      * @returns number of bytes written
      */
     size_t write(const char *str);
@@ -90,7 +71,7 @@
    
     /** Prints a char to the display in a single I2C transmission using "TTb\0"
      *
-     * @param c - character to print
+     * @param c is the character to print
      * @returns 1
      */
     size_t print(const char c);
@@ -98,57 +79,62 @@
 
     /** Prints a string of data to the display in a single I2C transmission using "TTbbb...\0"
      *
-     * @param s -- array of data, null terminated
+     * @param s is the null-terminated char array to print
      * @returns length of s 
      */
     size_t print(const char s[]);
 
 
     /** Print out an unsigned char as a number
-     * @param u -- integer to print
-     * @param base -- base is DEC (default), HEX, BIN
+     * @param u is the integer to print
+     * @param base is the base to print, either DEC (default), HEX, BIN
+     * @returns number of chars written
      */
     size_t print(unsigned char u, int base = DEC);
 
 
     /** Print out an integer
-     * @param i -- integer to print
-     * @param base -- base is DEC (default), HEX, BIN
+     * @param i is the integer to print
+     * @param base is the base to print, either DEC (default), HEX, BIN
+     * @returns number of chars written
      */
     size_t print(int i, int base = DEC);
 
 
     /** Print out an unsigned integer
-     * @param u -- integer to print
-     * @param base -- base is DEC (default), HEX, BIN
+     * @param u is the integer to print
+     * @param base is the base to print, either DEC (default), HEX, BIN
+     * @returns number of chars written
      */
     size_t print(unsigned int u, int base = DEC);
     
 
     /** Print out a long as a number
-     * @param l -- integer to print
-     * @param base -- base is DEC (default), HEX, BIN
+     * @param l is the integer to print
+     * @param base is the base to print, either DEC (default), HEX, BIN
+     * @returns number of chars written
      */
     size_t print(long l, int base = DEC);
     
 
     /** Print out an unsigned long
-     * @param l -- integer to print
-     * @param base -- base is DEC (default), HEX, BIN
+     * @param l is the integer to print
+     * @param base is the base to print, either DEC (default), HEX, BIN
+     * @returns number of chars written
      */
     size_t print(unsigned long l, int base = DEC);
 
 
     /** Print out a double
-     * @param f -- integer to print
-     * @param digits -- number of digits after the decimal
+     * @param f is the integer to print
+     * @param digits is the number of digits after the decimal
      */
     size_t print(double f, int digits = 2);
 
 
     /** Prints a string of data to the display in a single I2C transmission using "TTbbb...\0"
      *
-     * @param s -- array of data, null terminated
+     * @param s is the null-terminated char array to print
      * @returns length of s 
      */
     size_t println(const char s[]);
@@ -156,7 +142,7 @@
 
     /** Prints a char the display in a single I2C transmission using "TTb\0"
      *
-     * @param c -- character to print
+     * @param c is the character to print
      * @returns 1
      */
     size_t println(char c);
@@ -164,43 +150,48 @@
 
     /** Prints an unsigned char as a number
      *
-     * @param u -- unsigned char number
+     * @param u is the unsigned char number
      * @returns 1
      */
     size_t println(unsigned char u, int base = DEC);
 
 
     /** Print out an integer
-     * @param i -- integer to print
-     * @param base -- base is DEC (default), HEX, BIN
+     * @param i is the integer to print
+     * @param base is the base to print, either DEC (default), HEX, BIN
+     * @returns number of chars written
      */
     size_t println(int i, int base = DEC);
 
 
     /** Print out an unsigned char as a number
-     * @param u -- integer to print
-     * @param base -- base is DEC (default), HEX, BIN
+     * @param u is the integer to print
+     * @param base is the base to print, either DEC (default), HEX, BIN
+     * @returns number of chars written
      */
     size_t println(unsigned int u, int base = DEC);
 
 
     /** Print out a long as a number
-     * @param l -- integer to print
-     * @param base -- base is DEC (default), HEX, BIN
+     * @param l is the integer to print
+     * @param base is the base to print, either DEC (default), HEX, BIN
+     * @returns number of chars written
      */
     size_t println(long l, int base = DEC);
 
 
     /** Print out an unsigned long
-     * @param l -- integer to print
-     * @param base -- base is DEC (default), HEX, BIN
+     * @param l is the integer to print
+     * @param base is the base to print, either DEC (default), HEX, BIN
+     * @returns number of chars written
      */
     size_t println(unsigned long l, int base = DEC);
 
 
     /** Print out a double
-     * @param f -- integer to print
-     * @param digits -- number of digits after the decimal
+     * @param f is the integer to print
+     * @param digits is the number of digits after the decimal
+     * @returns number of chars written
      */
     size_t println(double f, int digits = 2);
 
@@ -220,16 +211,16 @@
     void enableCursor(void);
     
     /** Displays a string at specified coordinates
-     * @param x -- x coordinate to display string
-     * @param y -- y coordinate to display string
-     * @param s -- string to display
+     * @param x is the x coordinate to display the string
+     * @param y is the y coordinate to display the string
+     * @param s is the string to display
      */
     void drawStr(uint8_t x, uint8_t y, const char *s);
     
     /** Sets the print position for graphics or text
-     * @param x -- x coordinate to display string
-     * @param y -- y coordinate to display string
-     * @param graph -- if _TEXT_ affects subsequent text position, otherwise, affects graphics position
+     * @param x is the x coordinate to display the string
+     * @param y is the y coordinate to display the string
+     * @param graph if set to _TEXT_ affects subsequent text position, otherwise, affects graphics position
      */
     void setPrintPos(uint8_t x, uint8_t y, uint8_t graph = _TEXT_);
     
@@ -237,13 +228,13 @@
     void clearScreen(void);
     
     /** Configure your LCD if other than 1602 and the chip is other than KS0066U/F / HD44780 
-     * @param col -- number of columns
-     * @param row -- number of rows
+     * @param col is the number of columns
+     * @param row is the number of rows
      */
     void setLCDColRow(uint8_t col, uint8_t row);
     
     /** Sets a new I2C address for the display (default is 0x27), the adapter will store the new address in memory
-     * @param address -- the new address 
+     * @param address is the the new address 
      */
     void setI2CAddress(uint8_t add);
     
@@ -251,7 +242,7 @@
      * so, when the module is powered up, it will display 
      * current communication mode on LCD, after you 
      * design finished, you can turn it off
-     * @param v -- 1 is on, 0 is off
+     * @param v is the 1 is on, 0 is off
      */
     void displayConfig(uint8_t v);
     
@@ -303,14 +294,14 @@
     void directCommand(uint8_t d); 
     
     /** send data to LCD drectly
-     * @param d -- data
+     * @param d is the data
      */
     void directData(uint8_t d); 
     
     /** Move rectangle area on screen to another place
-     * @param x0, y1 -- top left of the area to move
-     * @param x1, y1 -- bottom right of the area to move
-     * @param xoffset, yoffset -- the distance to move
+     * @param x0, y1 is the top left of the area to move
+     * @param x1, y1 is the bottom right of the area to move
+     * @param xoffset, yoffset is the the distance to move
      */
     void moveArea(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, char xoffset, char yoffset);
 
@@ -332,20 +323,20 @@
 
     /** Set Start Screen, 1st B is the lower byte of data length. 
      * Convert images to C array here: <a href="http://www.digole.com/tools/PicturetoC_Hex_converter.php">http://www.digole.com/tools/PicturetoC_Hex_converter.php</a>
-     * @param lon -- length of data
-     * @param data -- binary data
+     * @param lon is the length of data
+     * @param data is the binary data
      */
     void uploadStartScreen(int lon, const unsigned char *data); //upload start screen
     
     /** Upload a user font
-     * @param lon -- length of data
-     * @param data -- user font data
-     * @param sect -- section of memory you want to upload to
+     * @param lon is the length of data
+     * @param data is the user font data
+     * @param sect is the section of memory you want to upload to
      */
     void uploadUserFont(int lon, const unsigned char *data, uint8_t sect); //upload user font
 
     /** Send a Byte to output head on board
-     * @param x -- byte to output
+     * @param x is the byte to output
      */
     void digitalOutput(uint8_t x);