SPKDisplay - A mbed display class and processing imaging tools for 128x64 OLEDs using the SSD1305 driver, connected via SPI.

Dependents:   SPK-DVIMXR SPK-DMXer

Revision:
1:dd3faa2ab1dd
Parent:
0:76bb084fa033
Child:
2:8187d69071f8
--- a/spk_oled_ssd1305.h	Sun Apr 15 16:51:01 2012 +0000
+++ b/spk_oled_ssd1305.h	Sun Apr 15 19:39:17 2012 +0000
@@ -1,6 +1,9 @@
 // OLED display using SSD1305 driver
 // Copyright *spark audio-visual 2012
-
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License version 3 as published by the Free Software Foundation.
 
 #ifndef SPK_OLED_SSD1305_h
 #define SPK_OLED_SSD1305_h
@@ -16,12 +19,12 @@
 #define pageCount 8
 
 /** Display class for 128x64 OLEDs using the SSD1305 driver
-  * ie. DENSITRON - DD-12864YO-3A
+  * Display ie. DENSITRON - DD-12864YO-3A
   *
-  * This is a ground-up, minimal library. Currently it will display a full-screen image, draw horizontal lines, and display rows of text.
+  * This is a ground-up, minimal library. Further functionality as and when its needed or anybody wants to contribute.
   * 
   * This library includes two processing sketches to create a font and full-screen image in the required byte representations.
-  * It won't compile without you doing that - it expects const uint8_t image[] and const uint8_t* characterBytes[]
+  * Without creating your a font and image, all this library will do is blank the screen and draw horizontal lines. But at least you'll know its working!
   * 
   * Terminology:
   * 'rows' are 8 pixel high rows across the display, 0 being the topmost and 7 the bottom.
@@ -29,8 +32,13 @@
   *
   * Example:
   * @code
+  * // Create object and load font
   * SPKDisplay screen(p5, p7, p8, p10, p9)
-  * screen.imageToBuffer();
+  * screen.fontStartCharacter = &myStartChar;
+  * screen.fontEndCharacter = &myEndChar;
+  * screen.fontCharacters = myFontArray;
+  * // Draw
+  * screen.imageToBuffer(myImageByteArray);
   * screen.textToBuffer("*spark OLED SSD1305",0);
   * screen.textToBuffer("v01",1);
   * screen.sendBuffer
@@ -50,6 +58,18 @@
      */
     SPKDisplay(PinName mosi, PinName clk, PinName cs, PinName dc, PinName res, Serial *debugSerial = NULL);
 
+    /** Font - Assign the ASCII value of the character at the start of the implemented range */
+    const int *fontStartCharacter;
+    
+    /** Font - Assign the ASCII value of the character at the end of the implemented range */
+    const int *fontEndCharacter;
+    
+    /** Font - Assign the font, an array of 8x8px characters
+     *
+     * @note The processing sketch spk_oled_fontByteMaker--processing takes characterCount*8px x 8px images and creates the code to declare the font array needed by this method
+     */
+    uint8_t const **fontCharacters;
+    
     /** Completely clear the object's display representation */
     void clearBuffer();
     
@@ -59,8 +79,12 @@
      */
     void clearBufferRow(int row);
     
-    /** Replace the object\s display representation with the contents of image[] */ 
-    void imageToBuffer();
+    /** Replace the object\s display representation with the contents of image
+     *
+     * @param image An array of 1056 bytes representing an image.
+     * @note The processing sketch spk_oled_screenByteMaker--processing takes 132x64 images and creates the code to declare such arrays
+     */ 
+    void imageToBuffer(const uint8_t* image);
     
     /** Draw a horizontal line in the object's display representation 
      * 
@@ -69,6 +93,7 @@
     void horizLineToBuffer(int y);
     
     /** Write a line of text in the object's display representation
+     * Requires the font to have been set
      * 
      * @param message   The text to write. The text will be truncated if longer than the screen's width.
      * @param row       The row in which to write the text