6 x 7 segment display library for PCA9637 driven breakout board

Dependents:   FTSE100 InternetDispBoB digitalThermometer Counter ... more

Revision:
9:44de04d410df
Parent:
8:a875c4229c57
Child:
12:2235c72db927
--- a/dispBoB.h	Wed Jun 29 14:08:42 2011 +0000
+++ b/dispBoB.h	Thu Jun 30 15:03:18 2011 +0000
@@ -28,7 +28,7 @@
 * }
 * @endcode
 */
-class dispBoB {
+class dispBoB : public Stream {
 public:
     //constructor
     /** Create a dispBoB object defined on the I2C master bus
@@ -43,23 +43,12 @@
     /** Clear screen
     *
     */
-    void cls(void);
+    virtual void cls(void);
     /** Set cursor position
     *
     * @param pos display location left to right (0-5)
     */
-    void locate(char pos);
-    /** Put an ASCII encoded character onto display at current location
-    *
-    * @param c ASCII encoded character or number (no punctuation)
-    */
-    void putc(char c);
-    /** Put an ASCII encoded character onto display at specified location
-    *
-    * @param c ASCII encoded character or number
-    * @param pos display location left to right (0-5)  
-    */
-    void write(string str);
+    virtual void locate(char pos);    
     /** Write a scrolling string (right to left) to display 
     *
     * @param str String to be displayed (no punctuation)
@@ -72,11 +61,31 @@
     */
     void bus(short leds);
     
-private:
+#if DOXYGEN_ONLY
+    /** Write a character to the display
+     *
+     * @param c The character to write to the display
+     */
+    int putc(int c);
+    /** Write a formated string to the LCD
+     *
+     * @param format A printf-style format string, followed by the
+     *               variables to use in formating the string. N.B. it will
+     *               only display the first 6 characters.
+     */
+    int printf(const char* format, ...);
+#endif
+    
+protected:
+
+    //Stream implementation functions
+    virtual int _putc(int c);
+    virtual int _getc();
 
     PCA9635 _pca;
     DigitalOut _en;
     char _cursor; 
+    char _pos;
 };
 
 #endif