Library for Siemens SDA5708 8 digit LED matrix display. The control interface is SPI.

Dependents:   mbed_SDA5708

Revision:
1:d8a07b8468f6
Parent:
0:5265413226e5
Child:
2:966fca76e5aa
--- a/SDA5708.h	Mon Sep 29 19:39:18 2014 +0000
+++ b/SDA5708.h	Tue Sep 30 17:13:47 2014 +0000
@@ -54,6 +54,21 @@
 // First byte defines top row. D7..D5 are always 0, D4..D0 define bitpattern. D4 is leftmost, D0 is rightmost pixel.
 //
 
+extern const char udc_0[];       // |>
+extern const char udc_1[];       // <|
+extern const char udc_2[];       // |
+extern const char udc_3[];       // ||
+extern const char udc_4[];       // |||
+extern const char udc_5[];       // =
+extern const char udc_6[];       // checkerboard
+extern const char udc_7[];       // \
+
+extern const char udc_Bat_Hi[];  // Battery Full
+extern const char udc_Bat_Ha[];  // Battery Half
+extern const char udc_Bat_Lo[];  // Battery Low
+extern const char udc_AC[];      // AC Power
+extern const char udc_smiley[];  // Smiley
+
 /** A library for driving SDA5708 LED matrix displays
  *
  * @code
@@ -87,19 +102,34 @@
  * @endcode
  */
 
+
+#if(SDA5708_PRINTF == 1)
 /** Create an SDA5708 Display object connected to the proper pins
  *
  * @param  *spi SPI port
  * @param  cs   PinName for Chip Select (active low)
  * @param  rst  PinName for Reset (active low)
 */
-#if(SDA5708_PRINTF == 1)
 class SDA5708 : public Stream {  
 #else    
+/** Create an SDA5708 Display object connected to the proper pins
+ *
+ * @param  *spi SPI port
+ * @param  cs   PinName for Chip Select (active low)
+ * @param  rst  PinName for Reset (active low)
+*/
 class SDA5708 {
 #endif
 
 public:
+
+    /** Display control */
+    enum DisplayMode {
+        DispOff,  /**<  Display Off */    
+        DispOn    /**<  Display On */            
+    };
+
+
    /** Create an SDA5708 Display object connected to the proper pins
      *
      * @param  *spi SPI port
@@ -150,14 +180,26 @@
      */
     void locate(int column=0, int row=0);
 
+    /** Set the Displaymode
+     *
+     * @param displayMode The Display mode (DispOff, DispOn)
+     */
+    void setMode(DisplayMode displayMode);     
+
     /** Set Brightness
      *
      * @param brightness The brightness level (valid range 0..7)
      */
     void set_brightness(uint8_t brightness);  
     
+    /** Set User Defined Characters (UDC)
+     *
+     * @param unsigned char c   The Index of the UDC (0..7)
+     * @param char *udc_data    The bitpatterns for the UDC (7 bytes of 5 significant bits for bitpattern)       
+     */
+    void setUDC(unsigned char c, char *udc_data);   
+    
 protected:
-
     /** Low level Reset method for controller
       */  
     void _reset();
@@ -178,8 +220,14 @@
     int _column;
     int _peak, _brightness;
 
+    // Local UDC memory
+    char _udc[8][7]; 
+    
+    //SPI bus
     SPI *_spi;
-    DigitalOut _cs, _rst;         
+    DigitalOut _cs;         
+
+    DigitalOut _rst;             
 };