SO1602A Lib. SO1602A is Organic LED, has 16 chars and 2 lines. This lib supports printf() of C-Language. http://akizukidenshi.com/catalog/g/gP-08276/

Dependents:   NEW_LineTraceHub NEW_LineTraceHub_2 ColorSensorTest

Revision:
3:eaaedd09fa6b
Parent:
1:eef15a16fe7a
Child:
4:e17943b827d8
--- a/SO1602A.h	Fri Oct 02 06:43:18 2015 +0000
+++ b/SO1602A.h	Mon Oct 19 05:44:49 2015 +0000
@@ -1,21 +1,35 @@
 /**  SO1602A is Organic-LED, and has 16 chars/line and 2 lines.
+ * 
  * This librarry supports "printf()" C format.
+ * 
  *
- * EX. code.
- *  
- * I2C i2c(p9, p10);
- * SO1602A oled(i2c); // if SA0 is Low. Otherwise, oled(i2c, 0x7a);
- * // SO1602A oled(p9, p10);
- * oled.setContrast(0xff);
- * oled.setDispFlag(true, true, false);
- * oled.printf("test:%d,%f", i, 3.14);
+ * @code
+ * #include "mbed.h"
+ * #include "SO1602A.h"
+ * I2C i2c(p28, p27);
+ * SO1602A oled(i2c);
+ * DigitalOut led[]= {LED1, LED2, LED3, LED4};
+ * int main()
+ * {
+ *     oled.init();
+ *     int iter= 0;
+ *     while(true) {
+ *         led[0] = !led[0];
+ *         oled.printf("iter: %5.5d.", iter);
+ *         wait(1.0f);
+ *         if(iter%10 == 0)    // 10s
+ *             oled.clear();
+ *         iter++;
+ *     }
+ * }
+ * @endcode
  */
 
 #pragma once
 
 #include "mbed.h"
 
-// SA0(Pin4)=Low: i2c_addr= 0x78, High: 0x7a;
+// SA0(Pin4); Low: i2c_addr= 0x78, High: 0x7a;
 // DDRAM addr. Line1: 0x00 ~ 0x0f. Line2: 0x20 ~ 0x2f.
 
 class SO1602A : public Stream{
@@ -46,13 +60,13 @@
     /** Set Display flag.
      * @parm Enable Display, Cursor turned on, Cursor Blink.
      */
-    void setDispFlag(bool disp, bool cursor, bool blink);
+    void setDispFlag(bool disp= true, bool cursor= true, bool blink= true);
 
 private:    
     I2C i2c;
     char addr;
     char buf[3];
-    int _column, _row;
+    int col, row;
     
     bool cmd(char chr);